diff --git a/hiboo/group/cli.py b/hiboo/group/cli.py index 9f57cd7efc1d438933fe7d9c2d34d154ebdec745..ac1ee192b8f0cd6d11a6e1081462c45a00389845 100644 --- a/hiboo/group/cli.py +++ b/hiboo/group/cli.py @@ -7,14 +7,14 @@ import terminaltables @blueprint.cli.command() @click.argument("groupname") -@click.argument("description", required=False, default="") -def create(groupname, description): +@click.argument("comment", required=False, default="") +def create(groupname, comment): """ Create a new group. """ assert not models.Group.query.filter_by(groupname=groupname).first() group = models.Group( groupname=groupname, - description=description + comment=comment ) models.db.session.add(group) models.db.session.commit() @@ -25,10 +25,10 @@ def list(): """ List all groups. """ click.echo(terminaltables.SingleTable( - [('uuid', 'groupname', 'description', 'users')] + + [('uuid', 'groupname', 'comment', 'users')] + [ [ - group.uuid, group.groupname, group.description, + group.uuid, group.groupname, group.comment, ','.join([user.username for user in group.users]) ] for group in models.Group.query.all() diff --git a/hiboo/group/forms.py b/hiboo/group/forms.py index 1f75de1b4ade8ade8a70a40b4020ac3afdd918b5..c7fec0511ea77eeccd8b1bf4426e33ce07316a59 100644 --- a/hiboo/group/forms.py +++ b/hiboo/group/forms.py @@ -12,7 +12,7 @@ class GroupCreateEdit(flask_wtf.FlaskForm): formatter.validators(), description = format(formatter.message) ) - description = fields.StringField(_('Description')) + comment = fields.StringField(_('Comment')) submit = fields.SubmitField(_('Edit group')) class GroupUserForm(flask_wtf.FlaskForm): diff --git a/hiboo/group/templates/group_details.html b/hiboo/group/templates/group_details.html index 682d26d02d5be0cdbd01e77852fd07e41e7d0d19..ca6dc2213ac171cbd1daeea5870b0ffc3735620b 100644 --- a/hiboo/group/templates/group_details.html +++ b/hiboo/group/templates/group_details.html @@ -18,8 +18,8 @@ <dd class="col-lg-9"> <code>{{ group.uuid }}</code> </dd> - <dt class="col-lg-3">{% trans %}Description{% endtrans %}</dt> - <dd class="col-lg-9">{{ group.description }}</dd> + <dt class="col-lg-3">{% trans %}Commentaire{% endtrans %}</dt> + <dd class="col-lg-9">{{ group.comment }}</dd> </dl> </div> </div> diff --git a/hiboo/group/templates/group_list.html b/hiboo/group/templates/group_list.html index 150793be3b6ce34f6116a637dd5a1318bb46e1b3..82c92ba6e906c4fa28e927397f2bbf414608110f 100644 --- a/hiboo/group/templates/group_list.html +++ b/hiboo/group/templates/group_list.html @@ -11,7 +11,7 @@ <thead> <tr> <th>{% trans %}Group{% endtrans %}</th> - <th>{% trans %}Description{% endtrans %}</th> + <th>{% trans %}Comment{% endtrans %}</th> <th>{% trans %}Members{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th> </tr> @@ -20,7 +20,7 @@ {% for group in groups %} <tr> <td><a href="{{ url_for("group.details", group_uuid=group.uuid) }}">{{ group.groupname }}</a></td> - <td>{{ group.description }}</td> + <td>{{ group.comment }}</td> <td> {% set user_list = [] %} {% for user in group.users %} diff --git a/hiboo/group/views.py b/hiboo/group/views.py index 968ddee0e5a146ae720ec2e223ad52c29f091ee7..55f75cf173bac05ea870a70dba4a8b3edd7ff6a5 100644 --- a/hiboo/group/views.py +++ b/hiboo/group/views.py @@ -18,7 +18,7 @@ def create(): else: group = models.Group() group.groupname = form.groupname.data - group.description = form.description.data + group.comment = form.comment.data models.db.session.add(group) models.db.session.commit() flask.flash(_("Group created successfully"), "success") @@ -58,7 +58,7 @@ def edit(group_uuid): actor=flask_login.current_user, group=group ) group.groupname = form.groupname.data - group.description = form.description.data + group.comment = form.comment.data models.db.session.add(group) models.db.session.commit() flask.flash(_("Group successfully updated"), "success") diff --git a/hiboo/models.py b/hiboo/models.py index e95f1ad14f93eb0f896a81e4b921626c5570ab36..b29bb3279931f4d42e68620d240b57585bcb527b 100644 --- a/hiboo/models.py +++ b/hiboo/models.py @@ -178,7 +178,6 @@ class Group(db.Model): __tablename__ = "group" groupname = db.Column(db.String(255), nullable=False, unique=True) - description = db.Column(db.String()) class Auth(db.Model): diff --git a/migrations/versions/46ae534e284f_add_groups_and_membership.py b/migrations/versions/46ae534e284f_add_groups_and_membership.py index f5f61cd924393cf6ebc6e2e0979ed0fb91335991..cfccf447a4c64759183c1977c28cce073f8f1ebd 100644 --- a/migrations/versions/46ae534e284f_add_groups_and_membership.py +++ b/migrations/versions/46ae534e284f_add_groups_and_membership.py @@ -19,7 +19,6 @@ depends_on = None def upgrade(): op.create_table('group', sa.Column('groupname', sa.String(length=255), nullable=False), - sa.Column('description', sa.String(), nullable=True), sa.Column('uuid', sa.String(length=36), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=True),