users package¶
The app that handles users.
-
users.
default_app_config
= 'users.apps.UsersConfig'¶ The config class of the app.
Submodules¶
users.adapters module¶
Custom adapters for django-allauth.
-
class
users.adapters.
AccountAdapter
(request=None)[source]¶ Bases:
allauth.account.adapter.DefaultAccountAdapter
Adapter for user accounts.
users.admin module¶
Admin models for the users app.
-
class
users.admin.
UserTypeFilter
(request, params, model, model_admin)[source]¶ Bases:
django.contrib.admin.filters.SimpleListFilter
Admin interface filter for user types.
-
class
users.admin.
User
(*args, **kwargs)[source]¶ Bases:
django.contrib.auth.models.User
django.contrib.auth.models.User
proxy model.-
exception
DoesNotExist
¶ Bases:
django.contrib.auth.models.User.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.contrib.auth.models.User.MultipleObjectsReturned
-
exception
-
class
users.admin.
UserAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
Admin model for
User
.-
exclude
= ('password', 'groups')¶
-
list_display
= ('username', '_email', 'full_name', 'date_joined', 'is_active')¶
-
list_editable
= ('is_active',)¶
-
search_fields
= ('username', 'email', 'first_name', 'last_name')¶
-
list_filter
= (<class 'MangAdventure.filters.boolean_filter.<locals>._BooleanFilter'>, <class 'users.admin.UserTypeFilter'>)¶
-
ordering
= ('username',)¶
-
-
class
users.admin.
OAuthApp
(*args, **kwargs)[source]¶ Bases:
allauth.socialaccount.models.SocialApp
allauth.socialaccount.models.SocialApp
proxy model.-
__str__
()[source]¶ Return a string representing the object.
- Return type
- Returns
The name and provider of the app.
-
exception
DoesNotExist
¶ Bases:
allauth.socialaccount.models.SocialApp.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
allauth.socialaccount.models.SocialApp.MultipleObjectsReturned
-
-
class
users.admin.
OAuthAppForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
Admin form for
OAuthApp
.-
base_fields
= {'client_id': <django.forms.fields.CharField object>, 'key': <django.forms.fields.CharField object>, 'name': <django.forms.fields.CharField object>, 'provider': <django.forms.fields.TypedChoiceField object>, 'secret': <django.forms.fields.CharField object>, 'sites': <django.forms.models.ModelMultipleChoiceField object>}¶
-
declared_fields
= {}¶
-
users.apps module¶
App configuration.
users.feeds module¶
-
class
users.feeds.
BookmarksRSS
[source]¶ Bases:
django.contrib.syndication.views.Feed
RSS feed for a user’s bookmarks.
-
ttl
= 600¶
-
link
= '/user/'¶
-
title
= 'Bookmarks - MangAdventure'¶
-
description
= 'Updates when a bookmarked series has a new release'¶
-
item_guid_is_permalink
= True¶
-
__call__
(request, *args, **kwargs)[source]¶ Get the HTTP response of the feed.
- Parameters
request (
HttpRequest
) – The original request.- Return type
HttpResponse
- Returns
-
-
class
users.feeds.
BookmarksAtom
[source]¶ Bases:
users.feeds.BookmarksRSS
Atom feed for a user’s bookmarks.
-
feed_type
¶ alias of
django.utils.feedgenerator.Atom1Feed
-
subtitle
= 'Updates when a bookmarked series has a new release'¶
-
users.forms module¶
Form models for the users app.
-
class
users.forms.
UserProfileForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
Form used for editing a :class:
UserProfile
model.-
clean_username
()[source]¶ Validate the chosen username.
- Return type
- Returns
The username if valid.
- Raises
ValidationError – If the username is taken.
-
clean_new_password2
()[source]¶ Validate the chosen password.
- Return type
- Returns
The new password if valid.
- Raises
ValidationError – If the passwords don’t match.
-
clean_curr_password
()[source]¶ Validate the current password.
- Return type
- Returns
The current password if valid.
- Raises
ValidationError – If the password is wrong.
-
save
(commit=True)[source]¶ Save the changes to the
UserProfile
.- Parameters
commit (
bool
) – Controls whether the changes should be committed to the database.- Return type
- Returns
The updated
UserProfile
object.
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
users.models.UserProfile
-
fields
= ('email', 'new_password1', 'new_password2', 'username', 'first_name', 'last_name', 'bio', 'avatar', 'curr_password')¶
-
-
base_fields
= {'avatar': <django.forms.fields.ImageField object>, 'bio': <django.forms.fields.CharField object>, 'curr_password': <django.forms.fields.CharField object>, 'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'new_password1': <django.forms.fields.CharField object>, 'new_password2': <django.forms.fields.CharField object>, 'username': <django.forms.fields.CharField object>}¶
-
declared_fields
= {'avatar': <django.forms.fields.ImageField object>, 'bio': <django.forms.fields.CharField object>, 'curr_password': <django.forms.fields.CharField object>, 'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'new_password1': <django.forms.fields.CharField object>, 'new_password2': <django.forms.fields.CharField object>, 'username': <django.forms.fields.CharField object>}¶
-
users.models module¶
Database models for the users app.
-
class
users.models.
Bookmark
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model representing a bookmark.
-
series
¶ ForeignKey
– The series this bookmark belongs to.
-
user
¶ ForeignKey
– The user this bookmark belongs to.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
objects
= <django.db.models.manager.Manager object>¶
-
-
class
users.models.
UserProfile
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model representing a user’s profile.
TODO
Add links and let users hide their e-mail.
-
user
¶ OneToOneField
– The user this profile belongs to.
-
avatar
¶ ImageField
– The avatar of the user.
-
get_directory
()[source]¶ Get the storage directory of the object.
- Return type
- Returns
A path relative to
MEDIA_ROOT
.
-
__str__
()[source]¶ Return a string representing the object.
- Return type
- Returns
The user as a string.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
objects
= <django.db.models.manager.Manager object>¶
-
users.receivers module¶
Signal receivers for the users app.
-
users.receivers.
update_user_email
(sender, request, email_address, **kwargs)[source]¶ Receive a signal when an email address is updated and confirmed.
When the signal is received, the new
email_address
is made primary and the old email addresses are deleted.- Parameters
sender (
Type
[EmailAddress
]) – The model class that sent the signal.request (
HttpRequest
) – The original request.email_address (
EmailAddress
) – The new email address.
users.urls module¶
The URLconf of the users app.
-
users.urls.
urlpatterns
= [<URLPattern '' [name='user_profile']>, <URLPattern 'edit/' [name='user_edit']>, <URLPattern 'logout/' [name='account_logout']>, <URLPattern 'bookmarks/' [name='user_bookmarks']>, <URLPattern 'bookmarks.atom' [name='user_bookmarks.atom']>, <URLPattern 'bookmarks.rss' [name='user_bookmarks.rss']>, <URLResolver <module 'allauth.account.urls' from '/home/docs/checkouts/readthedocs.org/user_builds/mangadventure/envs/v0.6.6/lib/python3.7/site-packages/allauth/account/urls.py'> (None:None) ''>, <URLResolver <module 'allauth.socialaccount.urls' from '/home/docs/checkouts/readthedocs.org/user_builds/mangadventure/envs/v0.6.6/lib/python3.7/site-packages/allauth/socialaccount/urls.py'> (None:None) 'social/'>, <URLResolver <URLPattern list> (None:None) 'reddit/'>, <URLResolver <URLPattern list> (None:None) 'twitter/'>, <URLResolver <URLPattern list> (None:None) 'google/'>, <URLResolver <URLPattern list> (None:None) 'discord/'>]¶ The URL patterns of the users app.
users.views module¶
The views of the users app.
-
users.views.
profile
(request)[source]¶ View that serves the profile page of a user. A
UserProfile
will be created if it doesn’t exist.It serves the logged in user’s profile by default, but accepts an
id
query parameter to view an arbitrary user’s profile.- Parameters
request (
HttpRequest
) – The original request.- Return type
HttpResponse
- Returns
A response with the rendered
profile.html
template.- Raises
Http404 – If there is no user with the specified
id
.
-
class
users.views.
EditUser
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
View that serves the edit form for a user’s profile.
-
setup
(request, *args, **kwargs)[source]¶ Initialize attributes shared by all view methods.
A
UserProfile
will be created if the request user does not yet have one.- Parameters
request (
HttpRequest
) – The original request.
-
get
(request, *args, **kwargs)[source]¶ Handle
GET
requests.- Parameters
request (
HttpRequest
) – The original request.- Return type
HttpResponse
- Returns
A response with the rendered
template
.
-
post
(request, *args, **kwargs)[source]¶ Handle
POST
requests.If the user has changed their e-mail, a confirmation mail will be sent.
- Parameters
request (
HttpRequest
) – The original request.- Return type
HttpResponse
- Returns
A response with the rendered
template
.
-
dispatch
(*args, **kwargs)¶
-
-
class
users.views.
Bookmarks
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
View that serves a user’s bookmarks page.
-
get
(request, *args, **kwargs)[source]¶ Handle
GET
requests.- Parameters
request (
HttpRequest
) – The original request.- Return type
HttpResponse
- Returns
A response with the rendered
template
.
-
post
(request, *args, **kwargs)[source]¶ Handle
POST
requests.If a bookmark exists, it will be deleted. If not, it will be created.
- Parameters
request (
HttpRequest
) – The original request.- Return type
HttpResponse
- Returns
-
dispatch
(*args, **kwargs)¶
-