diff --git a/kallithea/controllers/admin/repo_groups.py b/kallithea/controllers/admin/repo_groups.py --- a/kallithea/controllers/admin/repo_groups.py +++ b/kallithea/controllers/admin/repo_groups.py @@ -303,8 +303,7 @@ class RepoGroupsController(BaseControlle #overwrite our cached list with current filter c.repo_cnt = 0 - groups = RepoGroup.query().order_by(RepoGroup.group_name) \ - .filter(RepoGroup.group_parent_id == c.group.group_id).all() + groups = RepoGroup.query(sorted=True).filter_by(parent_group=c.group).all() c.groups = self.scm_model.get_repo_groups(groups) c.repos_list = Repository.query(sorted=True).filter_by(group=c.group).all() diff --git a/kallithea/controllers/home.py b/kallithea/controllers/home.py --- a/kallithea/controllers/home.py +++ b/kallithea/controllers/home.py @@ -74,7 +74,7 @@ class HomeController(BaseController): log.debug('generating switcher repo/groups list') all_repos = Repository.query(sorted=True).all() repo_iter = self.scm_model.get_repos(all_repos) - all_groups = RepoGroup.query().order_by(RepoGroup.group_name).all() + all_groups = RepoGroup.query(sorted=True).all() repo_groups_iter = self.scm_model.get_repo_groups(all_groups) res = [{ diff --git a/kallithea/model/db.py b/kallithea/model/db.py --- a/kallithea/model/db.py +++ b/kallithea/model/db.py @@ -1518,7 +1518,7 @@ class RepoGroup(Base, BaseModel): CheckConstraint('group_id != group_parent_id', name='ck_groups_no_self_parent'), _table_args_default_dict, ) - __mapper_args__ = {'order_by': 'group_name'} + __mapper_args__ = {'order_by': 'group_name'} # TODO: Deprecated as of SQLAlchemy 1.1. SEP = ' » '