Users
Forms for creating and modifying user objects
Authentication Form
- class integreat_cms.cms.forms.users.authentication_form.AuthenticationForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]
- Bases: - Form- Form to check the password of an already authenticated user. Used for critical operations where a valid session might not be enough (e.g. modifying 2-FA options). - Form fields: - password: Password (- CharField)
 - property media[source]
- Return all media required to render the widgets on this form. 
 
Organization Field
- class integreat_cms.cms.forms.users.organization_field.OrganizationField(queryset, *, empty_label='---------', required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, blank=False, **kwargs)[source]
- Bases: - ModelChoiceField- ModelChoiceField which puts the organization’s region id as data attribute on <options> - label_from_instance(obj: Organization) dict[str, Any][source]
- Normally, this function convert objects into strings and generate the labels for the choices presented by this object. - In this case, we abuse the function also to pass the organization’s region id to the - create_option()function to enable it to use it as data attribute.- Parameters:
- obj (Organization) – The name of the option 
- Returns:
- A dict of the real label and the organization’s region id 
- Return type:
 
 - widget[source]
- The widget to use when rendering this type of Field. - alias of - OrganizationFieldWidget
 
- class integreat_cms.cms.forms.users.organization_field.OrganizationFieldWidget(attrs=None, choices=())[source]
- Bases: - Select- Select widget which puts the organization’s region id as data attribute on <options> - create_option(name: str, value: ModelChoiceIteratorValue | str, label: dict[str, Any] | str, selected: bool, index: int, subindex: Any | None = None, attrs: dict[str, str] | None = None) dict[str, Any][source]
- This function creates an option which can be selected in the organization field - Parameters:
- name (str) – The name of the option 
- value (ModelChoiceIteratorValue | str) – the value of the option (the page id) 
- label (dict[str, Any] | str) – The label (and optionally the region id) of the option 
- selected (bool) – Whether or not the option is selected 
- index (int) – The index of the option 
- subindex (Any | None) – The subindex of the option 
- attrs (dict[str, str] | None) – The attributes of the option 
 
- Returns:
- The option dict 
- Return type:
 
 
Password Reset Form
- class integreat_cms.cms.forms.users.password_reset_form.CustomPasswordResetForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]
- Bases: - PasswordResetForm- A custom form to attach the logo to the password reset email - Form fields: - email: Email (- EmailField)
 - property media[source]
- Return all media required to render the widgets on this form. 
 - send_mail(_subject_template_name: str, email_template_name: str, context: dict[str, Any], _from_email: Any | None, to_email: str, html_email_template_name: str) None[source]
- Send a django.core.mail.EmailMultiAlternatives to to_email. - Parameters:
- _subject_template_name (str) – The template to be used to render the subject of the email 
- email_template_name (str) – The template to be used to render the text email 
- _from_email (Any | None) – The email address of the sender 
- to_email (str) – The email address of the recipient 
- html_email_template_name (str) – The template to be used to render the HTML email 
 
- Return type:
- None 
 
 
Passwordless Authentication Form
- class integreat_cms.cms.forms.users.passwordless_authentication_form.PasswordlessAuthenticationForm(*args: Any, request: HttpRequest | None = None, **kwargs: Any)[source]
- Bases: - Form- Form class for authenticating users without using passwords but other authentication methods like FIDO2. - Form fields: - username: Username (- UsernameField)
 - Parameters:
- args (Any) 
- request (HttpRequest | None) 
- kwargs (Any) 
 
 - __init__(*args: Any, request: HttpRequest | None = None, **kwargs: Any) None[source]
- Render passwordless authentication form for HTTP GET requests - Parameters:
- request (HttpRequest | None) – Object representing the user call 
- *args (Any) – The supplied arguments 
- **kwargs (Any) – The supplied keyword arguments 
 
- Return type:
- None 
 
 - clean_username() str[source]
- Checks the input of the user to enable authentication - Raises:
- ValidationError – If the given username or email is invalid 
- Returns:
- The cleaned username 
- Return type:
 
 - error_messages = {'disabled': 'Your account is not activated for passwordless authentication. Please use the default login.', 'inactive': 'This account is inactive.', 'invalid_login': 'The username or email address is incorrect.', 'not_available': 'In order to use passwordless authentication, you have to configure at least one 2-factor authentication method.'}[source]
- The different reasons why passwordless authentication might not be possible 
 - property media[source]
- Return all media required to render the widgets on this form. 
 
Region User Form
- class integreat_cms.cms.forms.users.region_user_form.RegionUserForm(region: Region, **kwargs: Any)[source]
- Bases: - UserForm- Form for creating and modifying region user objects - Form fields: - username: Username (- CharField)
- first_name: First name (- CharField)
- last_name: Last name (- CharField)
- email: Email address (- EmailField)
- is_active: Active (- BooleanField)
- role: Role (- ModelChoiceField)
- send_activation_link: Send activation link (- BooleanField)
- organization: Organization (- ModelChoiceField)
- expert_mode: Experienced user (- BooleanField)
- staff_role: Team (- ModelChoiceField)
- password: Password (- CharField)
 - Parameters:
- region (Region) 
- kwargs (Any) 
 
 - __init__(region: Region, **kwargs: Any) None[source]
- Initialize region user form - Parameters:
- region (Region) – The current region 
- **kwargs (Any) – The supplied keyword arguments 
 
- Return type:
- None 
 
 - property media[source]
- Return all media required to render the widgets on this form. 
 
User Email Form
- class integreat_cms.cms.forms.users.user_email_form.UserEmailForm(**kwargs: Any)[source]
- Bases: - CustomModelForm- Form for modifying user email addresses - Form fields: - email: Email address (- EmailField)
 - Parameters:
- kwargs (Any) 
 - property media[source]
- Return all media required to render the widgets on this form. 
 
User Filter Form
- class integreat_cms.cms.forms.users.user_filter_form.UserFilterForm(**kwargs: Any)[source]
- Bases: - CustomFilterForm- Form for filtering user objects - Form fields: - role: Role (- ChoiceField)
- permissions: Permissions (- ChoiceField)
- region: Region (- ModelChoiceField)
- query: Query (- CharField)
 - Parameters:
- kwargs (Any) 
 - apply(users: QuerySet[User]) QuerySet[User][source]
- Filter the users list according to the given filter data 
 - filter_by_query(users: QuerySet[User]) QuerySet[User][source]
- Filter the pages list by a given search query 
 - property media[source]
- Return all media required to render the widgets on this form. 
 
User Form
- class integreat_cms.cms.forms.users.user_form.UserForm(**kwargs: Any)[source]
- Bases: - CustomModelForm- Form for creating and modifying user objects - Form fields: - username: Username (- CharField)
- first_name: First name (- CharField)
- last_name: Last name (- CharField)
- email: Email address (- EmailField)
- is_staff: Staff status (- BooleanField)
- is_active: Active (- BooleanField)
- is_superuser: Superuser status (- BooleanField)
- organization: Organization (- OrganizationField)
- expert_mode: Experienced user (- BooleanField)
- regions: Regions (- ModelMultipleChoiceField)
- role: Role (- ModelChoiceField)
- send_activation_link: Send activation link (- BooleanField)
- passwordless_authentication_enabled: Enable passwordless authentication (- BooleanField)
- staff_role: Team (- ModelChoiceField)
- password: Password (- CharField)
 - Parameters:
- kwargs (Any) 
 - __init__(**kwargs: Any) None[source]
- Initialize user form - Parameters:
- **kwargs (Any) – The supplied keyword arguments 
- Return type:
- None 
 
 - clean() dict[str, Any][source]
- Validate form fields which depend on each other, see - django.forms.Form.clean()
 - clean_email() str[source]
- Make the email lower case (see Overriding the clean() method) - Returns:
- The email in lower case 
- Return type:
 
 - property media[source]
- Return all media required to render the widgets on this form. 
 
User Name Form
- class integreat_cms.cms.forms.users.user_name_form.UserNameForm(**kwargs: Any)[source]
- Bases: - CustomModelForm- Form for modifying user name including username, first name, and last name. - Form fields: - Parameters:
- kwargs (Any) 
 - clean_username() str[source]
- Ensure that the username is unique across all users except the one being edited. - Returns:
- The validated username 
- Return type:
 
 - property media[source]
- Return all media required to render the widgets on this form. 
 
User Password Form
- class integreat_cms.cms.forms.users.user_password_form.UserPasswordForm(**kwargs: Any)[source]
- Bases: - CustomModelForm- Form for changing a user’s password - Form fields: - old_password: My old password (- CharField)
- new_password: My new password (- CharField)
- new_password_confirm: Confirm my new password (- CharField)
 - Parameters:
- kwargs (Any) 
 - clean() dict[str, Any][source]
- Validate form fields which depend on each other, see - django.forms.Form.clean()
 - property media[source]
- Return all media required to render the widgets on this form. 
 
User Preferences Form
- class integreat_cms.cms.forms.users.user_preferences_form.UserPreferencesForm(**kwargs: Any)[source]
- Bases: - CustomModelForm- Form for changing a user’s preferences - Form fields: - distribute_sidebar_boxes: Automatically distribute sidebar boxes (- BooleanField)
 - Parameters:
- kwargs (Any) 
 - property media[source]
- Return all media required to render the widgets on this form.