From 7734a0d36f8246c0dad0191872f12312eb26ad9d Mon Sep 17 00:00:00 2001 From: MG Date: Sat, 18 May 2019 17:53:47 +0200 Subject: [PATCH] UI tweak --- .../management/commands/deletable.py | 21 +++++++++++++++---- src/templates/user/realm_user_detail.jinja2 | 16 ++++++++++---- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/account_helper/management/commands/deletable.py b/src/account_helper/management/commands/deletable.py index e0788a6..68ad440 100644 --- a/src/account_helper/management/commands/deletable.py +++ b/src/account_helper/management/commands/deletable.py @@ -15,16 +15,24 @@ class Command(BaseCommand): parser.add_argument( '--delete', action='store_true', - help='Delete poll instead of closing it', + help='Delete users which deletion time is lower than the current date', ) parser.add_argument( '--json', action='store_true', help='Return an json encoded String', ) + parser.add_argument( + '--all', + action='store_true', + help='Delete all marked user, --delete is required', + ) def handle(self, *args, **options): - deletables = DeletedUser.objects.filter(deletion_date__lte=timezone.now()) + if options['all']: + deletables = DeletedUser.objects.all() + else: + deletables = DeletedUser.objects.filter(deletion_date__lte=timezone.now()) output = "" if options['json']: json_output = {'deletables': []} @@ -34,7 +42,6 @@ class Command(BaseCommand): else: for user in deletables: output += f'{user}\n' - if options['delete']: LdapUser.base_dn = LdapUser.ROOT_DN for user in deletables: @@ -48,4 +55,10 @@ class Command(BaseCommand): pass if not options['json']: output += '\nSuccessfully deleted all listed users' - self.stdout.write(self.style.SUCCESS(output)) + if output: + self.stdout.write(self.style.SUCCESS(output)) + else: + for deletable in deletables: + self.stdout.write(self.style.SUCCESS(deletable)) + + diff --git a/src/templates/user/realm_user_detail.jinja2 b/src/templates/user/realm_user_detail.jinja2 index 12451ba..a9b7e49 100644 --- a/src/templates/user/realm_user_detail.jinja2 +++ b/src/templates/user/realm_user_detail.jinja2 @@ -26,14 +26,22 @@ Noch nicht generiert {% endif %} -
  • Vorname: {{ user.user.first_name }}
  • -
  • Nachname: {{ user.user.last_name }}
  • + {% if user.user.phone %} +
  • Vorname: {{ user.user.first_name }}
  • + {% endif %} + {% if user.user.phone %} +
  • Nachname: {{ user.user.last_name }}
  • + {% endif %}
  • Email: {{ user.user.email }}
  • Passwort: Nutzerpasswort zurücksetzen
  • -
  • Telefon: {{ user.user.phone }}
  • -
  • Mobiltelefon: {{ user.user.mobile_phone }}
  • + {% if user.user.phone %} +
  • Telefon: {{ user.user.phone }}
  • + {% endif %} + {% if user.user.mobile_phone %} +
  • Mobiltelefon: {{ user.user.mobile_phone }}
  • + {% endif %}
  • Gruppen: {% if groups %} {% for group in groups %}