misc: add event duration in export and api (#56786)

This commit is contained in:
Valentin Deniaud 2021-09-08 12:24:15 +02:00
parent 128afc42a0
commit 246e14e7e4
4 changed files with 5 additions and 0 deletions

View File

@ -1542,6 +1542,7 @@ class Event(models.Model):
'description': self.description,
'url': self.url,
'pricing': self.pricing,
'duration': self.duration,
}
def duplicate(self, agenda_target=None):

View File

@ -469,6 +469,7 @@ def get_event_detail(
'description': event.description,
'pricing': event.pricing,
'url': event.url,
'duration': event.duration,
'disabled': is_event_disabled(event, min_places=min_places, disable_booked=disable_booked),
'api': {
'bookings_url': request.build_absolute_uri(

View File

@ -46,6 +46,7 @@ def test_status(app, user):
'pricing': None,
'url': None,
'disabled': False,
'duration': None,
'api': {
'bookings_url': 'http://testserver/api/agenda/foo-bar/bookings/event-slug/',
'fillslot_url': 'http://testserver/api/agenda/foo-bar/fillslot/event-slug/',

View File

@ -186,6 +186,7 @@ def test_import_export_event_details(app):
publication_date=datetime.date(2020, 5, 11),
places=42,
start_datetime=now(),
duration=30,
)
# check event (agenda, slug) unicity
agenda2 = Agenda.objects.create(label='Foo Bar 2', kind='events')
@ -214,6 +215,7 @@ def test_import_export_event_details(app):
assert first_imported_event.pricing == '100'
assert first_imported_event.url == 'https://example.net/'
assert first_imported_event.publication_date == datetime.date(2020, 5, 11)
assert first_imported_event.duration == 30
assert Agenda.objects.get(label='Foo Bar 2').event_set.first().slug == 'event'