From 5fadfcb0a7c4da9faff81a84b02b93e9fe270911 Mon Sep 17 00:00:00 2001 From: Frank Poetzsch-Heffter <p-h@katharineum.de> Date: Fri, 12 Apr 2019 03:36:34 +0200 Subject: [PATCH] aub archive filter with fullnames --- schoolapps/aub/filters.py | 6 +- .../aub/migrations/0012_auto_20190411_1906.py | 58 +++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 schoolapps/aub/migrations/0012_auto_20190411_1906.py diff --git a/schoolapps/aub/filters.py b/schoolapps/aub/filters.py index c6a74a1dd..880f283c7 100644 --- a/schoolapps/aub/filters.py +++ b/schoolapps/aub/filters.py @@ -9,8 +9,10 @@ class AUBFilter(django_filters.FilterSet): ''' Find all users who sends an AUB''' aub_users = Aub.objects.values_list('created_by') users = list(User.objects.filter(id__in=aub_users)) - user_ids = [(str(user.id),user.username) for user in users] - return user_ids + # user_ids = [(str(user.id),user.username) for user in users] + user_ids = [(str(user.id),user.last_name+', '+user.first_name) for user in users] + user_ids_sorted = sorted(user_ids, key=lambda user: user[1]) + return user_ids_sorted created_by = django_filters.ChoiceFilter(label='Von', choices=getAUBUsers()) diff --git a/schoolapps/aub/migrations/0012_auto_20190411_1906.py b/schoolapps/aub/migrations/0012_auto_20190411_1906.py new file mode 100644 index 000000000..179c8a72b --- /dev/null +++ b/schoolapps/aub/migrations/0012_auto_20190411_1906.py @@ -0,0 +1,58 @@ +# Generated by Django 2.1.2 on 2019-04-11 17:06 + +import datetime +from django.conf import settings +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('aub', '0011_merge_20190318_2004'), + ] + + operations = [ + migrations.AlterModelOptions( + name='aub', + options={'permissions': (('apply_for_aub', 'Apply for a AUB'), ('cancel_aub', 'Cancel a AUB'), ('allow1_aub', 'First permission'), ('allow2_aub', 'Second permission'), ('check1_aub', 'Check a AUB'), ('check2_aub', 'Check a AUB'), ('view_archive', 'View AUB archive')), 'verbose_name': 'AUB', 'verbose_name_plural': 'AUBs'}, + ), + migrations.AlterField( + model_name='aub', + name='created_at', + field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Erstellungszeitpunkt'), + ), + migrations.AlterField( + model_name='aub', + name='created_by', + field=models.ForeignKey(default=1, on_delete=models.SET(1), related_name='aubs', to=settings.AUTH_USER_MODEL, verbose_name='Erstellt von'), + ), + migrations.AlterField( + model_name='aub', + name='from_date', + field=models.DateField(default=datetime.date.today, verbose_name='Startdatum'), + ), + migrations.AlterField( + model_name='aub', + name='from_time', + field=models.TimeField(default=django.utils.timezone.now, verbose_name='Startzeit'), + ), + migrations.AlterField( + model_name='aub', + name='status', + field=models.IntegerField(choices=[(0, 'In Bearbeitung 1'), (1, 'In Bearbeitung 2'), (2, 'Genehmigt'), (3, 'Abgelehnt')], default=0, verbose_name='Status'), + ), + migrations.AlterField( + model_name='aub', + name='to_date', + field=models.DateField(default=datetime.date.today, verbose_name='Enddatum'), + ), + migrations.AlterField( + model_name='aub', + name='to_time', + field=models.TimeField(default=django.utils.timezone.now, verbose_name='Endzeit'), + ), + migrations.DeleteModel( + name='Status', + ), + ] -- GitLab