Use participant_sort_users_by_first_name config var for overview table, participant list (pdf) and first time passwords (pdf).

This commit is contained in:
Emanuel Schuetze 2012-10-30 23:00:24 +01:00
parent 4ee518dd96
commit 9a522f3835
2 changed files with 12 additions and 3 deletions

View File

@ -145,7 +145,7 @@ 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() self.users = User.objects.all().order_by('last_name')
self.groups = Group.objects.filter(group_as_person=True) self.groups = Group.objects.filter(group_as_person=True)
def __iter__(self): def __iter__(self):

View File

@ -98,6 +98,8 @@ class Overview(ListView):
else: else:
if config['participant_sort_users_by_first_name']: if config['participant_sort_users_by_first_name']:
query = query.order_by('first_name') query = query.order_by('first_name')
else:
query = query.order_by('last_name')
if 'reverse' in sortfilter: if 'reverse' in sortfilter:
query = query.reverse() query = query.reverse()
@ -215,6 +217,9 @@ class ParticipantsListPDF(PDFView):
def append_to_pdf(self, story): def append_to_pdf(self, story):
data = [['#', _('Last Name'), _('First Name'), _('Group'), _('Type'), data = [['#', _('Last Name'), _('First Name'), _('Group'), _('Type'),
_('Committee')]] _('Committee')]]
if config['participant_sort_users_by_first_name']:
sort = 'first_name'
else:
sort = 'last_name' sort = 'last_name'
counter = 0 counter = 0
for user in User.objects.all().order_by(sort): for user in User.objects.all().order_by(sort):
@ -257,7 +262,11 @@ class ParticipantsPasswordsPDF(PDFView):
data = [] data = []
participant_pdf_system_url = config["participant_pdf_system_url"] participant_pdf_system_url = config["participant_pdf_system_url"]
participant_pdf_welcometext = config["participant_pdf_welcometext"] participant_pdf_welcometext = config["participant_pdf_welcometext"]
for user in User.objects.all().order_by('last_name'): if config['participant_sort_users_by_first_name']:
sort = 'first_name'
else:
sort = 'last_name'
for user in User.objects.all().order_by(sort):
cell = [] cell = []
cell.append(Spacer(0, 0.8 * cm)) cell.append(Spacer(0, 0.8 * cm))
cell.append(Paragraph(_("Account for OpenSlides"), cell.append(Paragraph(_("Account for OpenSlides"),