diff options
author | Magnus Hagander | 2015-01-19 21:22:56 +0000 |
---|---|---|
committer | Magnus Hagander | 2015-01-19 21:22:56 +0000 |
commit | 27da92efb0be66dfc1a68a6da469808c5f6f1df2 (patch) | |
tree | 4ceebe358d8b6ab257fd110eeb647cb4aa06721d | |
parent | 9b32be184483a7b29256ddb06e03679362c5e557 (diff) |
Fix sorting of users (committers, authors and reviewers)
-rw-r--r-- | pgcommitfest/commitfest/forms.py | 2 | ||||
-rw-r--r-- | pgcommitfest/commitfest/models.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/pgcommitfest/commitfest/forms.py b/pgcommitfest/commitfest/forms.py index 930f5ef..2a832ae 100644 --- a/pgcommitfest/commitfest/forms.py +++ b/pgcommitfest/commitfest/forms.py @@ -27,7 +27,7 @@ class CommitFestFilterForm(forms.Form): self.fields['status'] = forms.ChoiceField(choices=c, required=False) q = Q(patch_author__commitfests=cf) | Q(patch_reviewer__commitfests=cf) - userchoices = [(-1, '* All'), (-2, '* None'), (-3, '* Yourself') ] + [(u.id, '%s %s (%s)' % (u.first_name, u.last_name, u.username)) for u in User.objects.filter(q).distinct()] + userchoices = [(-1, '* All'), (-2, '* None'), (-3, '* Yourself') ] + [(u.id, '%s %s (%s)' % (u.first_name, u.last_name, u.username)) for u in User.objects.filter(q).distinct().order_by('last_name', 'first_name')] self.fields['author'] = forms.ChoiceField(choices=userchoices, required=False) self.fields['reviewer'] = forms.ChoiceField(choices=userchoices, required=False) diff --git a/pgcommitfest/commitfest/models.py b/pgcommitfest/commitfest/models.py index 21fe733..d60a1aa 100644 --- a/pgcommitfest/commitfest/models.py +++ b/pgcommitfest/commitfest/models.py @@ -19,6 +19,9 @@ class Committer(models.Model): def fullname(self): return "%s %s (%s)" % (self.user.first_name, self.user.last_name, self.user.username) + class Meta: + ordering = ('user__last_name', 'user__first_name') + class CommitFest(models.Model): STATUS_FUTURE=1 STATUS_OPEN=2 |