Commit 56c04ca5b8947b83c0aab8c094da3dd60b6ba9c3

Authored by Andrew Buss
1 parent 05ddc98b92
Exists in master

Extended UserManager to fix createsuperuser

Showing 3 changed files with 8 additions and 5 deletions Side-by-side Diff

flashcards/admin.py View file @ 56c04ca
1 1 from django.contrib import admin
2 2 from flashcards.models import Flashcard, UserFlashcard, Section, FlashcardMask, \
3 3 UserFlashcardReview, LecturePeriod, User
4   -from simple_email_confirmation import EmailAddress
5 4  
6 5 admin.site.register([
7 6 User,
flashcards/models.py View file @ 56c04ca
1   -from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, AbstractUser
  1 +from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, AbstractUser, UserManager
2 2 from django.db.models import *
3 3 from simple_email_confirmation import SimpleEmailConfirmationUserMixin
4 4  
... ... @@ -6,7 +6,13 @@
6 6 AbstractUser._meta.get_field('email')._unique = True
7 7  
8 8  
9   -class User(AbstractUser, SimpleEmailConfirmationUserMixin, ):
  9 +class UserManager(UserManager):
  10 + def create_superuser(self, email, password, **extra_fields):
  11 + return self._create_user(email, email, password, True, True, **extra_fields)
  12 +
  13 +
  14 +class User(AbstractUser, SimpleEmailConfirmationUserMixin):
  15 + objects = UserManager()
10 16 USERNAME_FIELD = 'email'
11 17 REQUIRED_FIELDS = []
12 18 sections = ManyToManyField('Section')
flashy/settings.py View file @ 56c04ca
... ... @@ -22,8 +22,6 @@
22 22 'django.contrib.staticfiles',
23 23 'django_ses',
24 24 'rest_framework',
25   -
26   -
27 25 )
28 26  
29 27 REST_FRAMEWORK = {