user package

Submodules

user.admin module

User admin classes.

user.apps module

User app config.

class user.apps.UserConfig(app_name, app_module)

Bases: AppConfig

User app config.

default_auto_field = 'django.db.models.BigAutoField'
name = 'user'

user.models module

User models.

class user.models.User(*args, **kwargs)

Bases: AbstractUser

User model.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

generated_images

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_forward_many_to_many_manager() defined below.

get_next_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=True, **kwargs)
get_previous_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, 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.

huggingface_token

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

id

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_forward_many_to_many_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.

user.permissions module

Custom Django Rest Framework permissions for the user app.

class user.permissions.HasOwner(*args, **kwargs)

Bases: Protocol

Protocol for objects with an owner attribute.

owner: Model
class user.permissions.IsOwnerOrReadOnly

Bases: BasePermission

Custom permission to only allow owners of an object to edit it.

has_object_permission(request: HttpRequest, _: Any, obj: HasOwner) bool

Check if the user is the owner of the object.

Parameters:
  • request – The request object.

  • _ – The view object.

  • obj – The object to check.

Returns:

True if the user is the owner of the object, False otherwise.

user.serializers module

Django Rest Framework Serializers for models in the user app.

class user.serializers.UserSerializer(*args, **kwargs)

Bases: DynamicModelSerializer

Serializer for User model.

class Meta

Bases: object

Meta class for UserSerializer.

fields = ['id', 'username', 'generated_images']
model

alias of User

user.tests module

user.views module

User views.

class user.views.UserViewSet(**kwargs)

Bases: ReadOnlyModelViewSet

This viewset automatically provides list and retrieve actions.

basename = None
description = None
detail = None
name = None
queryset
serializer_class

alias of UserSerializer

suffix = None