Sluggo-Issue-Tracker / Sluggo-API

Sluggo, a flexible issue tracker for teams. Backend server developed with Django and Django REST Framework
Apache License 2.0
7 stars 1 forks source link

Restructured Rest API and Custom User Implementation #4

Closed agavgavi closed 4 years ago

agavgavi commented 4 years ago

So the default auth.User built into django is good, but working with it at times can be a pain so implementing a custom user model is always recommended. This custom model uses an email field instead of username as the basic form of logging in and requires the user to fill out a first name and last name as well.

Only issue is that now we have to always make sure we use that custom user rather than auth.User in all future views/whatever.

In addition, built a profile model that will be a 1-1 relationship with this new user, and have it automatically be created when a user is created. This model will be replacing the "users" model in the py4web version.

Also built a ticket model that is basically directly based off of the py4web version. Both of these models have CRUD features implemented through the Django REST Framework and have setup viewsets that need authentication.

Finally, deleted the other rest app Sam was working on since it had some conflicting user models and it wasn't feasible to integrate with both at the same time.

tdimhcsleumas commented 4 years ago

Nitpicks: We should add migrations to the .gitignore. Don’t use Custom, just say User or Admin. Concerns: One of the benefits of using the base User is its inclusion of password security so just make sure ours is also secure.

agavgavi commented 4 years ago

Migrations have been added to gitignore. CustomUse has been renamed to User, and the nice part about Subclassing AbstractUser is that we get all of the same password security that was already there.