Files
dss.api/spa/management/commands/add_user_uid.py
2016-09-23 00:21:02 +01:00

16 lines
431 B
Python

import uuid
from django.core.management.base import NoArgsCommand
from spa.models import UserProfile
class Command(NoArgsCommand):
def handle_noargs(self, **options):
try:
users = UserProfile.objects.exclude(uid__isnull=False)
for user in users:
user.uid = uuid.uuid4()
user.save()
except Exception as ex:
print("Debug exception: %s" % ex)