Users

Starting a new project, it’s highly recommended to set up a custom user model, even if the default User model is sufficient.

This model behaves identically to the default user model, but it can be customized in the future if the need arises.

Models related to users and accounts.

Starting a new project, it’s highly recommended to set up a custom user model, even if the default User model is sufficient.

This model behaves identically to the default user model, but it can be customized in the future if the need arises.

Additional fields can be added to the model in other apps by creating a new model with a OneToOneField to the User model.

class democrasite.users.models.User(*args, **kwargs)

Default user for Democrasite.

Parameters:
  • id (BigAutoField) – Primary key: ID

  • password (CharField) – Password

  • last_login (DateTimeField) – Last login

  • is_superuser (BooleanField) – Superuser status. Designates that this user has all permissions without explicitly assigning them.

  • username (CharField) – Username. Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.

  • email (EmailField) – Email address

  • is_staff (BooleanField) – Staff status. Designates whether the user can log into this admin site.

  • is_active (BooleanField) – Active. Designates whether this user should be treated as active. Unselect this instead of deleting accounts.

  • date_joined (DateTimeField) – Date joined

  • name (CharField) – Name of User

Relationship fields:

Parameters:
  • groups (ManyToManyField to Group) – Groups. The groups this user belongs to. A user will get all permissions granted to each of their groups. (related name: user_set)

  • user_permissions (ManyToManyField to Permission) – User permissions. Specific permissions for this user. (related name: user_set)

Reverse relationships:

Parameters:
  • emailaddress (Reverse ForeignKey from EmailAddress) – All email addresses of this user (related name of user)

  • socialaccount (Reverse ForeignKey from SocialAccount) – All social accounts of this user (related name of user)

  • auth_token (Reverse OneToOneField from Token) – The auth token of this user (related name of user)

  • outstandingtoken (Reverse ForeignKey from OutstandingToken) – All Outstanding Tokens of this user (related name of user)

  • vote (Reverse ForeignKey from Vote) – All votes of this user (related name of user)

  • bill (Reverse ForeignKey from Bill) – All bills of this user (related name of author)

  • votes (Reverse ManyToManyField from Bill) – All votes of this user (related name of votes)

  • person (Reverse OneToOneField from Person) – The person of this user (related name of user)

  • logentry (Reverse ForeignKey from LogEntry) – All log entries of this user (related name of user)

exception DoesNotExist
exception MultipleObjectsReturned
get_absolute_url()

Get url for user’s detail view.

Returns:

URL for user detail.

Return type:

str