summaryrefslogtreecommitdiff
path: root/yaksh/management
diff options
context:
space:
mode:
authorJayram2020-08-09 22:16:56 +0530
committerJayram2020-08-09 22:16:56 +0530
commit55d2800b61df661e7155f8b3cbd30ed047259f43 (patch)
tree8979c515508a87f7a71a58a1dffb467c1b053808 /yaksh/management
parent3999e744fe1a3a4c4fcb7d2763b36def9d7bb213 (diff)
downloadonline_test-55d2800b61df661e7155f8b3cbd30ed047259f43.tar.gz
online_test-55d2800b61df661e7155f8b3cbd30ed047259f43.tar.bz2
online_test-55d2800b61df661e7155f8b3cbd30ed047259f43.zip
[FIX] #546 - create_moderator command if User has no Profile
Diffstat (limited to 'yaksh/management')
-rw-r--r--yaksh/management/commands/create_moderator.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/yaksh/management/commands/create_moderator.py b/yaksh/management/commands/create_moderator.py
index 3ec012e..c0f160a 100644
--- a/yaksh/management/commands/create_moderator.py
+++ b/yaksh/management/commands/create_moderator.py
@@ -10,6 +10,7 @@ from django.contrib.auth.models import User, Group, Permission
# local imports
from yaksh.models import create_group
+from yaksh.views import _create_or_update_profile
class Command(BaseCommand):
@@ -43,6 +44,10 @@ class Command(BaseCommand):
)
)
else:
+ if not hasattr(user, 'profile'):
+ _create_or_update_profile(user,
+ {'is_email_verified': True}
+ )
user.profile.is_moderator = True
user.profile.save()
self.stdout.write(