From 91240aca177324b632fc47e5e030d1557e91c36f Mon Sep 17 00:00:00 2001 From: numahell Date: Mon, 8 Aug 2016 23:54:05 +0200 Subject: [PATCH] Add abstract and notes field to talk model and form --- .../migrations/0007_auto_20160808_2145.py | 20 +++++++++++++++ proposals/forms.py | 2 +- .../migrations/0008_auto_20160808_2145.py | 25 +++++++++++++++++++ proposals/models.py | 2 ++ proposals/tests.py | 14 ++++++++--- 5 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 accounts/migrations/0007_auto_20160808_2145.py create mode 100644 proposals/migrations/0008_auto_20160808_2145.py diff --git a/accounts/migrations/0007_auto_20160808_2145.py b/accounts/migrations/0007_auto_20160808_2145.py new file mode 100644 index 0000000..4332c45 --- /dev/null +++ b/accounts/migrations/0007_auto_20160808_2145.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2016-08-08 21:45 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0006_auto_20160723_1216'), + ] + + operations = [ + migrations.AlterField( + model_name='participation', + name='constraints', + field=models.TextField(blank=True, verbose_name='Constraints'), + ), + ] diff --git a/proposals/forms.py b/proposals/forms.py index 7cad150..3af0ab8 100644 --- a/proposals/forms.py +++ b/proposals/forms.py @@ -15,7 +15,7 @@ class TalkForm(ModelForm): class Meta: model = Talk - fields = ['title', 'description', 'topics', 'event', 'speakers'] + fields = ['title', 'abstract', 'description', 'topics', 'notes', 'event', 'speakers'] widgets = {'topics': CheckboxSelectMultiple(), 'speakers': Select2TagWidget()} diff --git a/proposals/migrations/0008_auto_20160808_2145.py b/proposals/migrations/0008_auto_20160808_2145.py new file mode 100644 index 0000000..c9819c9 --- /dev/null +++ b/proposals/migrations/0008_auto_20160808_2145.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2016-08-08 21:45 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('proposals', '0007_conference'), + ] + + operations = [ + migrations.AddField( + model_name='talk', + name='abstract', + field=models.CharField(blank=True, max_length=255, verbose_name='Abstract'), + ), + migrations.AddField( + model_name='talk', + name='notes', + field=models.TextField(blank=True, verbose_name='Notes'), + ), + ] diff --git a/proposals/models.py b/proposals/models.py index f5f9c86..9f6bfa8 100644 --- a/proposals/models.py +++ b/proposals/models.py @@ -54,8 +54,10 @@ class Talk(PonyConfModel): speakers = models.ManyToManyField(User, verbose_name=_('Speakers')) title = models.CharField(max_length=128, verbose_name=_('Title')) slug = AutoSlugField(populate_from='title', unique=True) + abstract = models.CharField(max_length=255, blank=True, verbose_name=_('Abstract')) description = models.TextField(blank=True, verbose_name=_('Description')) topics = models.ManyToManyField(Topic, blank=True, verbose_name=_('Topics')) + notes = models.TextField(blank=True, verbose_name=_('Notes')) event = models.IntegerField(choices=enum_to_choices(EVENTS), default=EVENTS.conference_short.value, verbose_name=_('Format')) accepted = models.NullBooleanField(default=None) diff --git a/proposals/tests.py b/proposals/tests.py index 5687b8c..2904a78 100644 --- a/proposals/tests.py +++ b/proposals/tests.py @@ -18,11 +18,19 @@ class ProposalsTests(TestCase): def test_everything(self): # talk-edit self.client.login(username='a', password='a') - self.client.post(reverse('add-talk'), {'title': 'super talk', 'description': 'super', 'event': 1, 'topics': 1, - 'speakers': 1}) + self.client.post(reverse('add-talk'), + {'title': 'super talk', + 'abstract': 'super', + 'description': 'this is my super talk', + 'notes': 'you can watch my previous talk videos', + 'event': 1, + 'topics': 1, + 'speakers': 1}) talk = Talk.objects.first() self.assertEqual(str(talk), 'super talk') - self.assertEqual(talk.description, 'super') + self.assertEqual(talk.abstract, 'super') + self.assertEqual(talk.description, 'this is my super talk') + self.assertEqual(talk.notes, 'you can watch my previous talk videos') self.client.post(reverse('edit-talk', kwargs={'talk': 'super-talk'}), {'title': 'mega talk', 'description': 'mega', 'event': 1, 'speakers': 1}) self.assertEqual(str(talk), 'super talk') # title is read only there