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: CustomModelForm

Form for creating and modifying push notification objects

Form fields:

Parameters:
  • regions (QuerySet | None)

  • selected_regions (list[Region] | None)

  • disabled (bool)

  • kwargs (Any)

__init__(regions: QuerySet | None = None, selected_regions: list[Region] | None = None, disabled: bool = False, **kwargs: Any) None[source]

Initialize push notification form

Parameters:
  • **kwargs (Any) – The supplied keyword arguments

  • regions (QuerySet | None)

  • selected_regions (list[Region] | None)

  • disabled (bool)

  • **kwargs

Return type:

None

clean() dict[str, Any][source]

Validate form fields which depend on each other, see django.forms.Form.clean()

Returns:

The cleaned form data

Return type:

dict[str, Any]

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: CustomModelForm

Form for creating and modifying push notification translation objects

Form fields:

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()

Returns:

The cleaned form data

Return type:

dict[str, Any]

has_changed() bool[source]

Return True if submitted data differs from initial data. If the main language should be used as fallback for missing translations, this always return True.

Returns:

Whether the form has changed

Return type:

bool

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:

PushNotificationTranslation