Bulk creation for event series dates (#848)

* copy-from things

* Some frontend

* rrule UI

* .

* Fixes

* UI improvements

* First test

* Tests
This commit is contained in:
Raphael Michel
2018-04-03 18:21:27 +02:00
committed by GitHub
parent 8564f93706
commit 7939503a11
15 changed files with 3820 additions and 21 deletions

View File

@@ -82,7 +82,6 @@ class RelativeDateWrapper:
new_date = new_date.astimezone(tz)
newoffset = new_date.utcoffset()
new_date += oldoffset - newoffset
return new_date
def to_string(self) -> str:
@@ -154,6 +153,11 @@ class RelativeDateTimeField(forms.MultiValueField):
('absolute', _('Fixed date:')),
('relative', _('Relative date:')),
]
if kwargs.get('limit_choices'):
limit = kwargs.pop('limit_choices')
choices = [(k, v) for k, v in BASE_CHOICES if k in limit]
else:
choices = BASE_CHOICES
if not kwargs.get('required', True):
status_choices.insert(0, ('unset', _('Not set')))
fields = (
@@ -168,7 +172,7 @@ class RelativeDateTimeField(forms.MultiValueField):
required=False
),
forms.ChoiceField(
choices=BASE_CHOICES,
choices=choices,
required=False
),
forms.TimeField(
@@ -176,7 +180,7 @@ class RelativeDateTimeField(forms.MultiValueField):
),
)
if 'widget' not in kwargs:
kwargs['widget'] = RelativeDateTimeWidget(status_choices=status_choices, base_choices=BASE_CHOICES)
kwargs['widget'] = RelativeDateTimeWidget(status_choices=status_choices, base_choices=choices)
kwargs.pop('max_length', 0)
kwargs.pop('empty_value', 0)
super().__init__(