Views¶
- class tom_common.views.GroupCreateView(**kwargs)¶
View that handles creation of a user
Group
. Requires authorization.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- model¶
alias of
Group
- class tom_common.views.GroupDeleteView(*args, **kwargs)¶
View that handles deletion of a user
Group
. Requires authorization.- model¶
alias of
Group
- class tom_common.views.GroupUpdateView(**kwargs)¶
View that handles modification of a user
Group
. Requires authorization.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- model¶
alias of
Group
- get_initial(*args, **kwargs)¶
Adds the
User
objects that are associated with thisGroup
to the initial data.- Returns:
list of users
- Return type:
QuerySet
- class tom_common.views.UserListView(**kwargs)¶
View that handles display of the list of
User
andGroup
objects. Requires authentication.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- class tom_common.views.UserDeleteView(*args, **kwargs)¶
View that handles deletion of a
User
. Requires authorization.- model¶
alias of
User
- class tom_common.views.UserPasswordChangeView(**kwargs)¶
View that handles modification of the password for a
User
. Requires authorization.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- form_valid(form)¶
Called after form is validated. Updates the password for the current specified user.
- Parameters:
form (django.forms.Form) – Password submission form
- class tom_common.views.UserCreateView(**kwargs)¶
View that handles
User
creation. Requires authorization.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- form_class¶
alias of
CustomUserCreationForm
- form_valid(form)¶
Called after form is validated. Creates the
User
and adds them to the publicGroup
.- Parameters:
form (django.forms.Form) – User creation form
- class tom_common.views.UserUpdateView(**kwargs)¶
View that handles
User
modification. Requires authentication to call, and authorization to update.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- model¶
alias of
User
- form_class¶
alias of
CustomUserCreationForm
- get_success_url()¶
Returns the redirect URL for a successful update. If the current user is a superuser, returns the URL for the user list. Otherwise, returns the URL for updating the current user.
- Returns:
URL for user list or update user
- Return type:
str
- get_form(form_class=None)¶
Gets the user update form and removes the password requirement. Removes the groups field if the user is not a superuser.
- Returns:
Form used by this view
- Return type:
CustomUserCreationForm
- dispatch(*args, **kwargs)¶
Directs the class-based view to the correct method for the HTTP request method. Ensures that non-superusers are not incorrectly updating the profiles of other users.
- form_valid(form)¶
Called after form is validated. Updates the
User
and the session hash to maintain login session.- Parameters:
form (django.forms.Form) – User creation form
- class tom_common.views.CommentDeleteView(*args, **kwargs)¶
View that handles deletion of a
Comment
. Requires authentication to call, and authorization to delete.- model¶
alias of
Comment
- form_valid(form)¶
Checks if the user is authorized to delete the comment and then proceeds with deletion.
- tom_common.views.robots_txt(request)¶
A function-based view that handles the robots.txt content.
The default robots.txt is defined here. It disallows everything from everyone.
If you want to change that, we check for a path to a custom robots.txt file defined in settings.py as ROBOTS_TXT_PATH. If you set ROBOTS_TXT_PATH in your settings.py, then that file will be served instead of the default.