We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Getting the most out of Django’s User Model

Formale Metadaten

Titel
Getting the most out of Django’s User Model
Serientitel
Teil
27
Anzahl der Teile
48
Autor
Mitwirkende
Lizenz
CC-Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben.
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
Django’s User model is nice, but the fields it provides out of the box are minimal. We frequently need to associate our own custom data with a user, and luckily Django provides ways for us to add to its built-in User model. This talk will help novice Django developers understand which options are best when it comes to getting the most out of the Django User model. I’ll start by talking about the built-in Django User model and what it has to offer. Then I will identify scenarios when the User model might not be enough for a project, and why someone might want something with more flexibility. Then we’ll look at the different ways to get the most out of the Django User model. There are two main methods I’ll cover: Extending the User model Creating a custom User model Extending the User model: Extending the User model is handy when you only need to add a few extra fields. There are two main ways to do this: using a proxy model, and using a OneToOneField. I will cover the pros and cons of each, and give examples for implementing each. Creating a custom User model: With this method, you can substitute Django’s default User model with your own. Though more complex, a custom User model is particularly useful when you need to uniquely identify users by email address instead of by username. I’ll go into a couple more scenarios where a custom User model would be helpful, and show examples of implementation. Lastly, I will show how each method works with the default Django admin, and how they can be managed there.