Book Image

Mastering Django: Core

By : Nigel George
Book Image

Mastering Django: Core

By: Nigel George

Overview of this book

Mastering Django: Core is a completely revised and updated version of the original Django Book, written by Adrian Holovaty and Jacob Kaplan-Moss - the creators of Django. The main goal of this book is to make you a Django expert. By reading this book, you’ll learn the skills needed to develop powerful websites quickly, with code that is clean and easy to maintain. This book is also a programmer’s manual that provides complete coverage of the current Long Term Support (LTS) version of Django. For developers creating applications for commercial and business critical deployments, Mastering Django: Core provides a complete, up-to-date resource for Django 1.8LTS with a stable code-base, security fixes and support out to 2018.
Table of Contents (33 chapters)
Mastering Django: Core
Credits
About the Author
www.PacktPub.com
Preface
Free Chapter
1
Introduction to Django and Getting Started

User objects


User objects are the core of the authentication system. They typically represent the people interacting with your site and are used to enable things like restricting access, registering user profiles, associating content with creators and so on. Only one class of user exists in Django's authentication framework, that is, superusers or admin staff users are just user objects with special attributes set, not different classes of user objects. The primary attributes of the default user are:

  • username

  • password

  • email

  • first_name

  • last_name

Creating superusers

Create superusers using the createsuperuser command:

python manage.py createsuperuser -username=joe [email protected] 

You will be prompted for a password. After you enter one, the user will be created immediately. If you leave off the -username or the -email options, it will prompt you for those values.

Creating users

The simplest, and least error prone way to create and manage users is through the Django admin. Django...