Push Notifications
Forms for creating and modifying push notification and push notification translation objects
Push Notification Form
- class integreat_cms.cms.forms.push_notifications.push_notification_form.PushNotificationForm(regions: QuerySet | None = None, selected_regions: list[Region] | None = None, disabled: bool = False, **kwargs: Any)[source]
Bases:
CustomModelFormForm for creating and modifying push notification objects
Form fields:
channel: Channel (TypedChoiceField)regions: Regions (ModelMultipleChoiceField)mode: Mode (TypedChoiceField)scheduled_send_date: Scheduled send date (DateTimeField)do_not_translate_title: Do not translate the title (BooleanField)schedule_send: Schedule sending (BooleanField)scheduled_send_date_day: Scheduled send day (DateField)scheduled_send_date_time: Scheduled send time (TimeField)
- Parameters:
- __init__(regions: QuerySet | None = None, selected_regions: list[Region] | None = None, disabled: bool = False, **kwargs: Any) None[source]
Initialize push notification form
- 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.
Push Notification Translation Form
- class integreat_cms.cms.forms.push_notifications.push_notification_translation_form.PushNotificationTranslationForm(**kwargs: Any)[source]
Bases:
CustomModelFormForm for creating and modifying push notification translation objects
Form fields:
title: Title (CharField)text: Content (CharField)automatic_translation: Automatic translation (BooleanField)mt_translations_to_create: Create new translations: (ModelMultipleChoiceField)mt_translations_to_update: Update existing translations: (ModelMultipleChoiceField)
- Parameters:
kwargs (Any)
- __init__(**kwargs: Any) None[source]
Initialize MT translation form. If request and language kwargs are missing, MTs are disabled.
- Parameters:
**kwargs (Any) – The supplied keyword arguments
- Return type:
None
- add_error_messages(request: HttpRequest) None[source]
This function overwrites
add_error_messages()to add the language of the current translation to the error messages- Parameters:
request (HttpRequest) – The current request submitting the form
- Return type:
None
- clean() dict[str, Any][source]
Validate form fields which depend on each other, see
django.forms.Form.clean()
- has_changed() bool[source]
Return
Trueif submitted data differs from initial data. If the main language should be used as fallback for missing translations, this always returnTrue.- Returns:
Whether the form has changed
- Return type:
- property media[source]
Return all media required to render the widgets on this form.
- mt_form_is_enabled() NS_NodeQuerySet[source]
Helper method to decide if this form should be shown, or if it should be hidden for the current language due to a lack of MT-compatible child language nodes
- Returns:
Whether this form is enabled
- Return type:
NS_NodeQuerySet
- save(commit: bool = True) PushNotificationTranslation[source]
Create machine translations and save them to the database
- Parameters:
commit (bool) – Whether or not the changes should be written to the database
- Returns:
The saved content translation object
- Return type: