progress on conversion to tailwind
This commit is contained in:
parent
6a872124c6
commit
6e2843c60e
110 changed files with 4997 additions and 1691 deletions
0
accounts/management/commands/__init__.py
Normal file
0
accounts/management/commands/__init__.py
Normal file
19
accounts/management/commands/seed_default_friend_codes.py
Normal file
19
accounts/management/commands/seed_default_friend_codes.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from accounts.models import CustomUser, FriendCode
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Seed default friend codes for TestUsers after friend codes have been loaded."
|
||||
|
||||
def handle(self, *args, **options):
|
||||
users_updated = 0
|
||||
for user in CustomUser.objects.all():
|
||||
# Automatically select the earliest friend code added for the user:
|
||||
default_code = FriendCode.objects.filter(user=user).order_by('created_at').first()
|
||||
if default_code:
|
||||
user.default_friend_code = default_code
|
||||
user.save(update_fields=["default_friend_code"])
|
||||
self.stdout.write(f"Set default friend code for user {user.username} to {default_code.friend_code}.")
|
||||
users_updated += 1
|
||||
else:
|
||||
self.stdout.write(f"No friend code found for user {user.username}.")
|
||||
self.stdout.write(self.style.SUCCESS(f"Seeded default friend codes for {users_updated} user(s)."))
|
||||
Loading…
Add table
Add a link
Reference in a new issue