From 377447d23bd9c7c82eb9408bb7bcb25347e4a9ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ABl=20Kervella?=
Date: Wed, 7 Mar 2018 16:02:31 +0000
Subject: [PATCH] Club : Add option to specify if a mailing should be generated
for
---
users/forms.py | 2 ++
users/migrations/0069_club_mailing.py | 20 ++++++++++++++++++++
users/models.py | 3 +++
users/templates/users/profil.html | 9 +++++++++
4 files changed, 34 insertions(+)
create mode 100644 users/migrations/0069_club_mailing.py
diff --git a/users/forms.py b/users/forms.py
index 861fd292..20121540 100644
--- a/users/forms.py
+++ b/users/forms.py
@@ -343,6 +343,7 @@ class ClubForm(FieldPermissionFormMixin, ModelForm):
self.fields['room'].label = 'Local'
self.fields['room'].empty_label = "Pas de chambre"
self.fields['school'].empty_label = "Séléctionner un établissement"
+ self.fields['mailing'].label = 'Utiliser une mailing'
class Meta:
model = Club
@@ -355,6 +356,7 @@ class ClubForm(FieldPermissionFormMixin, ModelForm):
'room',
'telephone',
'shell',
+ 'mailing'
]
def clean_telephone(self):
diff --git a/users/migrations/0069_club_mailing.py b/users/migrations/0069_club_mailing.py
new file mode 100644
index 00000000..17970494
--- /dev/null
+++ b/users/migrations/0069_club_mailing.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2018-03-07 15:34
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('users', '0068_auto_20180107_2245'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='club',
+ name='mailing',
+ field=models.BooleanField(default=False),
+ ),
+ ]
diff --git a/users/models.py b/users/models.py
index 785f853f..c15365de 100644
--- a/users/models.py
+++ b/users/models.py
@@ -850,6 +850,9 @@ class Club(User):
to='users.Adherent',
related_name='club_members'
)
+ mailing = models.BooleanField(
+ default = False
+ )
def can_create(user_request, *args, **kwargs):
"""Check if an user can create an user object.
diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html
index 53056e95..89296218 100644
--- a/users/templates/users/profil.html
+++ b/users/templates/users/profil.html
@@ -60,8 +60,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
+ {% if users.is_class_club %}
+ | Mailing |
+ {% if users.club.mailing %}
+ {{ users.pseudo }}(-admin) |
+ {% else %}
+ Mailing désactivée |
+ {% endif %}
+ {% else %}
Prénom |
{{ users.name }} |
+ {% endif %}
Nom |
{{ users.surname }} |