Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom user model #19

Closed
wants to merge 5 commits into from

Conversation

alysivji
Copy link
Member

@alysivji alysivji commented Jan 4, 2020

Django documentation "highly recommends" to use a custom User model. It's a bit difficult to do it mid-project so let's get this out of the way now.

You will have to delete your local database and rerun migrations to get things to work. Sorry for this inconvenience, but it's a lot better to only have to change local development databases versus the production db mid-project

I also added an apps folder where we can store Django applications; this will keep the main project folder tidy. I also added instructions on how to create new applications. Note: I got this pattern from Two Scoops.

Additional Reading

@ZaxR ZaxR added this to the MVP milestone Jan 8, 2020
email = models.EmailField(_("email address"), unique=True)
username = models.EmailField(null=True) # field is required for python social auth

is_staff = models.BooleanField(default=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of is_staff?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Django requires the User model to have a base set of fields

https://docs.djangoproject.com/en/3.0/ref/contrib/auth/#django.contrib.auth.models.User

from .managers import UserManager


class User(AbstractBaseUser, PermissionsMixin):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this PR!

We want to have Logins separate from User information - can you make that update and add the couple extra fields? See #7 for the starter data model.

@alysivji alysivji closed this Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants