manager: fix event edition with bad recurrence end date (#72196)
This commit is contained in:
parent
c48f849d39
commit
5e5b3c7596
|
@ -326,8 +326,10 @@ class EventForm(NewEventForm):
|
|||
|
||||
def clean(self):
|
||||
super().clean()
|
||||
if 'recurrence_end_date' in self.changed_data and self.instance.has_recurrences_booked(
|
||||
after=self.cleaned_data['recurrence_end_date']
|
||||
if (
|
||||
'recurrence_end_date' in self.changed_data
|
||||
and 'recurrence_end_date' in self.cleaned_data
|
||||
and self.instance.has_recurrences_booked(after=self.cleaned_data['recurrence_end_date'])
|
||||
):
|
||||
raise ValidationError(_('Bookings exist after this date.'))
|
||||
|
||||
|
|
|
@ -456,6 +456,10 @@ def test_edit_recurring_event(settings, app, admin_user, freezer):
|
|||
event_recurrence.refresh_from_db()
|
||||
assert event_recurrence.custom_fields == {'foo': 'bar'}
|
||||
|
||||
resp = app.get('/manage/agendas/%s/events/%s/edit' % (agenda.id, event.id))
|
||||
resp.form['recurrence_end_date'] = 'bad-date'
|
||||
resp = resp.form.submit() # no error
|
||||
|
||||
|
||||
def test_edit_recurring_event_with_end_date(settings, app, admin_user, freezer):
|
||||
freezer.move_to('2021-01-12 12:10')
|
||||
|
|
Loading…
Reference in New Issue