Self hosted FLOSS fitness/workout, nutrition and weight tracker
Output the number of deleted temporary users
Roland Geider5f5a2bab227f
diff --git a/wger/manager/management/commands/delete-temp-users.py b/wger/manager/management/commands/delete-temp-users.pyindex 48b81f2da..822150aff 100644--- a/wger/manager/management/commands/delete-temp-users.py+++ b/wger/manager/management/commands/delete-temp-users.py@@ -30,11 +30,13 @@ class Command(BaseCommand):def handle(self, *args, **options):- user_list = UserProfile.objects.filter(is_temporary=True)- for profile in user_list:+ profile_list = UserProfile.objects.filter(is_temporary=True)+ counter = 0+ for profile in profile_list:delta = now() - profile.user.date_joinedif (delta >= datetime.timedelta(7)):- #self.stdout.write("Deleting user %s, joined %s days ago\n" % (profile,- # delta.days))+ counter += 1profile.user.delete()++ self.stdout.write("Deleted {0} temporary users".format(counter))