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
django.contrib.auth.models.Group
-
-
class
tom_common.views.GroupDeleteView(**kwargs)¶ View that handles deletion of a user
Group. Requires authorization.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model¶ alias of
django.contrib.auth.models.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
django.contrib.auth.models.Group
-
get_initial(*args, **kwargs)¶ Adds the
Userobjects that are associated with thisGroupto the initial data.- Returns
list of users
- Return type
QuerySet
-
-
class
tom_common.views.UserListView(**kwargs)¶ View that handles display of the list of
Userobject. Requires authentication.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model¶ alias of
django.contrib.auth.models.User
-
get_context_data(*args, **kwargs)¶ Adds the list of
Group``s, excluding the public ``Group, to the context.- Returns
context dictionary
- Return type
dict
-
-
class
tom_common.views.UserDeleteView(**kwargs)¶ View that handles deletion of a
User. Requires authorization.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model¶ alias of
django.contrib.auth.models.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
Usercreation. Requires authorization.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_valid(form)¶ Called after form is validated. Creates the
Userand adds them to the publicGroup.- Parameters
form (django.forms.Form) – User creation form
-
-
class
tom_common.views.UserUpdateView(**kwargs)¶ View that handles
Usermodification. 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
django.contrib.auth.models.User
-
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
Userand the session hash to maintain login session.- Parameters
form (django.forms.Form) – User creation form
-
-
class
tom_common.views.CommentDeleteView(**kwargs)¶ View that handles deletion of a
Comment. Requires authentication to call, and authorization to delete.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model¶ alias of
django_comments.models.Comment
-
delete(request, *args, **kwargs)¶ Method that handles the DELETE request for a
Comment. Validates that the user either authored the comment or is a superuser, then deletes theComment.
-