accounts.views package#

Submodules#

accounts.views.admin module#

accounts.views.admin.admin_mark_user_deceased(request)[source]#

Mark user as deceased

accounts.views.admin.admin_toggle_user_is_active(request)[source]#

Activate or deactivate a user

accounts.views.admin.invite_to_join(un_reg: UnregisteredUser, email: str, requested_by_user: User, requested_by_org: Organisation)[source]#

Invite an unregistered user to sign up

Parameters:
  • un_reg – An unregistered user object

  • email – email address to send to

  • requested_by_user – User who is inviting this person

  • requested_by_org – Org making request

accounts.views.admin.user_signed_up_list(request)[source]#

Show users who have signed up

Parameters:

request (HTTPRequest) – standard request

Returns:

Page

accounts.views.api module#

accounts.views.api.create_user_session_id(user)[source]#

Create a new session for a user. Used by the mobile API when we register a new device so it can login the webpage view using only the session_id and doesn’t need to come in through the login page.

accounts.views.api.delete_fcm_device_ajax(request)[source]#

Ajax call to delete an FCM device

accounts.views.api.delete_session_ajax(request)[source]#

Ajax call to delete a session

accounts.views.api.search_for_user_in_cobalt_and_mpc(first_name_search, last_name_search, last_name_only=False)[source]#

Search for a user in Cobalt or MPC

If last_name_only is specified the MPC serach will be on last name only. This is useful if the provided first name is the prefered name (eg Jack versus John)

accounts.views.core module#

accounts.views.core.activate(request, uidb64, token)[source]#

User activation form

This is the link sent to the user over email. If the link is valid, then the user is logged in, otherwise they are notified that the link is not valid.

Parameters:
  • object (request - standard request)

  • id (uidb64 - encrypted user)

  • token (token - generated)

Returns:

HttpResponse

accounts.views.core.add_un_registered_user_with_mpc_data(system_number: int, club: ~organisations.models.Organisation, added_by: ~accounts.models.User, origin: str = 'Manual') -> (<class 'str'>, <class 'dict'>)[source]#

Add an unregistered user to the system. Called from the player import if the user isn’t already in the system

accounts.views.core.change_password(request)[source]#

Password change form

Allows a user to change their password.

Parameters:

object (request - standard request)

Returns:

HttpResponse

accounts.views.core.get_email_address_and_name_from_system_number(system_number, club=None, requestor=None)[source]#

returns email address for a user or unregistered user

If we get a club passed in, then we check for club level email addresses. Required to get unregistered users

The requestor field is used to identify which part of the system is asking for this. Initially, we only support “results” as a value here. If provided we exclude people who don’t want results emails.

accounts.views.core.get_user_or_unregistered_user_from_system_number(system_number)[source]#

return a User or UnregisteredUser object for a given system number

accounts.views.core.get_user_statistics()[source]#

get statistics about users, called by utils statistics view

accounts.views.core.get_users_or_unregistered_users_from_email_list(email_list)[source]#

takes a list of email addresses and returns a dictionary of User or UnregisteredUser objects indexed by system_number

Parameters:

email_list (list) – list of str - email addresses

Returns:

dict of Users or Unregistered Users keyed by the supplied email addresses. If an email address is not found then there is no entry in the dictionary. User and Unregistered user objects have the additional attribute is_user, is_un_reg set to denote type of object

accounts.views.core.get_users_or_unregistered_users_from_system_number_list(system_number_list)[source]#

takes a list of system numbers and returns a dictionary of User or UnregisteredUser objects indexed by system_number

accounts.views.core.html_email_reset(request)[source]#

This is necessary so that we can provide an HTML email template for the password reset

accounts.views.core.loggedout(request)[source]#

Should review if this is really needed.

accounts.views.core.password_reset_request(request)[source]#

handle password resets from users not logged in

accounts.views.core.register_user(request, system_number=None, email=None)[source]#

User registration form

This form allows a user to register for the system. The form includes Ajax code to look up the system number and pre-fill the first and last name.

This form also sends the email to the user to confirm the email address is valid.

Parameters:

object (request - standard request)

Returns:

HttpResponse

accounts.views.covid module#

accounts.views.covid.covid_htmx(request)[source]#

return current state of users covid status as HTML

accounts.views.covid.covid_user_confirm_htmx(request)[source]#

Update users covid status

accounts.views.covid.covid_user_exempt_htmx(request)[source]#

Update users covid status to anti-vaxxer

accounts.views.profile module#

accounts.views.profile.add_team_mate_ajax(request)[source]#

Ajax call to add a team mate

Parameters:

request (HTTPRequest) – standard request

Returns:

success, failure or error

Return type:

HTTPResponse

accounts.views.profile.allow_auto_pay_htmx(request)[source]#

toggle the allow auto pay setting on a club options row

accounts.views.profile.allow_membership_htmx(request)[source]#

toggle the allow membership setting on a club options row

The POST is expected to incude:

club_id: Organisation id of the club involved allow: ‘YES’ or ‘NO’

accounts.views.profile.blurb_form_upload(request)[source]#

Profile update sub-form. Handles the picture and about fields.

Allows a user to change their profile settings.

Parameters:

object (request - standard request)

Returns:

HttpResponse

accounts.views.profile.delete_photo(request)[source]#

Removes a user picture and resets to default

Parameters:

request (HTTPRequest) – standard request

Returns:

Page

accounts.views.profile.delete_team_mate_ajax(request)[source]#

Ajax call to delete a team mate

Parameters:

request (HTTPRequest) – standard request

Returns:

success, failure or error

Return type:

HTTPResponse

accounts.views.profile.memberships_card_htmx(request, message=None, warning_message=False)[source]#

htmx end point for the membership card on the user profile page

accounts.views.profile.picture_form_upload(request)[source]#

Profile update sub-form. Handles the picture

Allows a user to change their profile settings.

Parameters:

object (request - standard request)

Returns:

HttpResponse

accounts.views.profile.profile(request)[source]#

Profile update form.

Allows a user to change their profile settings.

Parameters:

object (request - standard request)

Returns:

HttpResponse

accounts.views.profile.public_profile(request, pk)[source]#

Public Profile form.

Shows public information about a member.

Parameters:
  • object (request - standard request)

  • User (pk - key of)

Returns:

HttpResponse

accounts.views.profile.share_data_htmx(request)[source]#

change the data sharing setting on a club options row

accounts.views.profile.toggle_team_mate_ajax(request)[source]#

Ajax call to switch the state of a team mate

Parameters:

request (HTTPRequest) – standard request

Returns:

message and first name

Return type:

JsonResponse

accounts.views.search module#

accounts.views.search.member_detail_m2m_ajax(request)[source]#

Returns basic public info on a member. ONLY USED BY MEMBER TRANSFER. REPLACE.

Ajax call to get basic info on a member. Will return an empty json array if the member number is invalid.

Parameters:

number (member_id - member)

Returns:

member, clubs, global org name.

Return type:

Json array

accounts.views.search.member_details_ajax(request)[source]#

Returns basic public info on a member for the generic member search.

Ajax call to get basic info on a member. Will return an empty json array if the member number is invalid.

Parameters:
  • number (member_id - member)

  • this (search_id - used if page has multiple user searches. We just pass)

  • Optional. (through.)

Returns:

member, clubs, global org name.

Return type:

Json array

accounts.views.search.member_match_htmx(request)[source]#

show member details when a user picks from the list of matches

accounts.views.search.member_match_summary_htmx(request)[source]#

show outcome from search

accounts.views.search.member_search_ajax(request)[source]#

Ajax member search function. Used by the generic member search.

Used to search for members by the Member to Member transfer part of Payments. Currently very specific to payments. Could be made more generic if other parts of the system need a search function.

Parameters:
  • ending. (firstname - partial firstname to search for. Wild cards the)

  • ending.

  • Optional. (search_id - used if page has multiple user searches. We just pass this through.)

Returns:

HttpResponse - either a message or a list of users in HTML format.

accounts.views.search.member_search_htmx(request)[source]#

Search on user first and last name.

The goal of the member search is to finally replace the included search with a hidden user_id input field, the users name and a button to search again. Alternatively, a callback can be provided which will be called if/when a user is selected.

All parameters are passed through in the request.

search_id: optional identifier, required if there are multiple user searches on same page, must be unique

but can be anything. Gets appended to any DOM objects that should be unique on the page. This is also used as the prefix for the final user_id field if user_id_field is not specified.

user_id_field: Optional. At the end, if we find a matching user we will create an element for the user_id and

an element for the user name to display. The user_id_field will be used as the name of the user_id input. If not specified then member{search_id} is used.

include_me: Flag to include the logged in user in the search. Default is no.

callback: Optional. If provided then this will be called when a member is picked.

unregistered: Optional. If provided then we search for UnregisteredUsers instead of Users.

accounts.views.search.search_ajax(request)[source]#

Ajax member search function. ONLY USED BY MEMBER TRANSFER. REPLACE.

Used to search for members by the Member to Member transfer part of Payments. Currently very specific to payments. Could be made more generic if other parts of the system need a search function.

Parameters:
  • ending. (firstname - partial firstname to search for. Wild cards the)

  • ending.

Returns:

HttpResponse - either a message or a list of users in HTML format.

accounts.views.search.system_number_search_ajax(request)[source]#

Ajax system_number search function. Used by the generic member search.

Parameters:

for (system_number - exact number to search)

Returns:

HttpResponse - either a message or a list of users in HTML format.

accounts.views.search.system_number_search_htmx(request)[source]#

Search on system number

accounts.views.settings module#

accounts.views.settings.developer_settings_delete_token_htmx(request)[source]#

Delete a token for a developer

accounts.views.settings.developer_settings_htmx(request)[source]#

Manage settings for developers. Built into the normal settings page

accounts.views.settings.unregistered_user_settings(request, identifier)[source]#

allow an unregistered user to control their email preferences

accounts.views.settings.user_settings(request)[source]#

User settings form.

Allow user to choose preferences

Parameters:

object (request - standard request)

Returns:

HttpResponse

Module contents#