This repository has been archived by the owner on May 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
from django.contrib.auth.models import User | ||
from django.db import models | ||
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager | ||
|
||
|
||
class CustomUser(User): | ||
class CustomUser(AbstractBaseUser): | ||
email = models.EmailField(max_length=255, unique=True) | ||
|
||
objects = BaseUserManager() | ||
|
||
USERNAME_FIELD = 'email' | ||
|
||
class Meta: | ||
app_label = 'tests' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,6 @@ | |
from rest_framework_jwt import utils | ||
from rest_framework_jwt.settings import api_settings, DEFAULTS | ||
|
||
from .models import CustomUser | ||
|
||
|
||
NO_CUSTOM_USER_MODEL = 'Custom User Model only supported after Django 1.5' | ||
|
||
|
@@ -123,6 +121,8 @@ class CustomUserObtainJSONWebTokenTests(TestCase): | |
urls = 'tests.test_views' | ||
|
||
def setUp(self): | ||
from .models import CustomUser | ||
|
||
self.email = '[email protected]' | ||
self.password = 'password' | ||
user = CustomUser.objects.create(email=self.email) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters