Merge pull request #17 from toulibre/missingfields

Add missing fields in talk and participation form
This commit is contained in:
Élie Bouttier 2016-08-09 23:19:14 +02:00 committed by GitHub
commit 49d0712b26
10 changed files with 154 additions and 25 deletions

View File

@ -11,18 +11,24 @@ UserForm = modelform_factory(User, fields=['first_name', 'last_name', 'email', '
ProfileForm = modelform_factory(Profile, fields=['biography'])
ParticipationForm = modelform_factory(Participation, fields=['transport', 'connector', 'sound', 'videotaped',
'video_licence', 'constraints'],
ParticipationForm = modelform_factory(Participation,
fields=['need_transport', 'transport',
'need_hosting', 'homestay',
'connector', 'sound', 'videotaped',
'video_licence', 'constraints'],
widgets={'transport': forms.CheckboxSelectMultiple(),
'connector': forms.CheckboxSelectMultiple()},
help_texts = {
'constraints': _('For example, you need to be back on saturday evening, you cannot eat meat.'),
'constraints': _('For example, you need to be back on saturday evening, you cannot eat meat.'),
})
ProfileOrgaForm = modelform_factory(Profile, fields=['biography'])
ParticipationOrgaForm = modelform_factory(Participation,
fields=['transport', 'connector', 'sound', 'videotaped', 'video_licence',
fields=['need_transport', 'transport',
'need_hosting', 'homestay',
'connector', 'sound', 'videotaped',
'video_licence',
'constraints', 'notes', 'orga'],
widgets={'transport': forms.CheckboxSelectMultiple(),
'connector': forms.CheckboxSelectMultiple()})

View File

@ -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'),
),
]

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-08 22:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0007_auto_20160808_2145'),
]
operations = [
migrations.AddField(
model_name='participation',
name='homestay',
field=models.BooleanField(default=False, verbose_name='Ok for homestay?'),
),
migrations.AddField(
model_name='participation',
name='need_hosting',
field=models.BooleanField(default=False, verbose_name='Need hosting?'),
),
migrations.AddField(
model_name='participation',
name='need_transport',
field=models.BooleanField(default=False, verbose_name='Need transport?'),
),
]

View File

@ -49,14 +49,22 @@ class Participation(PonyConfModel):
site = models.ForeignKey(Site, on_delete=models.CASCADE)
user = models.ForeignKey(User)
need_transport = models.BooleanField(verbose_name=_('Need transport?'), default=False)
arrival = models.DateTimeField(blank=True, null=True)
departure = models.DateTimeField(blank=True, null=True)
transport = models.ManyToManyField(Transport, verbose_name=_("I'm ok to travel by"), blank=True)
connector = models.ManyToManyField(Connector, verbose_name=_("I can output"), blank=True)
need_hosting = models.BooleanField(verbose_name=_('Need hosting?'), default=False)
homestay = models.BooleanField(verbose_name=_('Ok for homestay?'), default=False)
constraints = models.TextField(blank=True, verbose_name=_("Constraints"))
connector = models.ManyToManyField(Connector, verbose_name=_("I can output"), blank=True)
sound = models.BooleanField(_("I need sound"), default=False)
videotaped = models.BooleanField(_("I'm ok to be recorded on video"), default=True)
video_licence = models.IntegerField(choices=enum_to_choices(LICENCES), default=1, verbose_name=_("Video licence"))
notes = models.TextField(default='', blank=True, verbose_name=_("Notes"))
orga = models.BooleanField(default=False)

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-07 21:51+0000\n"
"POT-Creation-Date: 2016-08-08 22:52+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -18,7 +18,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: accounts/forms.py:19
#: accounts/forms.py:22
msgid ""
"For example, you need to be back on saturday evening, you cannot eat meat."
msgstr ""
@ -29,31 +29,44 @@ msgstr ""
msgid "Biography"
msgstr "Biographie"
#: accounts/models.py:54
#: accounts/models.py:53
msgid "Need transport?"
msgstr "Besoin de défraiment pour le transport ?"
#: accounts/models.py:56
msgid "I'm ok to travel by"
msgstr "Jaccepte de voyager en"
#: accounts/models.py:55
msgid "I can output"
msgstr "Sortie vidéo"
#: accounts/models.py:58
msgid "Need hosting?"
msgstr "Besoin d'un hébergement ?"
#: accounts/models.py:56
#: accounts/models.py:59
msgid "Ok for homestay?"
msgstr "Ok pour un logement chez l'habitant ?"
#: accounts/models.py:61
msgid "Constraints"
msgstr "Contraintes"
#: accounts/models.py:57
#: accounts/models.py:62
msgid "I can output"
msgstr "Sortie vidéo"
#: accounts/models.py:63
msgid "I need sound"
msgstr "Jai besoin de son"
#: accounts/models.py:58
#: accounts/models.py:65
msgid "I'm ok to be recorded on video"
msgstr "Jaccepte dêtre enregistré en vidéo"
#: accounts/models.py:59
#: accounts/models.py:66
msgid "Video licence"
msgstr "Licence vidéo"
#: accounts/models.py:60 proposals/templates/proposals/user_details.html:19
#: accounts/models.py:68 proposals/models.py:60
#: proposals/templates/proposals/user_details.html:19
msgid "Notes"
msgstr "Notes"
@ -225,7 +238,7 @@ msgstr "Accueil"
msgid "Talks"
msgstr "Exposés"
#: ponyconf/templates/base.html:48 proposals/models.py:58
#: ponyconf/templates/base.html:48 proposals/models.py:59
#: proposals/templates/proposals/topic_list.html:9
msgid "Topics"
msgstr "Thèmes"
@ -242,11 +255,19 @@ msgstr "Sinscrire"
msgid "Powered by"
msgstr "Propulsé par"
#: proposals/forms.py:22
msgid "Should be less than 255 characters"
msgstr "Text court, moins de 255 caractères"
#: proposals/forms.py:23
msgid "If you want to say some precisions to organizers."
msgstr "Si vous souhaitez apporter des précisions à l'équipe d'organisation."
#: proposals/models.py:31
msgid "Name"
msgstr "Nom"
#: proposals/models.py:33 proposals/models.py:57
#: proposals/models.py:33 proposals/models.py:58
msgid "Description"
msgstr "Description"
@ -258,7 +279,11 @@ msgstr "Responsables"
msgid "Title"
msgstr "Titre"
#: proposals/models.py:59
#: proposals/models.py:57
msgid "Abstract"
msgstr "Résumé"
#: proposals/models.py:61
msgid "Format"
msgstr "Format"
@ -278,7 +303,7 @@ msgstr "Orateurs :"
#: proposals/templates/proposals/speaker_list.html:15
#: proposals/templates/proposals/topic_list.html:23
#: proposals/templates/proposals/topic_list.html:25
#: proposals/templates/proposals/topic_list.html:27
msgid "talk"
msgstr "exposé"
@ -340,7 +365,7 @@ msgstr "Ajouter un thème"
msgid "reviewer"
msgstr "Responsable"
#: proposals/templates/proposals/topic_list.html:29
#: proposals/templates/proposals/topic_list.html:33
msgid "No topics."
msgstr "Aucun thèmes."

View File

@ -1,6 +1,7 @@
from django.forms import CheckboxSelectMultiple, ModelForm
from django.forms.models import modelform_factory
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django_select2.forms import Select2TagWidget
@ -15,8 +16,12 @@ 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()}
help_texts = {
'abstract': _('Should be less than 255 characters'),
'notes': _('If you want to say some precisions to organizers.'),
}
class TopicCreateForm(ModelForm):

View File

@ -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'),
),
]

View File

@ -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)

View File

@ -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