mirror of
https://github.com/fergalmoran/dss.git
synced 2026-01-05 16:34:07 +00:00
Altered process user to execute save on all
This commit is contained in:
@@ -2,12 +2,12 @@ from django.contrib.auth.models import User
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.management.base import NoArgsCommand, CommandError
|
||||
from spa.models import UserProfile
|
||||
|
||||
from core.utils.url import unique_slugify
|
||||
|
||||
class Command(NoArgsCommand):
|
||||
help = "Updates audio files with their durations"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
def handle(user, *args, **options):
|
||||
try:
|
||||
candidates = User.objects.all()
|
||||
for user in candidates:
|
||||
@@ -16,7 +16,13 @@ class Command(NoArgsCommand):
|
||||
except ObjectDoesNotExist, ce:
|
||||
print "Creating profile for %s" % user.get_username()
|
||||
UserProfile.objects.create(user=user)
|
||||
finally:
|
||||
user.save()
|
||||
profile = user.get_profile()
|
||||
|
||||
if profile.slug is None or profile.slug == '':
|
||||
profile.slug = unique_slugify(profile, user.get_username())
|
||||
print "Slugified: %s" % profile.slug
|
||||
profile.save()
|
||||
|
||||
user.save()
|
||||
except Exception, ex:
|
||||
raise CommandError(ex.message)
|
||||
|
||||
Reference in New Issue
Block a user