Skip to content
Snippets Groups Projects
Commit 09cd872c authored by Odin Johan Vatne's avatar Odin Johan Vatne
Browse files

Protect admin from clearuserdata command

parent dc839ead
Branches
No related tags found
No related merge requests found
......@@ -26,13 +26,13 @@ class Command(BaseCommand):
count, count_dict = Project.objects.all().delete()
if count > 0:
wr_succ(f"Deleted {count} projects.")
wr_not(f'{count_dict}') # Does this show the projectTags deleted by cascade?
wr_not(f'{count_dict}')
else:
wr_not("No projects to delete.")
if options['delete_users']:
wr_not("Deleting all users")
count, count_dict = User.objects.all().delete()
count, count_dict = User.objects.exclude(username='admin').delete()
if count > 0:
wr_succ(f"Deleted {count} users.")
wr_not(f'{count_dict}')
......@@ -52,7 +52,7 @@ class Command(BaseCommand):
count, count_dict = TagCategory.objects.all().delete()
if count > 0:
wr_succ(f"Deleted {count} tag categories.")
wr_not(f'{count_dict}') # Does this show the projectTags deleted by cascade?
wr_not(f'{count_dict}')
else:
wr_not("No tag categories to delete.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment