scram.users package¶
Subpackages¶
- scram.users.migrations package
- scram.users.tests package
- Submodules
- scram.users.tests.factories module
- scram.users.tests.test_admin module
- scram.users.tests.test_drf_urls module
- scram.users.tests.test_drf_views module
- scram.users.tests.test_forms module
- scram.users.tests.test_models module
- scram.users.tests.test_urls module
- scram.users.tests.test_views module
- Module contents
Submodules¶
scram.users.admin module¶
- class scram.users.admin.UserAdmin(model, admin_site)¶
Bases:
UserAdmin
- add_form¶
alias of
UserCreationForm
- fieldsets = ((None, {'fields': ('username', 'password')}), ('Personal info', {'fields': ('name', 'email')}), ('Permissions', {'fields': ('is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions')}), ('Important dates', {'fields': ('last_login', 'date_joined')}))¶
- form¶
alias of
UserChangeForm
- list_display = ['username', 'name', 'is_superuser']¶
- property media¶
- search_fields = ['name']¶
scram.users.apps module¶
scram.users.forms module¶
- class scram.users.forms.UserChangeForm(*args, **kwargs)¶
Bases:
UserChangeForm
- base_fields = {'date_joined': <django.forms.fields.DateTimeField object>, 'email': <django.forms.fields.EmailField object>, 'groups': <django.forms.models.ModelMultipleChoiceField object>, 'is_active': <django.forms.fields.BooleanField object>, 'is_staff': <django.forms.fields.BooleanField object>, 'is_superuser': <django.forms.fields.BooleanField object>, 'last_login': <django.forms.fields.DateTimeField object>, 'name': <django.forms.fields.CharField object>, 'password': <django.contrib.auth.forms.ReadOnlyPasswordHashField object>, 'user_permissions': <django.forms.models.ModelMultipleChoiceField object>, 'username': <django.contrib.auth.forms.UsernameField object>}¶
- declared_fields = {'password': <django.contrib.auth.forms.ReadOnlyPasswordHashField object>}¶
- property media¶
Return all media required to render the widgets on this form.
- class scram.users.forms.UserCreationForm(*args, **kwargs)¶
Bases:
UserCreationForm
- class Meta¶
Bases:
Meta
- error_messages = {'username': {'unique': 'This username has already been taken.'}}¶
- base_fields = {'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>, 'username': <django.contrib.auth.forms.UsernameField 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.
scram.users.models module¶
- class scram.users.models.User(*args, **kwargs)¶
Bases:
AbstractUser
Default user for SCRAM.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- 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 aReverseOneToOneDescriptor
instance.
- first_name = None¶
- get_absolute_url()¶
Get url for user’s detail view.
- Returns:
URL for user detail.
- Return type:
str
- 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
andTopping.pizzas
areManyToManyDescriptor
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.
- last_name = None¶
- 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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- name¶
First and last name do not cover name patterns around the globe
- 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
scram.users.urls module¶
scram.users.views module¶
- class scram.users.views.UserDetailView(**kwargs)¶
Bases:
LoginRequiredMixin
,DetailView
- slug_field = 'username'¶
- slug_url_kwarg = 'username'¶
- class scram.users.views.UserRedirectView(**kwargs)¶
Bases:
LoginRequiredMixin
,RedirectView
- get_redirect_url()¶
Return the URL redirect to. Keyword arguments from the URL pattern match generating the redirect request are provided as kwargs to this method.
- permanent = False¶
- class scram.users.views.UserUpdateView(**kwargs)¶
Bases:
LoginRequiredMixin
,SuccessMessageMixin
,UpdateView
- fields = ['name']¶
- get_object()¶
Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
- get_success_url()¶
Return the URL to redirect to after processing a valid form.
- success_message = 'Information successfully updated'¶
- scram.users.views.user_detail_view(self, request, *args, **kwargs)¶
- scram.users.views.user_redirect_view(self, request, *args, **kwargs)¶
- scram.users.views.user_update_view(self, request, *args, **kwargs)¶