users package

Submodules

users.admin module

users.apps module

class users.apps.UsersConfig(app_name, app_module)[source]

Bases: AppConfig

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

users.forms module

class users.forms.CustomUserCreationForm(*args, **kwargs)[source]

Bases: UserCreationForm

Form for creating user profile.

class Meta[source]

Bases: object

fields = ['username', 'email', 'bio', 'profile_pic', 'password1', 'password2']
model

alias of CustomUser

base_fields = {'bio': <django.forms.fields.CharField object>, 'email': <django.forms.fields.EmailField object>, 'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>, 'profile_pic': <django.forms.fields.ImageField object>, 'username': <django.forms.fields.CharField object>}
declared_fields = {'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>}
property media

Return all media required to render the widgets on this form.

class users.forms.EditProfileForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

Forms for updating user profile.

class Meta[source]

Bases: object

fields = ['email', 'bio', 'profile_pic']
model

alias of CustomUser

base_fields = {'bio': <django.forms.fields.CharField object>, 'email': <django.forms.fields.EmailField object>, 'profile_pic': <django.forms.fields.ImageField object>}
declared_fields = {}
property media

Return all media required to render the widgets on this form.

users.models module

class users.models.CustomUser(*args, **kwargs)[source]

Bases: AbstractUser

Model class for holding user profie data.

Attributes:

bio: Add a short description about user. profile_pic: users uploaded profile photo.

Methods:

__str__: Show the data in format.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

bio

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

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

date_joined

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

email

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

first_name

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

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.

id

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

is_active

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

is_staff

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

is_superuser

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

last_login

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

last_name

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

liked_posts

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.

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.

password

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

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

profile_pic

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

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

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

users.tests module

users.urls module

users.views module

users.views.edit_profile(request)[source]

Allow user to update his profile data. Edit bio, image etc. Using the declared field in form the item is shown.

Args:

request (HttpRequest): The incoming HTTP request.

Returns:

HttpResponse: Rendered template for the profile edit form page.

users.views.profile(request, username)[source]

Display profile of a specific user.

Args:

request (HttpRequest): The incoming HTTP request. username (str): The username of the profile to display.

Returns:

HttpResponse: Rendered template for the user profile.

users.views.register(request)[source]

This function is used to hold the user account register functionality.

Args:

request (HttpRequest): The incoming http request.

Returns:

HttpResponse: Renderd to register.html page with the required form data.

Module contents