manager: limit Event creation form height (#50420)
This commit is contained in:
parent
a11173e9ed
commit
57ee5b6369
|
@ -155,19 +155,11 @@ class CategoryEditForm(forms.ModelForm):
|
|||
class NewEventForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Event
|
||||
widgets = {
|
||||
'publication_date': forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d'),
|
||||
}
|
||||
fields = [
|
||||
'label',
|
||||
'start_datetime',
|
||||
'duration',
|
||||
'publication_date',
|
||||
'places',
|
||||
'waiting_list_places',
|
||||
'label',
|
||||
'description',
|
||||
'pricing',
|
||||
'url',
|
||||
]
|
||||
field_classes = {
|
||||
'start_datetime': SplitDateTimeField,
|
||||
|
@ -181,13 +173,13 @@ class EventForm(forms.ModelForm):
|
|||
'publication_date': forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d'),
|
||||
}
|
||||
fields = [
|
||||
'label',
|
||||
'slug',
|
||||
'start_datetime',
|
||||
'duration',
|
||||
'publication_date',
|
||||
'places',
|
||||
'waiting_list_places',
|
||||
'label',
|
||||
'slug',
|
||||
'description',
|
||||
'pricing',
|
||||
'url',
|
||||
|
|
|
@ -1210,20 +1210,6 @@ def test_add_event(app, admin_user):
|
|||
assert resp_datetimes.json['data'][0]['text'] == 'Feb. 15, %s, 5 p.m.' % year
|
||||
assert resp_datetimes.json['data'][0]['datetime'] == '%s-02-15 17:00:00' % year
|
||||
|
||||
# add with a description
|
||||
resp = app.get('/manage/agendas/%s/settings' % agenda.id, status=200)
|
||||
resp = resp.click('New Event')
|
||||
resp.form['start_datetime_0'] = '%s-02-15' % year
|
||||
resp.form['start_datetime_1'] = '18:00'
|
||||
resp.form['publication_date'] = '2020-05-11'
|
||||
resp.form['places'] = 11
|
||||
resp.form['description'] = 'A description'
|
||||
resp = resp.form.submit()
|
||||
resp = resp.follow()
|
||||
event = Event.objects.get(places=11)
|
||||
assert event.description == 'A description'
|
||||
assert event.publication_date == datetime.date(2020, 5, 11)
|
||||
|
||||
# add with errors in datetime parts
|
||||
for parts in (
|
||||
('', ''),
|
||||
|
@ -1302,11 +1288,13 @@ def test_edit_event(settings, app, admin_user):
|
|||
assert resp.form['start_datetime_1'].value == '17:00'
|
||||
assert resp.form['publication_date'].value == ''
|
||||
assert resp.form['duration'].value == ''
|
||||
assert resp.form['description'].value == ''
|
||||
resp.form['start_datetime_0'] = '2016-02-16'
|
||||
resp.form['start_datetime_1'] = '17:00'
|
||||
resp.form['publication_date'] = '2020-05-11'
|
||||
resp.form['duration'].value = 45
|
||||
resp.form['places'] = 20
|
||||
resp.form['description'] = 'A description'
|
||||
resp = resp.form.submit()
|
||||
settings.LANGUAGE_CODE = 'en'
|
||||
resp = resp.follow()
|
||||
|
@ -1317,6 +1305,7 @@ def test_edit_event(settings, app, admin_user):
|
|||
assert event.publication_date == datetime.date(2020, 5, 11)
|
||||
assert event.duration == 45
|
||||
assert event.end_datetime == event.start_datetime + datetime.timedelta(minutes=45)
|
||||
assert event.description == 'A description'
|
||||
|
||||
|
||||
def test_edit_missing_event(app, admin_user):
|
||||
|
|
Loading…
Reference in New Issue