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:
name
: Name (CharField
)parent
: Parent directory (ModelChoiceField
)
- Parameters:
kwargs (Any)
- clean() dict [source]
This function provides additional validation rules for the directory form.
- Returns:
The cleaned data
- Return type:
- 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:
name
: Name (CharField
)is_hidden
: Hidden (BooleanField
)
- 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:
name
: Name (CharField
)alt_text
: Description (CharField
)is_hidden
: Hidden (BooleanField
)
- 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:
parent_directory
: Parent directory (ModelChoiceField
)
- 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 aValidationError
.- Returns:
The cleaned form data
- Return type:
- 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:
file
: File (FileField
)name
: Name (CharField
)thumbnail
: Thumbnail file (FileField
)file_size
: File size (IntegerField
)last_modified
: Last modified (DateTimeField
)
- Parameters:
- __init__(user: User | None = None, data: QueryDict | None = None, files: MultiValueDict | None = None, instance: MediaFile | None = None) None [source]
Initialize UploadMediaFileForm form
- 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 aValidationError
.- Returns:
The cleaned form data
- Return type:
- property media[source]
Return all media required to render the widgets on this form.
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:
file
: File (FileField
)name
: Name (CharField
)type
: File type (TypedChoiceField
)parent_directory
: Parent directory (ModelChoiceField
)thumbnail
: Thumbnail file (FileField
)file_size
: File size (IntegerField
)last_modified
: Last modified (DateTimeField
)
- 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 aValidationError
.- Returns:
The cleaned form data
- Return type:
- property media[source]
Return all media required to render the widgets on this form.