AKSubmission.forms module

Submission-specific forms

AKSubmission.forms.clean_slot_duration(raw_duration, event)[source]

Clean/convert user input for the duration of a slot

Handle different duration formats (h:mm and decimal comma instead of point), clamp durations longer than the event to the event length (see AKModel.models.Event.max_slot_duration), round to the precision of AKModel.models.AKSlot.duration and check the result against the validators of that field

Parameters:
  • raw_duration – raw input, either with “:”, “,” or “.”

  • event – event the slot will belong to

Returns:

tuple of the normalized duration (in hours) and a flag whether the duration had to be clamped

Return type:

(Decimal, bool)

Raises:

ValidationError – if the input cannot be converted into a meaningful duration

class AKSubmission.forms.AKForm(*args, **kwargs)[source]

Bases: AvailabilitiesFormMixin, ModelForm

Base form to add and edit AKs

Contains suitable widgets for the different data types, restricts querysets (e.g., of requirements) to entries belonging to the event this AK belongs to. Prepares initial slot creation (by accepting multiple input formats and a list of slots to generate), automatically generate short names and wiki links if necessary

Will be modified/used by AKSubmissionForm (that allows to add slots and excludes links) and AKWishForm

Form fields:

__init__(*args, **kwargs)[source]
clean()[source]

Normalize/clean inputs

Generate a (not yet used) short name if field was left blank, create a list of normalized slot durations (durations longer than the event are clamped to the event length and remembered in clamped_durations)

Returns:

cleaned inputs

class AKSubmission.forms.AKSubmissionForm(*args, **kwargs)[source]

Bases: AKForm

Form for Submitting new AKs

Is a special variant of AKForm that does not allow to manually edit wiki links or enter results (which only exist after the AK took place) and enforces the generation of at least one slot.

Form fields:

__init__(*args, **kwargs)[source]
clean_availabilities()[source]

Automatically improve availabilities entered. If the user did not specify availabilities assume the full event duration is possible :return: cleaned availabilities (either user input or one availability for the full length of the event if user input was empty)

class AKSubmission.forms.AKWishForm(*args, **kwargs)[source]

Bases: AKForm

Form for submitting or editing wishes

Is a special variant of AKForm that does not allow to specify owner(s) or manually edit wiki and protocol links or enter results

Form fields:

class AKSubmission.forms.AKOwnerForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

Form to create/edit AK owners

Form fields:

class AKSubmission.forms.AKDurationForm(*args, **kwargs)[source]

Bases: ModelForm

Form to add an additional slot to a given AK

Accepts the same duration formats as AKSubmissionForm and clamps durations longer than the event to the event length (see clean_slot_duration())

Form fields:

__init__(*args, **kwargs)[source]
clean()[source]

Normalize/clean duration input (see clean_slot_duration())

Returns:

cleaned inputs

class AKSubmission.forms.AKOrgaMessageForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

Form to create a confidential message to the organizers belonging to a given AK

Form fields: