cdh.files.forms.fields module

class cdh.files.forms.fields.FileField(queryset, *, max_length=None, allow_empty_file=False, **kwargs)[source]

Bases: Field

Form field for the cdh.files.db.FileField

__init__(queryset, *, max_length=None, allow_empty_file=False, **kwargs)[source]
bound_data(data, initial)[source]

Return the value that should be shown for this field on render of a bound form, given the submitted POST data for the field and the initial data, if any.

For most fields, this will simply be data; FileFields need to handle it a bit differently.

clean(data, initial=None)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

default_error_messages
has_changed(initial, data)[source]

Return True if data differs from initial.

prepare_value(value)[source]
storage
to_python(data)[source]
widget

alias of SimpleFileInput

class cdh.files.forms.fields.TrackedFileField(queryset, **kwargs)[source]

Bases: ModelChoiceField

A MultipleChoiceField whose choices are a model QuerySet.

__init__(queryset, **kwargs)[source]
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

default_error_messages = {'invalid_choice': 'Selecteer een geldige keuze. %(value)s is geen beschikbare keuze.', 'invalid_list': 'Voer een lijst met waarden in.', 'invalid_pk_value': '‘%(pk)s’ is geen geldige waarde.'}
has_changed(initial, data)[source]

Return True if data differs from initial.

hidden_widget

alias of MultipleHiddenInput

prepare_value(value)[source]
to_python(value)[source]

Return a string.

widget

alias of TrackedFileInput