Models

class django_tinyuser.models.TinyUser(*args, **kwargs)[source]

Bases: AbstractBaseUser, PermissionsMixin

Custom user model for the TinyUser application.

Parameters:
  • AbstractBaseUser (django.contrib.auth.models.AbstractBaseUser) – Base class for custom user models.

  • PermissionsMixin (django.contrib.auth.models.PermissionsMixin) – Mixin class to add permission fields and methods.

Returns:

The created user instance.

Return type:

TinyUser

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

REQUIRED_FIELDS = ['username']
USERNAME_FIELD = 'email'
auth_token

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

property display_name

Returns the display name of the user.

Returns:

The display name of the user.

Return type:

str

email

The email field is used as the unique identifier for authentication instead of the default username field.

It is required and must be unique.

emailaddress_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_reverse_many_to_one_manager() defined below.

friend_groups

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

friendships_initiated

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_reverse_many_to_one_manager() defined below.

friendships_received

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_reverse_many_to_one_manager() defined below.

get_next_by_joined_at(*, field=<django.db.models.fields.DateTimeField: joined_at>, is_next=True, **kwargs)
get_previous_by_joined_at(*, field=<django.db.models.fields.DateTimeField: joined_at>, is_next=False, **kwargs)
groups

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

invitation_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_reverse_many_to_one_manager() defined below.

is_active

The is_active field indicates whether the user’s account is active. Inactive accounts may not be able to log in.

It is a boolean field that defaults to True.

is_staff

The is_staff field indicates whether the user has staff status, which allows access to the admin site.

It is a boolean field that defaults to False.

is_superuser

The is_superuser field indicates whether the user has superuser status, which grants all permissions.

It is a boolean field that defaults to False.

is_verified

The is_verified field indicates whether the user’s email address has been verified. This can be used to restrict access to certain features until the email is verified.

It is a boolean field that defaults to False.

joined_at

The joined_at field stores the date and time when the user account was created. It is automatically set to the current date and time when the user is created.

last_login

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

logentry_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_reverse_many_to_one_manager() defined below.

objects = <django_tinyuser.managers.TinyUserManager object>
password

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

profile

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

socialaccount_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_reverse_many_to_one_manager() defined below.

user_friend_groups

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_reverse_many_to_one_manager() defined below.

user_permissions

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

username

The username field is a unique identifier for the user, used for display purposes and as an additional identifier.

It is required and must be unique.

class django_tinyuser.models.TinyUserProfile(*args, **kwargs)[source]

Bases: Model

Model to store additional profile information for TinyUser.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

bio

The bio field allows users to provide a short biography or description about themselves. It is optional and can be left blank.

first_name

The first_name field stores the user’s first name. It is optional and can be left blank.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

last_name

The last_name field stores the user’s last name. It is optional and can be left blank.

objects = <django.db.models.manager.Manager object>
user

The user field is a one-to-one relationship with the TinyUser model, linking each profile to a specific user. It is required and will be deleted if the associated user is deleted.

user_id
class django_tinyuser.models.UserFriendGroup(*args, **kwargs)[source]

Bases: Model

Model to represent groups of friends for TinyUser instances.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

add_member(user)[source]

Add a user to the friend group.

Parameters:

user (TinyUser) – The user to be added to the friend group.

description

The description field is a text field that allows users to provide a description of the friend group. It is optional and can be left blank.

description_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_description_type_display(*, field=<django.db.models.fields.TextField: description_type>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_member(user)[source]

Check if a user is a member of the friend group.

Parameters:

user (TinyUser) – The user to check for membership in the friend group.

Returns:

True if the user is a member of the friend group, False otherwise.

Return type:

bool

members

The members field is a many-to-many relationship with the TinyUser model, allowing multiple users to be part of the same friend group.

name

The name field is a character field that stores the name of the friend group. It is required and has a maximum length of 255 characters.

objects = <django.db.models.manager.Manager object>
remove_member(user)[source]

Remove a user from the friend group.

Parameters:

user (TinyUser) – The user to be removed from the friend group.

user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id
class django_tinyuser.models.UserFriendship(*args, **kwargs)[source]

Bases: Model

Model to represent friendships between TinyUser instances.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

accept()[source]

Accept the friendship request by setting the status to ‘accepted’.

block()[source]

Block the user by setting the status to ‘blocked’.

property blocked_status

Return the current blocked status of the friendship as a FriendshipBlockedStatus enum member. :return: The current blocked status of the friendship. :rtype: FriendshipBlockedStatus

blocked_status_data

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_at

The created_at field stores the date and time when the friendship was created. It is automatically set to the current date and time when the friendship is created.

from_user

The from_user field is a foreign key to the TinyUser model, representing the user who initiated the friendship. It is required and will be deleted if the associated user is deleted.

from_user_id
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property is_accepted

Return True if the friendship is currently accepted, False otherwise.

property is_blocked

Return True if the friendship is currently blocked, False otherwise.

is_initiator

The is_initiator field indicates whether the user is the initiator of the friendship request. It is a boolean field that defaults to False.

property is_pending

Return True if the friendship is currently pending, False otherwise.

property is_recipient

Return True if the user is the recipient of the friendship, False otherwise.

property is_rejected

Return True if the friendship is currently rejected, False otherwise.

objects = <django.db.models.manager.Manager object>
reject()[source]

Reject the friendship request by setting the status to ‘rejected’.

property status

Return the current status of the friendship as a FriendshipStatus enum member. :return: The current status of the friendship. :rtype: FriendshipStatus

status_data

The status field indicates the status of the friendship, such as ‘pending’, ‘accepted’, ‘rejected’ or ‘blocked’. It is a character field with a maximum length of 20 characters, and it defaults to ‘pending’.

to_user

The to_user field is a foreign key to the TinyUser model, representing the user who is the recipient of the friendship.

It is required and will be deleted if the associated user is deleted.

to_user_id
unblock()[source]

Unblock the user by setting the status back to ‘pending’.