forms — Swingtime Forms¶
Convenience forms for adding and updating Event and Occurrence objects.
Functions¶
timeslot_options¶
-
forms.timeslot_options([interval=swingtime_settings.TIMESLOT_INTERVAL, start_time=swingtime_settings.TIMESLOT_START_TIME, end_delta=swingtime_settings.TIMESLOT_END_TIME_DURATION, fmt=swingtime_settings.TIMESLOT_TIME_FORMAT])¶ Create a list of time slot options for use in swingtime forms.
The list is comprised of 2-tuples containing a 24-hour time value and a 12-hour temporal representation of that offset.
timeslot_offset_options¶
-
forms.timeslot_offset_options([interval=swingtime_settings.TIMESLOT_INTERVAL, start_time=swingtime_settings.TIMESLOT_START_TIME, end_delta=swingtime_settings.TIMESLOT_END_TIME_DURATION, fmt=swingtime_settings.TIMESLOT_TIME_FORMAT])¶ Create a list of time slot options for use in swingtime forms.
The list is comprised of 2-tuples containing the number of seconds since the start of the day and a 12-hour temporal representation of that offset.
Data¶
Classes¶
MultipleIntegerField¶
-
class
forms.MultipleIntegerField(django.forms.MultipleChoiceField)¶ A form field for handling multiple integers.
- def __init__(self, choices, size=None, label=None, widget=None):
- if widget is None:
- widget = forms.SelectMultiple(attrs={‘size’ : size or len(choices)})
SplitDateTimeWidget¶
MultipleOccurrenceForm¶
-
class
forms.MultipleOccurrenceForm(django.forms.Form)¶ -
day¶ forms.DateField
-
start_time_delta¶ forms.IntegerField
-
end_time_delta¶ forms.IntegerField
-
repeats¶ forms.ChoiceField
-
count¶ forms.IntegerField
-
until¶ forms.DateField
-
freq¶ forms.IntegerField
-
interval¶ forms.IntegerField
-
week_days¶ MultipleIntegerField
-
month_ordinal¶ forms.IntegerField
-
month_ordinal_day¶ forms.IntegerField
-
each_month_day = MultipleIntegerField(
-
year_months¶ MultipleIntegerField
-
is_year_month_ordinal¶ forms.BooleanField(required=False)
-
year_month_ordinal¶ forms.IntegerField(widget=forms.Select(choices=ORDINAL))
-
year_month_ordinal_day¶ forms.IntegerField(widget=forms.Select(choices=WEEKDAY_LONG))
-
__init__([*args, **kws])¶ if
initialcontainsdtstart- adatetime.datetimeinstance - the appropriate unspecifiedinitialwill be defaulted for the form.
-
clean()¶ populates
cleaned_datawithstart_timeandend_timevalues
-
save(event): Returns an
Eventobject
-