2.2 KiB
2.2 KiB
Entities for rear
User
Should be compatible to Django-user to be able to easily share the db
class models.User
User objects have the following fields:
username¶
Required. 150 characters or fewer. Usernames may contain alphanumeric, _, @, +, . and - characters.
The max_length should be sufficient for many use cases. If you need a longer length, please use a custom user model. If you use MySQL with the utf8mb4 encoding (recommended for proper Unicode support), specify at most max_length=191 because MySQL can only create unique indexes with 191 characters in that case by default.
first_name¶
Optional (blank=True). 150 characters or fewer.
last_name¶
Optional (blank=True). 150 characters or fewer.
email¶
Optional (blank=True). Email address.
password¶
Required. A hash of, and metadata about, the password. (Django doesn’t store the raw password.) Raw passwords can be arbitrarily long and can contain any character. See the password documentation.
groups¶
Many-to-many relationship to Group
user_permissions¶
Many-to-many relationship to Permission
is_staff¶
Boolean. Allows this user to access the admin site.
is_active¶
Boolean. Marks this user account as active. We recommend that you set this flag to False instead of deleting accounts. That way, if your applications have any foreign keys to users, the foreign keys won’t break.
This doesn’t necessarily control whether or not the user can log in. Authentication backends aren’t required to check for the is_active flag but the default backend (ModelBackend) and the RemoteUserBackend do. You can use AllowAllUsersModelBackend or AllowAllUsersRemoteUserBackend if you want to allow inactive users to login. In this case, you’ll also want to customize the AuthenticationForm used by the LoginView as it rejects inactive users. Be aware that the permission-checking methods such as has_perm() and the authentication in the Django admin all return False for inactive users.
is_superuser¶
Boolean. Treats this user as having all permissions without assigning any permission to it in particular.
last_login¶
A datetime of the user’s last login.
date_joined¶
The date/time when the account was created.