users package

Subpackages

Submodules

users.admin module

class users.admin.CustomUserAdmin(model, admin_site)

Bases: ModelAdmin

add_form

alias of RegistrationForm

fieldsets = (('Individuelle Daten', {'fields': ('custom', 'phone', 'address')}), (None, {'fields': ('username', 'password')}), ('Personal info', {'fields': ('first_name', 'last_name', 'email')}), ('Permissions', {'fields': ('is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions')}), ('Important dates', {'fields': ('last_login', 'date_joined')}))
property media

users.apps module

class users.apps.UsersConfig(app_name, app_module)

Bases: AppConfig

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

users.forms module

class users.forms.RegistrationForm(*args, **kwargs)

Bases: UserCreationForm

class Meta

Bases: object

clean(*args, **kwargs)
fields = ['email', 'password']
model

alias of CustomUser

base_fields = {'email': <django.forms.fields.EmailField object>, 'password': <django.forms.fields.CharField object>, 'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>}
declared_fields = {'email': <django.forms.fields.EmailField object>, '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.

users.models module

class users.models.CustomUser(id, password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined, custom, phone, address)

Bases: AbstractUser

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

address

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

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.

custom

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

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.

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.

phone

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

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.serializers module

class users.serializers.CustomUserSerializer(*args, **kwargs)

Bases: ModelSerializer

class Meta

Bases: object

extra_kwargs = {'password': {'write_only': True}}
fields = ('id', 'email', 'password', 'is_active', 'is_superuser', 'phone', 'custom')
model

alias of CustomUser

create(validated_data)

We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:

return ExampleModel.objects.create(**validated_data)

If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:

example_relationship = validated_data.pop(‘example_relationship’) instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance

The default implementation also does not handle nested relationships. If you want to support writable nested relationships you’ll need to write an explicit .create() method.

update(instance, validated_data)
class users.serializers.ResetEmailSerializer(*args, **kwargs)

Bases: Serializer

users.tests module

class users.tests.CsrfTokenTest(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_get_csrf_token()
class users.tests.CustomUserViewTests(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_delete_user()
test_get_users()
test_update_user_password()
class users.tests.ResendActivationEmailViewTests(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_resend_activation_email_no_email_provided()
test_resend_activation_email_user_active()
test_resend_activation_email_user_not_active(mock_send_activation_email)
test_resend_activation_email_user_not_found()
class users.tests.ResetPasswordTest(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_reset_password(mock_send)
test_reset_password_user_not_found(mock_send)
class users.tests.SendActivationEmailTest(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_send_activation_email(mock_send)
class users.tests.UserAccountTests(methodName='runTest')

Bases: TestCase

Test for user account operations including registration, login, and logout.

setUp()

Hook method for setting up the test fixture before exercising it.

test_login_user()
test_logout_user()
test_register_user(mock_send)
class users.tests.UserSendResetPasswordTest(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_send_reset_email(mock_reset_password)

users.tokens module

class users.tokens.AccountActivationTokenGenerator

Bases: PasswordResetTokenGenerator

users.views module

class users.views.CustomUserView(**kwargs)

Bases: APIView

delete(request, uidb64, format=None)
get(request, format=None)
permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
put(request, uidb64, format=None)
class users.views.LoginView(**kwargs)

Bases: ObtainAuthToken

post(request, *args, **kwargs)
class users.views.LogoutView(**kwargs)

Bases: APIView

permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
post(request, *args, **kwargs)
class users.views.RegisterUserView(**kwargs)

Bases: CreateAPIView

permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
post(request, *args, **kwargs)
serializer_class

alias of CustomUserSerializer

class users.views.ResendActivationEmailView(**kwargs)

Bases: APIView

permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
post(request, *args, **kwargs)
class users.views.ResetPasswordView(**kwargs)

Bases: APIView

permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
post(request, *args, **kwargs)
class users.views.SendResetEmailView(**kwargs)

Bases: CreateAPIView

permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
post(request, *args, **kwargs)
serializer_class

alias of ResetEmailSerializer

users.views.activate_user(request, uidb64, token)
users.views.get_csrf_token(request)
users.views.reset_password(email, request)
users.views.send_activation_email(user, request)

Module contents