Les membres (member/)¶
Module situé dans zds/member/.
Fichiers documentés :
Modèles (models.py)¶
-
class
zds.member.models.Ban(*args, **kwargs)¶ This model stores all sanctions (not only bans). It stores sanctioned user, the moderator, the type of sanctions, the reason and the date. Note this stores also un-sanctions.
-
class
zds.member.models.BannedEmailProvider(*args, **kwargs)¶ A email provider which has been banned by a staff member. It cannot be used for registration.
-
class
zds.member.models.KarmaNote(*args, **kwargs)¶ Karma notes are a way of annotating members profiles. They are only visible to the staff.
Fields are: - target user and the moderator leaving the note - a textual note - some amount of karma, negative values being… negative
-
class
zds.member.models.NewEmailProvider(*args, **kwargs)¶ A new-used email provider which should be checked by a staff member.
-
class
zds.member.models.Profile(*args, **kwargs)¶ A user profile. Complementary data of standard Django auth.user.
-
get_absolute_url()¶ Absolute URL to the profile page.
-
get_active_alerts_count()¶ Retourne: The number of currently active alerts created by this user.
-
get_article_count()¶ Retourne: the count of articles with this user as author. Count all articles, no only published one.
-
get_articles()¶ Retourne: All articles with this user as author.
-
get_avatar_url()¶ Get the avatar URL for this profile. If the user has defined a custom URL, use it. If not, use Gravatar. :return: The avatar URL for this profile :rtype: str
-
get_beta_articles()¶ Retourne: All articles in beta with this user as author.
-
get_beta_contents(_type=None)¶ Paramètres: _type – if provided, request a specific type of content Retourne: All tutorials in beta with this user as author.
-
get_beta_tutos()¶ Retourne: All tutorials in beta with this user as author.
-
get_city()¶ Uses geo-localization to get physical localization of a profile through its last IP address. This works relatively good with IPv4 addresses (~city level), but is very imprecise with IPv6 or exotic internet providers. :return: The city and the country name of this profile.
-
get_content_count(_type=None)¶ Paramètres: _type – if provided, request a specific type of content Retourne: the count of contents with this user as author. Count all contents no only published one.
-
get_contents(_type=None)¶ Paramètres: _type – if provided, request a specific type of content Retourne: All contents with this user as author.
-
get_draft_articles()¶ Return all draft article with this user as author. A draft article is a article which is not published or in validation. :return: All draft article with this user as author.
-
get_draft_contents(_type=None)¶ Return all draft contents with this user as author. A draft content is a content which is not published, in validation or in beta.
Paramètres: _type – if provided, request a specific type of content Retourne: All draft tutorials with this user as author.
-
get_draft_opinions()¶ Return all draft opinion with this user as author. A draft opinion is a opinion which is not published or in validation. :return: All draft opinion with this user as author.
-
get_draft_tutos()¶ Return all draft tutorials with this user as author. A draft tutorial is a tutorial which is not published, in validation or in beta. :return: All draft tutorials with this user as author.
-
get_followed_topics()¶ Retourne: All forum topics followed by this user.
-
get_opinion_count()¶ Retourne: the count of opinions with this user as author. Count all opinions, no only published one.
-
get_opinions()¶ Retourne: All opinions with this user as author.
-
get_post_count()¶ Retourne: The forum post count. Doesn’t count comments on articles or tutorials.
-
get_post_count_as_staff()¶ Number of messages posted (view as staff).
-
get_public_articles()¶ Retourne: All published articles with this user as author.
-
get_public_contents(_type=None)¶ Paramètres: _type – if provided, request a specific type of content Retourne: All published contents with this user as author.
-
get_public_opinions()¶ Retourne: All published opinions with this user as author.
-
get_public_tutos()¶ Retourne: All published tutorials with this user as author.
-
get_topic_count()¶ Retourne: the number of topics created by this user.
-
get_tuto_count()¶ Retourne: the count of tutorials with this user as author. Count all tutorials, no only published one.
-
get_tutos()¶ Retourne: All tutorials with this user as author.
-
get_user_contents_queryset(_type=None)¶ Paramètres: _type – if provided, request a specific type of content Retourne: Queryset of contents with this user as author.
-
get_user_public_contents_queryset(_type=None)¶ Paramètres: _type – if provided, request a specific type of content Retourne: Queryset of contents with this user as author.
-
get_validate_articles()¶ Retourne: All articles in validation with this user as author.
-
get_validate_contents(_type=None)¶ Paramètres: _type – if provided, request a specific type of content Retourne: All contents in validation with this user as author.
-
get_validate_tutos()¶ Retourne: All tutorials in validation with this user as author.
-
has_hat()¶ Checks if this user can at least use one hat.
-
is_dev()¶ Checks whether user is part of group settings.ZDS_APP[‘member’][‘dev_group’].
-
is_private()¶ can the user can display their stats
-
-
class
zds.member.models.TokenForgotPassword(*args, **kwargs)¶ When a user forgot its password, the website sends it an email with a token (embedded in a URL). If the user has the correct token, it can choose a new password on the dedicated page. This model stores the tokens for the users that have forgot their passwords, with an expiration date.
-
get_absolute_url()¶ Retourne: The absolute URL of the “New password” page, including the correct token.
-
-
class
zds.member.models.TokenRegister(*args, **kwargs)¶ On registration, a token is send by mail to the user. It must use this token (by clicking on a link) to activate its account (and prove the email address is correct) and connect itself. This model stores the registration token for each user, with an expiration date.
-
get_absolute_url()¶ Retourne: the absolute URL of the account validation page, including the token.
-
-
zds.member.models.auto_delete_token_on_unregistering(sender, instance, **kwargs)¶ This signal receiver deletes forgotten password tokens and registering tokens for the un-registering user;
-
zds.member.models.logout_user(username)¶ Logout the member. :param username: the name of the user to logout.
-
zds.member.models.remove_token_github_on_removing_from_dev_group(sender, instance, **kwargs)¶ This signal receiver removes the GitHub token of an user if he’s not in the dev group
Vues (views.py)¶
-
class
zds.member.views.MemberDetail(**kwargs)¶ Displays details about a profile.
-
model¶ alias de
User
-
-
class
zds.member.views.MemberList(**kwargs)¶ Displays the list of registered users.
-
class
zds.member.views.SendValidationEmailView(**kwargs)¶ Send a validation email on demand.
-
class
zds.member.views.UpdateAvatarMember(**kwargs)¶ Update avatar of a user logged.
-
form_class¶ alias de
ImageAsAvatarForm
-
-
class
zds.member.views.UpdateGitHubToken(**kwargs)¶ Updates the GitHub token.
-
form_class¶ alias de
GitHubTokenForm
-
-
class
zds.member.views.UpdatePasswordMember(**kwargs)¶ User’s settings about his password.
-
class
zds.member.views.UpdateUsernameEmailMember(**kwargs)¶ User’s settings about his username and email.
-
form_class¶ alias de
ChangeUserForm
-
-
zds.member.views.activate_account(request)¶ Active token for a user.
-
zds.member.views.add_hat(request, *args, **kwargs)¶ Used to add a hat to a user. Creates the hat if it doesn’t exist.
-
zds.member.views.check_new_email_provider(request, *args, **kwargs)¶ Remove an alert about a new provider
-
zds.member.views.forgot_password(request)¶ If the user forgot his password, he can have a new one.
-
zds.member.views.generate_token_account(request)¶ Generate token for account.
-
zds.member.views.get_client_ip(request)¶ Retrieve the real IP address of the client.
-
zds.member.views.login_view(request)¶ Log in user.
-
zds.member.views.logout_view(request, *args, **kwargs)¶ Log out user.
-
zds.member.views.member_from_ip(request, *args, **kwargs)¶ Get list of user connected from a particular ip
-
zds.member.views.modify_karma(request, *args, **kwargs)¶ Add a Karma note to the user profile
-
zds.member.views.new_password(request)¶ Create a new password for a user.
-
zds.member.views.remove_banned_email_provider(request, *args, **kwargs)¶ Used to unban an email provider
-
zds.member.views.remove_github_token(request, *args, **kwargs)¶ Removes the current user’s token
-
zds.member.views.remove_hat(request, *args, **kwargs)¶ Used to remove a hat from a user.
-
zds.member.views.settings_promote(request, *args, **kwargs)¶ Manage the admin right of user. Only super user can access
-
zds.member.views.solve_hat_request(request, *args, **kwargs)¶ Solves a hat request by granting or denying the requested hat according to moderator’s decision.
-
zds.member.views.unregister(request, *args, **kwargs)¶ allow members to unregister
-
zds.member.views.warning_unregister(request, *args, **kwargs)¶ Displays a warning page showing what will happen when user unregisters.
Les utilitaires (utils.py)¶
-
class
zds.member.utils.ZDSCustomizeSocialAuthExceptionMiddleware¶ For more information, see http://python-social-auth.readthedocs.io/en/latest/configuration/django.html#exceptions-middleware.
Les objets commun pour l’authentification avec API (commons.py)¶
-
class
zds.member.commons.BanSanction(array_infos)¶ State of the sanction ban.
-
class
zds.member.commons.DeleteBanSanction(array_infos)¶ State of the un-sanction ban.
-
class
zds.member.commons.DeleteReadingOnlySanction(array_infos)¶ State of the un-sanction reading only.
-
class
zds.member.commons.MemberSanctionState(array_infos)¶ Super class of the enumeration to know which sanction it is.
-
apply_sanction(profile, ban)¶ Applies the sanction with the ban object on a member with the profile object and saves these objects.
Paramètres: - profile (Profile object) – Member concerned by the sanction.
- ban (Ban object) – Sanction.
Retourne: nothing
Type retourné:
-
get_detail()¶ Gets detail of a sanction.
Retourne: detail of the sanction. Type retourné: ugettext_lazy
-
get_message_sanction()¶ Gets the message for a sanction.
Retourne: message of the sanction. Type retourné: ugettext_lazy
-
get_message_unsanction()¶ Gets the message for an un-sanction.
Retourne: message of the un-sanction. Type retourné: ugettext_lazy
-
get_sanction(moderator, user)¶ Gets the sanction according to the type of the sanction.
Paramètres: - moderator (User object) – Moderator who applies the sanction.
- user (User object) – User sanctioned.
Retourne: sanction
Type retourné: Ban object
-
get_type()¶ Gets the type of a sanction.
Retourne: type of the sanction. Type retourné: ugettext_lazy
-
-
class
zds.member.commons.ReadingOnlySanction(array_infos)¶ State of the sanction reading only.
-
class
zds.member.commons.TemporaryBanSanction(array_infos)¶ State of the sanction ban temporary.
-
class
zds.member.commons.TemporaryReadingOnlySanction(array_infos)¶ State of the sanction reading only temporary.