shuup.admin.modules.users.views package

Submodules

shuup.admin.modules.users.views.detail module

shuup.admin.modules.users.views.detail.get_front_url()[source]
shuup.admin.modules.users.views.detail.get_admin_url()[source]
class shuup.admin.modules.users.views.detail.BaseUserForm(*args, **kwargs)[source]

Bases: ModelForm

class Meta[source]

Bases: object

model

alias of User

fields = ['username', 'email', 'first_name', 'last_name', 'is_staff', 'is_superuser']
clean_password()[source]
__init__(*args, **kwargs)[source]
clean()[source]

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

save(commit=True)[source]

Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.

base_fields = {'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'is_staff': <django.forms.fields.BooleanField object>, 'is_superuser': <django.forms.fields.BooleanField object>, 'last_name': <django.forms.fields.CharField object>, 'password': <django.forms.fields.CharField object>, 'permission_groups': <django.forms.fields.CharField object>, 'permission_info': <django.forms.fields.CharField object>, 'username': <django.forms.fields.CharField object>}
declared_fields = {'password': <django.forms.fields.CharField object>, 'permission_groups': <django.forms.fields.CharField object>, 'permission_info': <django.forms.fields.CharField object>}
property media

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

class shuup.admin.modules.users.views.detail.UserDetailToolbar(view)[source]

Bases: Toolbar

__init__(view)[source]
class shuup.admin.modules.users.views.detail.UserDetailView(**kwargs)[source]

Bases: CreateOrUpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

template_name = 'shuup/admin/users/detail.jinja'
context_object_name = 'user'
property fields
get_form_class()[source]

Return the form class to use in this view.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_initial()[source]

Return the initial data to use for forms on this view.

get_toolbar()[source]
save_form(form)[source]
post(request, *args, **kwargs)[source]

Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.

dispatch(request, *args, **kwargs)[source]
class shuup.admin.modules.users.views.detail.LoginAsUserView(**kwargs)[source]

Bases: DetailView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of User

can_impersonate_staff = False
permission_str = 'user.login-as'
get_url()[source]
post(request, *args, **kwargs)[source]
class shuup.admin.modules.users.views.detail.LoginAsStaffUserView(**kwargs)[source]

Bases: LoginAsUserView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of User

can_impersonate_staff = True
permission_str = 'user.login-as-staff'
get_url()[source]

shuup.admin.modules.users.views.list module

class shuup.admin.modules.users.views.list.UserListView[source]

Bases: PicotableListView

model = 'auth.User'
default_columns = [<Column: Username> username, <Column: Email> email, <Column: First Name> first_name, <Column: Last Name> last_name, <Column: Active> is_active, <Column: Groups> groups, <Column: Access to Admin Panel> is_staff]
toolbar_buttons_provider_key: str | None = 'user_list_toolbar_provider'
mass_actions_provider_key: str | None = 'user_list_mass_actions_provider'
get_groups()[source]
get_groups_display(instance)[source]
get_model()[source]
get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

get_context_data(**kwargs)[source]

Get the context for this view.

get_object_abstract(instance, item)[source]

Get the object abstract lines (used for mobile layouts) for this object.

Supported keys in abstract line dicts are:

  • text (required)

  • title

  • class (CSS class name – header for instance)

  • raw (boolean; whether or not the text is raw HTML)

Parameters:
  • instance – The instance.

  • item – The item dict so far. Useful for reusing precalculated values.

Returns:

Iterable of dicts to pass through to the picotable javascript.

Return type:

Iterable[dict]

shuup.admin.modules.users.views.password module

class shuup.admin.modules.users.views.password.PasswordChangeForm(changing_user, target_user, *args, **kwargs)[source]

Bases: Form

error_messages = {'password_incorrect': 'Your old password was entered incorrectly. Please enter it again.', 'password_mismatch': "The two password fields didn't match."}
__init__(changing_user, target_user, *args, **kwargs)[source]
clean_password2()[source]
clean_old_password()[source]

Validates that the old_password field is correct.

save(commit=True)[source]
base_fields = {'old_password': <django.forms.fields.CharField object>, 'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>}
declared_fields = {'old_password': <django.forms.fields.CharField 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.

class shuup.admin.modules.users.views.password.UserChangePasswordView(**kwargs)[source]

Bases: UpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

form_class

alias of PasswordChangeForm

template_name = 'shuup/admin/users/change_password.jinja'
model = 'auth.User'
title = 'Change User Password'
get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_toolbar()[source]
get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

form_valid(form)[source]

If the form is valid, save the associated model.

get_success_url()[source]

Return the URL to redirect to after processing a valid form.

class shuup.admin.modules.users.views.password.UserResetPasswordView(**kwargs)[source]

Bases: DetailView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model = 'auth.User'
template_name = 'shuup/admin/users/reset_password.jinja'
title = 'Reset User Password'
get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

process_user(user)[source]
post(request, *args, **kwargs)[source]
get_success_url()[source]

shuup.admin.modules.users.views.permissions module

class shuup.admin.modules.users.views.permissions.PermissionChangeFormBase(changing_user, *args, **kwargs)[source]

Bases: ModelForm

__init__(changing_user, *args, **kwargs)[source]
clean_old_password()[source]

Validates that the old_password field is correct.

clean_members()[source]
clean_permission_groups()[source]
clean()[source]

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

save()[source]

Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.

base_fields = {'old_password': <django.forms.fields.CharField object>}
declared_fields = {'old_password': <django.forms.fields.CharField object>}
property media

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

class shuup.admin.modules.users.views.permissions.UserChangePermissionsView(**kwargs)[source]

Bases: UpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

template_name = 'shuup/admin/users/change_permissions.jinja'
model = 'auth.User'
title = 'Change User Permissions'
get_form_class()[source]

Return the form class to use in this view.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_toolbar()[source]
get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

form_valid(form)[source]

If the form is valid, save the associated model.

get_success_url()[source]

Return the URL to redirect to after processing a valid form.

Module contents

class shuup.admin.modules.users.views.UserListView[source]

Bases: PicotableListView

default_columns = [<Column: Username> username, <Column: Email> email, <Column: First Name> first_name, <Column: Last Name> last_name, <Column: Active> is_active, <Column: Groups> groups, <Column: Access to Admin Panel> is_staff]
get_context_data(**kwargs)[source]

Get the context for this view.

get_groups()[source]
get_groups_display(instance)[source]
get_model()[source]
get_object_abstract(instance, item)[source]

Get the object abstract lines (used for mobile layouts) for this object.

Supported keys in abstract line dicts are:

  • text (required)

  • title

  • class (CSS class name – header for instance)

  • raw (boolean; whether or not the text is raw HTML)

Parameters:
  • instance – The instance.

  • item – The item dict so far. Useful for reusing precalculated values.

Returns:

Iterable of dicts to pass through to the picotable javascript.

Return type:

Iterable[dict]

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

mass_actions_provider_key: str | None = 'user_list_mass_actions_provider'
model = 'auth.User'
toolbar_buttons_provider_key: str | None = 'user_list_toolbar_provider'
class shuup.admin.modules.users.views.UserDetailView(**kwargs)[source]

Bases: CreateOrUpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

context_object_name = 'user'
dispatch(request, *args, **kwargs)[source]
property fields
get_form_class()[source]

Return the form class to use in this view.

get_initial()[source]

Return the initial data to use for forms on this view.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_toolbar()[source]
post(request, *args, **kwargs)[source]

Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.

save_form(form)[source]
template_name = 'shuup/admin/users/detail.jinja'
class shuup.admin.modules.users.views.UserChangePasswordView(**kwargs)[source]

Bases: UpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

form_class

alias of PasswordChangeForm

form_valid(form)[source]

If the form is valid, save the associated model.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_success_url()[source]

Return the URL to redirect to after processing a valid form.

get_toolbar()[source]
model = 'auth.User'
template_name = 'shuup/admin/users/change_password.jinja'
title = 'Change User Password'
class shuup.admin.modules.users.views.UserResetPasswordView(**kwargs)[source]

Bases: DetailView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_success_url()[source]
model = 'auth.User'
post(request, *args, **kwargs)[source]
process_user(user)[source]
template_name = 'shuup/admin/users/reset_password.jinja'
title = 'Reset User Password'
class shuup.admin.modules.users.views.UserChangePermissionsView(**kwargs)[source]

Bases: UpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

form_valid(form)[source]

If the form is valid, save the associated model.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_class()[source]

Return the form class to use in this view.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_success_url()[source]

Return the URL to redirect to after processing a valid form.

get_toolbar()[source]
model = 'auth.User'
template_name = 'shuup/admin/users/change_permissions.jinja'
title = 'Change User Permissions'
class shuup.admin.modules.users.views.LoginAsUserView(**kwargs)[source]

Bases: DetailView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

can_impersonate_staff = False
get_url()[source]
model

alias of User

permission_str = 'user.login-as'
post(request, *args, **kwargs)[source]
class shuup.admin.modules.users.views.LoginAsStaffUserView(**kwargs)[source]

Bases: LoginAsUserView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

can_impersonate_staff = True
get_url()[source]
model

alias of User

permission_str = 'user.login-as-staff'