diff --git a/pagure/forms.py b/pagure/forms.py index 3caad54..ae43bc5 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -195,7 +195,7 @@ class NewGroupForm(wtf.Form): 'Group name *', [wtforms.validators.Required(), wtforms.validators.Length(max=16)] ) - grp_type = wtforms.SelectField( + group_type = wtforms.SelectField( 'Group type', [wtforms.validators.Required()], choices=[(item, item) for item in []] @@ -207,7 +207,7 @@ class NewGroupForm(wtf.Form): drop-down list. """ super(NewGroupForm, self).__init__(*args, **kwargs) - if 'grp_types' in kwargs: - self.grp_type.choices = [ - (grptype, grptype) for grptype in kwargs['grp_types'] + if 'group_types' in kwargs: + self.group_type.choices = [ + (grptype, grptype) for grptype in kwargs['group_types'] ] diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 5493d41..d0992b0 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -1762,32 +1762,32 @@ def generate_hook_token(session): session.commit() -def get_group_types(session, grp_type=None): +def get_group_types(session, group_type=None): ''' Return the list of type a group can have. ''' query = session.query( model.PagureGroupType ).order_by( - model.PagureGroupType.grp_type + model.PagureGroupType.group_type ) - if grp_type: + if group_type: query = query.filter( - model.PagureGroupType.grp_type == grp_type + model.PagureGroupType.group_type == group_type ) return query.all() -def search_groups(session, pattern=None, grp_name=None, grp_type=None): +def search_groups(session, pattern=None, group_name=None, group_type=None): ''' Return the groups based on the criteria specified. ''' query = session.query( model.PagureGroup ).order_by( - model.PagureGroup.grp_type + model.PagureGroup.group_type ) if pattern: @@ -1798,15 +1798,15 @@ def search_groups(session, pattern=None, grp_name=None, grp_type=None): if grp_name: query = query.filter( - model.PagureGroup.group_name == grp_name + model.PagureGroup.group_name == group_name ) - if grp_type: + if group_type: query = query.filter( - model.PagureGroup.grp_type == grp_type + model.PagureGroup.group_type == group_type ) - if grp_name: + if group_name: return query.first() else: return query.all() diff --git a/pagure/lib/model.py b/pagure/lib/model.py index 923b1b3..0ad6d51 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -90,7 +90,7 @@ def create_default_status(session): ERROR_LOG.debug('Status %s could not be added', ticket_stat) for grptype in ['user', 'admin']: - grp_type = PagureGroupType(grp_type=grptype) + grp_type = PagureGroupType(group_type=grptype) session.add(grp_type) try: session.commit() @@ -827,14 +827,14 @@ class PagureGroupType(BASE): # so we set the name to something safe for SQL __tablename__ = 'pagure_group_type' - grp_type = sa.Column(sa.String(16), primary_key=True) + group_type = sa.Column(sa.String(16), primary_key=True) created = sa.Column( sa.DateTime, nullable=False, default=datetime.datetime.utcnow) def __repr__(self): ''' Return a string representation of this object. ''' - return 'GroupType: %s' % (self.grp_type) + return 'GroupType: %s' % (self.group_type) class PagureGroup(BASE): @@ -848,9 +848,9 @@ class PagureGroup(BASE): id = sa.Column(sa.Integer, primary_key=True) group_name = sa.Column(sa.String(16), nullable=False, unique=True) - grp_type = sa.Column( + group_type = sa.Column( sa.String(16), - sa.ForeignKey('pagure_group_type.grp_type'), + sa.ForeignKey('pagure_group_type.group_type'), default='user', nullable=False) user_id = sa.Column( diff --git a/pagure/templates/login/admin_groups.html b/pagure/templates/login/admin_groups.html index 4a1e764..970a482 100644 --- a/pagure/templates/login/admin_groups.html +++ b/pagure/templates/login/admin_groups.html @@ -16,7 +16,7 @@