From 78c015625359ccd609001a5e833422e107488913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Tue, 12 Jul 2016 14:07:23 +0200 Subject: [PATCH] notes on Participation instead of Profile --- accounts/forms.py | 4 ++-- .../migrations/0005_auto_20160712_1204.py | 24 +++++++++++++++++++ accounts/models.py | 2 +- accounts/tests.py | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 accounts/migrations/0005_auto_20160712_1204.py diff --git a/accounts/forms.py b/accounts/forms.py index 926ee7a..a5ce4bb 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -15,11 +15,11 @@ ParticipationForm = modelform_factory(Participation, fields=['transport', 'conne widgets={'transport': forms.CheckboxSelectMultiple(), 'connector': forms.CheckboxSelectMultiple()}) -ProfileOrgaForm = modelform_factory(Profile, fields=['biography', 'notes']) +ProfileOrgaForm = modelform_factory(Profile, fields=['biography']) ParticipationOrgaForm = modelform_factory(Participation, fields=['transport', 'connector', 'sound', 'videotaped', 'video_licence', - 'constraints', 'orga'], + 'constraints', 'notes', 'orga'], widgets={'transport': forms.CheckboxSelectMultiple(), 'connector': forms.CheckboxSelectMultiple()}) diff --git a/accounts/migrations/0005_auto_20160712_1204.py b/accounts/migrations/0005_auto_20160712_1204.py new file mode 100644 index 0000000..07dd063 --- /dev/null +++ b/accounts/migrations/0005_auto_20160712_1204.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-12 12:04 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0004_auto_20160710_2011'), + ] + + operations = [ + migrations.RemoveField( + model_name='profile', + name='notes', + ), + migrations.AddField( + model_name='participation', + name='notes', + field=models.TextField(blank=True, default=''), + ), + ] diff --git a/accounts/models.py b/accounts/models.py index 41bae67..d386913 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -15,7 +15,6 @@ class Profile(PonyConfModel): user = models.OneToOneField(User) biography = models.TextField(blank=True, verbose_name='Biography') email_token = models.CharField(max_length=12, default=generate_user_uid, unique=True) - notes = models.TextField(default='') def __str__(self): return self.user.get_full_name() or self.user.username @@ -57,6 +56,7 @@ class Participation(PonyConfModel): 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) + notes = models.TextField(default='', blank=True) orga = models.BooleanField(default=False) class Meta: diff --git a/accounts/tests.py b/accounts/tests.py index ba50f10..226d648 100644 --- a/accounts/tests.py +++ b/accounts/tests.py @@ -49,7 +49,7 @@ class AccountTests(TestCase): self.client.login(username='b', password='b') self.assertEqual(self.client.get(reverse('list-participant')).status_code, 403) self.assertEqual(self.client.post(reverse('edit-participant', kwargs={'username': 'a'}), - {'biography': 'foo', 'notes': 'bar'}).status_code, 403) + {'biography': 'foo'}).status_code, 403) b = User.objects.get(username='b') b.is_superuser = True b.save()