misc: add a description field to events (#36169)
This commit is contained in:
parent
42a0998033
commit
a0da57e0f3
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.12 on 2019-09-17 06:36
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('agendas', '0026_booking_user_display_label'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='event',
|
||||
name='description',
|
||||
field=models.TextField(blank=True, help_text='Optional event description.', null=True, verbose_name='Description'),
|
||||
),
|
||||
]
|
|
@ -289,6 +289,8 @@ class Event(models.Model):
|
|||
_('Places in waiting list'), default=0)
|
||||
label = models.CharField(_('Label'), max_length=150, null=True, blank=True,
|
||||
help_text=_('Optional label to identify this date.'))
|
||||
description = models.TextField(_('Description'), null=True, blank=True,
|
||||
help_text=_('Optional event description.'))
|
||||
full = models.BooleanField(default=False)
|
||||
meeting_type = models.ForeignKey(MeetingType, null=True)
|
||||
desk = models.ForeignKey('Desk', null=True)
|
||||
|
|
|
@ -187,6 +187,7 @@ class Datetimes(APIView):
|
|||
response = {'data': [{'id': x.id,
|
||||
'text': force_text(x),
|
||||
'datetime': format_response_datetime(x.start_datetime),
|
||||
'description': x.description,
|
||||
'disabled': bool(x.full),
|
||||
'api': {
|
||||
'fillslot_url': request.build_absolute_uri(
|
||||
|
|
|
@ -189,6 +189,14 @@ def test_datetimes_api(app, some_data):
|
|||
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug)
|
||||
assert len(resp.json['data']) == 2
|
||||
check_bookability(resp.json['data'])
|
||||
assert resp.json['data'][0]['description'] is None
|
||||
|
||||
# add description to events
|
||||
for i, event in enumerate(agenda.event_set.all()):
|
||||
event.description = 'Description %s' % i
|
||||
event.save()
|
||||
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug)
|
||||
assert resp.json['data'][0]['description']
|
||||
|
||||
def test_datetimes_api_wrong_kind(app, some_data):
|
||||
agenda = Agenda.objects.filter(label=u'Foo bar')[0]
|
||||
|
|
|
@ -336,6 +336,18 @@ 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'] = '%s-02-15 18:00' % year
|
||||
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'
|
||||
|
||||
|
||||
def test_add_event_on_missing_agenda(app, admin_user):
|
||||
app = login(app)
|
||||
app.get('/manage/agendas/%s/add-event' % '999', status=404)
|
||||
|
|
Loading…
Reference in New Issue