# HG changeset patch # User neko259 # Date 2013-09-08 17:45:13 # Node ID 71e2d696a7ad46dcf822fe2f107a65b5c74a4f0c # Parent bc7ab92760df6fe3c014ecc08ea67babb47ab0eb Speed up tags ordering in the navigation panel. diff --git a/boards/models.py b/boards/models.py --- a/boards/models.py +++ b/boards/models.py @@ -308,6 +308,9 @@ class User(models.Model): def is_moderator(self): return RANK_MODERATOR >= self.rank + def get_sorted_fav_tags(self): + return self.fav_tags.order_by('name') + def __unicode__(self): return self.user_id + '(' + self.rank + ')' diff --git a/boards/views.py b/boards/views.py --- a/boards/views.py +++ b/boards/views.py @@ -292,7 +292,7 @@ def _init_default_context(request): user = _get_user(request) context['user'] = user - context['tags'] = sorted(user.fav_tags.all(), key=lambda tag: tag.name) + context['tags'] = user.get_sorted_fav_tags() context['theme'] = _get_theme(request, user) return context