Media

Forms for creating and modifying MediaFile and Directory objects

Create Directory Form

class integreat_cms.cms.forms.media.create_directory_form.CreateDirectoryForm(**kwargs: Any)[source]

Bases: CustomModelForm

Form for creating and modifying directory objects

Form fields:

Parameters:

kwargs (Any)

clean() dict[source]

This function provides additional validation rules for the directory form.

Returns:

The cleaned data

Return type:

dict

property media[source]

Return all media required to render the widgets on this form.

Directory Form

class integreat_cms.cms.forms.media.directory_form.DirectoryForm(**kwargs: Any)[source]

Bases: CustomModelForm

Form for creating and modifying directory objects

Form fields:

Parameters:

kwargs (Any)

property media[source]

Return all media required to render the widgets on this form.

Media File Form

class integreat_cms.cms.forms.media.media_file_form.MediaFileForm(**kwargs: Any)[source]

Bases: CustomModelForm

Form for modifying media file objects

Form fields:

Parameters:

kwargs (Any)

property media[source]

Return all media required to render the widgets on this form.

Media Move Form

class integreat_cms.cms.forms.media.media_move_form.MediaMoveForm(**kwargs: Any)[source]

Bases: CustomModelForm

Form for moving media file objects into a directory

Form fields:

Parameters:

kwargs (Any)

clean() dict[source]

Validate form fields which depend on each other, see django.forms.Form.clean(): If the file is moved to another region, add a ValidationError.

Returns:

The cleaned form data

Return type:

dict

property media[source]

Return all media required to render the widgets on this form.

Replace Media File Form

class integreat_cms.cms.forms.media.replace_media_file_form.ReplaceMediaFileForm(user: User | None = None, data: QueryDict | None = None, files: MultiValueDict | None = None, instance: MediaFile | None = None)[source]

Bases: CustomModelForm

Form for replacing media file objects

Form fields:

Parameters:
  • user (User | None)

  • data (QueryDict | None)

  • files (MultiValueDict | None)

  • instance (MediaFile | None)

__init__(user: User | None = None, data: QueryDict | None = None, files: MultiValueDict | None = None, instance: MediaFile | None = None) None[source]

Initialize UploadMediaFileForm form

Parameters:
  • data (QueryDict | None) – A dictionary-like object containing all given HTTP POST parameters

  • files (MultiValueDict | None) – A dictionary-like object containing all uploaded files

  • instance (MediaFile | None) – This form’s instance

  • user (User | None)

Return type:

None

clean() dict[source]

Validate form fields which depend on each other, see django.forms.Form.clean(): Check whether a file was uploaded and whether it’s type matches the original file’s type. If the file type is invalid, add a ValidationError.

Returns:

The cleaned form data

Return type:

dict

property media[source]

Return all media required to render the widgets on this form.

save(commit: bool = True) MediaFile[source]

This method extends the default save()-method of the base ModelForm to provide debug logging

Parameters:

commit (bool) – Whether or not the changes should be written to the database

Returns:

The saved object returned by The save() method

Return type:

MediaFile

Upload Media File Form

class integreat_cms.cms.forms.media.upload_media_file_form.UploadMediaFileForm(data: QueryDict | None = None, files: MultiValueDict | None = None, instance: MediaFile | None = None)[source]

Bases: CustomModelForm

Form for uploading media file objects

Form fields:

Parameters:
  • data (QueryDict | None)

  • files (MultiValueDict | None)

  • instance (MediaFile | None)

__init__(data: QueryDict | None = None, files: MultiValueDict | None = None, instance: MediaFile | None = None) None[source]

Initialize UploadMediaFileForm form

Parameters:
  • data (QueryDict | None) – submitted POST data

  • data – A dictionary-like object containing all given HTTP POST parameters

  • files (MultiValueDict | None) – A dictionary-like object containing all uploaded files

  • instance (MediaFile | None) – This form’s instance

Return type:

None

clean() dict[source]

Validate form fields which depend on each other, see django.forms.Form.clean(): Don’t allow multiple root nodes for one region: If the file type is invalid, add a ValidationError.

Returns:

The cleaned form data

Return type:

dict

property media[source]

Return all media required to render the widgets on this form.