Enhence use of config var and Meta Class for default sorting of users
This commit is contained in:
parent
e5c132e34c
commit
269b093b28
@ -100,6 +100,7 @@ class User(DjangoUser, PersonMixin):
|
|||||||
('can_manage_participant',
|
('can_manage_participant',
|
||||||
ugettext_noop("Can manage participant")),
|
ugettext_noop("Can manage participant")),
|
||||||
)
|
)
|
||||||
|
ordering = ('last_name',)
|
||||||
|
|
||||||
|
|
||||||
class Group(DjangoGroup, PersonMixin):
|
class Group(DjangoGroup, PersonMixin):
|
||||||
@ -126,6 +127,9 @@ class Group(DjangoGroup, PersonMixin):
|
|||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return unicode(self.name)
|
return unicode(self.name)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ('name',)
|
||||||
|
|
||||||
|
|
||||||
class UsersAndGroupsToPersons(object):
|
class UsersAndGroupsToPersons(object):
|
||||||
"""
|
"""
|
||||||
@ -138,8 +142,8 @@ class UsersAndGroupsToPersons(object):
|
|||||||
if config['participant_sort_users_by_first_name']:
|
if config['participant_sort_users_by_first_name']:
|
||||||
self.users = User.objects.all().order_by('first_name')
|
self.users = User.objects.all().order_by('first_name')
|
||||||
else:
|
else:
|
||||||
self.users = User.objects.all().order_by('last_name')
|
self.users = User.objects.all()
|
||||||
self.groups = Group.objects.filter(group_as_person=True).order_by('name')
|
self.groups = Group.objects.filter(group_as_person=True)
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
if (not self.person_prefix_filter or
|
if (not self.person_prefix_filter or
|
||||||
|
@ -53,7 +53,7 @@ from openslides.participant.models import User, Group
|
|||||||
|
|
||||||
class Overview(ListView):
|
class Overview(ListView):
|
||||||
"""
|
"""
|
||||||
Show all participants.
|
Show all participants (users).
|
||||||
"""
|
"""
|
||||||
permission_required = 'participant.can_see_participant'
|
permission_required = 'participant.can_see_participant'
|
||||||
template_name = 'participant/overview.html'
|
template_name = 'participant/overview.html'
|
||||||
@ -96,7 +96,8 @@ class Overview(ListView):
|
|||||||
query = query.order_by(
|
query = query.order_by(
|
||||||
'%s' % sortfilter['sort'][0])
|
'%s' % sortfilter['sort'][0])
|
||||||
else:
|
else:
|
||||||
query = query.order_by('last_name')
|
if config['participant_sort_users_by_first_name']:
|
||||||
|
query = query.order_by('first_name')
|
||||||
|
|
||||||
if 'reverse' in sortfilter:
|
if 'reverse' in sortfilter:
|
||||||
query = query.reverse()
|
query = query.reverse()
|
||||||
|
Loading…
Reference in New Issue
Block a user