-
Notifications
You must be signed in to change notification settings - Fork 759
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved user creation handling, closes gh-3
- Loading branch information
Showing
8 changed files
with
151 additions
and
138 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
# Define a custom User class to work with django-social-auth | ||
# | ||
# from django.db import models | ||
# | ||
# class CustomUser(models.Model): | ||
# username = models.CharField(max_length=128) | ||
# email = models.EmailField() | ||
# password = models.CharField(max_length=128) | ||
# last_login = models.DateTimeField(blank=True, null=True) | ||
# first_name = models.CharField(max_length=128, blank=True) | ||
# last_name = models.CharField(max_length=128, blank=True) | ||
# is_active = models.BooleanField(default=True) | ||
# | ||
# def is_authenticated(self): | ||
# return True | ||
from django.db import models | ||
|
||
|
||
class CustomUserManager(models.Manager): | ||
def create_user(self, username, email): | ||
return self.model._default_manager.create(username=username) | ||
|
||
|
||
class CustomUser(models.Model): | ||
username = models.CharField(max_length=128) | ||
last_login = models.DateTimeField(blank=True, null=True) | ||
|
||
objects = CustomUserManager() | ||
|
||
def is_authenticated(self): | ||
return True |
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
Oops, something went wrong.