Fix subscription form

This commit is contained in:
Skia 2016-09-02 12:29:50 +02:00
parent bae34c4b1c
commit a0b1fa32e7
5 changed files with 95 additions and 87 deletions

Binary file not shown.

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-01 16:54+0200\n"
"POT-Creation-Date: 2016-09-02 12:26+0200\n"
"PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n"
@ -134,7 +134,7 @@ msgid "comment"
msgstr "commentaire"
#: accounting/models.py:181 counter/models.py:204 counter/models.py:247
#: subscription/models.py:53
#: subscription/models.py:57
msgid "payment method"
msgstr "méthode de paiement"
@ -162,8 +162,7 @@ msgstr "type comptable"
msgid "target type"
msgstr "type de cible"
#: accounting/models.py:190 club/templates/club/club_detail.jinja:21
#: club/templates/club/club_members.jinja:8
#: accounting/models.py:190 club/templates/club/club_members.jinja:8
#: launderette/templates/launderette/launderette_admin.jinja:44
msgid "User"
msgstr "Utilisateur"
@ -180,7 +179,7 @@ msgstr "Compte"
msgid "Company"
msgstr "Entreprise"
#: accounting/models.py:190 sith/settings.py:283 sith/settings_sample.py:272
#: accounting/models.py:190 sith/settings.py:287 sith/settings_sample.py:272
msgid "Other"
msgstr "Autre"
@ -304,6 +303,7 @@ msgid "Delete"
msgstr "Supprimer"
#: accounting/templates/accounting/bank_account_details.jinja:17
#: club/templates/club/club_base.jinja:11
#: core/templates/core/user_base.jinja:12
msgid "Infos"
msgstr "Infos"
@ -324,7 +324,7 @@ msgstr "Nouveau compte club"
#: accounting/templates/accounting/bank_account_list.jinja:21
#: accounting/templates/accounting/club_account_details.jinja:53
#: accounting/templates/accounting/journal_details.jinja:66
#: club/templates/club/club_detail.jinja:8 core/templates/core/file.jinja:38
#: club/templates/club/club_base.jinja:34 core/templates/core/file.jinja:38
#: core/templates/core/page.jinja:31 core/templates/core/user_base.jinja:33
#: core/templates/core/user_tools.jinja:33
#: counter/templates/counter/counter_list.jinja:20
@ -490,7 +490,7 @@ msgstr "Éditer l'opération"
#: core/templates/core/file_edit.jinja:8 core/templates/core/page_prop.jinja:8
#: core/templates/core/pagerev_edit.jinja:24
#: counter/templates/counter/cash_register_summary.jinja:22
#: subscription/templates/subscription/subscription.jinja:22
#: subscription/templates/subscription/subscription.jinja:23
msgid "Save"
msgstr "Sauver"
@ -566,24 +566,19 @@ msgstr "L'utilisateur est déjà membre de ce club"
msgid "past member"
msgstr "Anciens membres"
#: club/templates/club/club_detail.jinja:6
#: core/templates/core/group_edit.jinja:4
msgid "Back to list"
msgstr "Retour à la liste"
#: club/templates/club/club_detail.jinja:11 core/templates/core/file.jinja:41
#: core/templates/core/page.jinja:34
msgid "Prop"
msgstr "Propriétés"
#: club/templates/club/club_detail.jinja:15
#: club/templates/club/club_base.jinja:18
msgid "Members"
msgstr "Membres"
#: club/templates/club/club_detail.jinja:22
#: club/templates/club/club_members.jinja:9
msgid "Role"
msgstr "Rôle"
#: club/templates/club/club_base.jinja:26 core/templates/core/base.jinja:25
#: core/templates/core/user_base.jinja:19
msgid "Tools"
msgstr "Outils"
#: club/templates/club/club_base.jinja:42
#: counter/templates/counter/counter_list.jinja:23
msgid "Props"
msgstr "Propriétés"
#: club/templates/club/club_edit.jinja:4
msgid "Edit club"
@ -610,7 +605,15 @@ msgstr "Il n'y a pas de club dans ce site web."
msgid "Club members"
msgstr "Membres du club"
#: club/templates/club/club_members.jinja:23
#: club/templates/club/club_members.jinja:9
msgid "Role"
msgstr "Rôle"
#: club/templates/club/club_members.jinja:10
msgid "Description"
msgstr "Description"
#: club/templates/club/club_members.jinja:25
#: core/templates/core/file_detail.jinja:19 launderette/views.py:146
msgid "Add"
msgstr "Ajouter"
@ -620,15 +623,15 @@ msgstr "Ajouter"
msgid "Club tools"
msgstr "Outils club"
#: club/templates/club/club_tools.jinja:8
#: club/templates/club/club_tools.jinja:7
msgid "Counters:"
msgstr "Comptoirs : "
#: club/templates/club/club_tools.jinja:19
#: club/templates/club/club_tools.jinja:18
msgid "Accouting: "
msgstr "Comptabilité : "
#: club/templates/club/club_tools.jinja:27
#: club/templates/club/club_tools.jinja:26
msgid "Manage launderettes"
msgstr "Gestion des laveries"
@ -1049,10 +1052,6 @@ msgstr "Connexion"
msgid "Register"
msgstr "S'enregister"
#: core/templates/core/base.jinja:25 core/templates/core/user_base.jinja:19
msgid "Tools"
msgstr "Outils"
#: core/templates/core/base.jinja:26
msgid "Logout"
msgstr "Déconnexion"
@ -1154,6 +1153,10 @@ msgstr "Non trouvé"
msgid "My files"
msgstr "Mes fichiers"
#: core/templates/core/file.jinja:41 core/templates/core/page.jinja:34
msgid "Prop"
msgstr "Propriétés"
#: core/templates/core/file_detail.jinja:13
msgid "Owner: "
msgstr "Propriétaire : "
@ -1186,6 +1189,10 @@ msgstr "Télécharger"
msgid "There is no file in this website."
msgstr "Il n'y a pas de fichier sur ce site web."
#: core/templates/core/group_edit.jinja:4
msgid "Back to list"
msgstr "Retour à la liste"
#: core/templates/core/group_edit.jinja:5
msgid "Edit group"
msgstr "Éditer le groupe"
@ -1658,7 +1665,7 @@ msgstr "Ajouter un nouveau dossier"
msgid "Error creating folder %(folder_name)s: %(msg)s"
msgstr "Erreur de création du dossier %(folder_name)s : %(msg)s"
#: core/views/files.py:61 core/views/forms.py:171 core/views/forms.py:175
#: core/views/files.py:61 core/views/forms.py:172 core/views/forms.py:176
#, python-format
msgid "Error uploading file %(file_name)s: %(msg)s"
msgstr "Erreur d'envoie du fichier %(file_name)s : %(msg)s"
@ -1671,11 +1678,11 @@ msgstr "Choisir un fichier"
msgid "Choose user"
msgstr "Choisir un utilisateur"
#: core/views/forms.py:88
#: core/views/forms.py:89
msgid "Username, email, or account number"
msgstr "Nom d'utilisateur, email, ou numéro de compte AE"
#: core/views/forms.py:130
#: core/views/forms.py:131
msgid ""
"Profile: you need to be visible on the picture, in order to be recognized (e."
"g. by the barmen)"
@ -1683,15 +1690,15 @@ msgstr ""
"Photo de profil: vous devez être visible sur la photo afin d'être reconnu "
"(par exemple par les barmen)"
#: core/views/forms.py:131
#: core/views/forms.py:132
msgid "Avatar: used on the forum"
msgstr "Avatar : utilisé sur le forum"
#: core/views/forms.py:132
#: core/views/forms.py:133
msgid "Scrub: let other know how your scrub looks like!"
msgstr "Blouse : montrez aux autres à quoi ressemble votre blouse !"
#: core/views/forms.py:176
#: core/views/forms.py:177
msgid "Bad image format, only jpeg, png, and gif are accepted"
msgstr "Mauvais format d'image, seuls les jpeg, png, et gif sont acceptés"
@ -1775,7 +1782,7 @@ msgstr "Bureau"
#: eboutic/templates/eboutic/eboutic_main.jinja:24
#: eboutic/templates/eboutic/eboutic_makecommand.jinja:8
#: eboutic/templates/eboutic/eboutic_payment_result.jinja:4
#: sith/settings.py:282 sith/settings.py:290 sith/settings_sample.py:271
#: sith/settings.py:286 sith/settings.py:294 sith/settings_sample.py:271
#: sith/settings_sample.py:279
msgid "Eboutic"
msgstr "Eboutic"
@ -1813,8 +1820,8 @@ msgstr "quantité"
msgid "Sith account"
msgstr "Compte utilisateur"
#: counter/models.py:248 sith/settings.py:275 sith/settings.py:280
#: sith/settings.py:302 sith/settings_sample.py:264
#: counter/models.py:248 sith/settings.py:279 sith/settings.py:284
#: sith/settings.py:306 sith/settings_sample.py:264
#: sith/settings_sample.py:269 sith/settings_sample.py:291
msgid "Credit card"
msgstr "Carte bancaire"
@ -1917,10 +1924,6 @@ msgstr "Liste des comptoirs"
msgid "New counter"
msgstr "Nouveau comptoir"
#: counter/templates/counter/counter_list.jinja:23
msgid "Props"
msgstr "Propriétés"
#: counter/templates/counter/counter_list.jinja:29
msgid "There is no counters in this website."
msgstr "Il n'y a pas de comptoirs dans ce site web."
@ -2228,12 +2231,12 @@ msgid "Washing and drying"
msgstr "Lavage et séchage"
#: launderette/templates/launderette/launderette_book.jinja:26
#: sith/settings.py:416 sith/settings_sample.py:405
#: sith/settings.py:420 sith/settings_sample.py:405
msgid "Washing"
msgstr "Lavage"
#: launderette/templates/launderette/launderette_book.jinja:30
#: sith/settings.py:416 sith/settings_sample.py:405
#: sith/settings.py:420 sith/settings_sample.py:405
msgid "Drying"
msgstr "Séchage"
@ -2288,120 +2291,116 @@ msgstr "L'utilisateur n'a pas réservé de créneau"
msgid "Token not found"
msgstr "Jeton non trouvé"
#: sith/settings.py:170 sith/settings_sample.py:160
#: sith/settings.py:174 sith/settings_sample.py:160
msgid "English"
msgstr "Anglais"
#: sith/settings.py:171 sith/settings_sample.py:161
#: sith/settings.py:175 sith/settings_sample.py:161
msgid "French"
msgstr "Français"
#: sith/settings.py:272 sith/settings.py:279 sith/settings.py:300
#: sith/settings.py:276 sith/settings.py:283 sith/settings.py:304
#: sith/settings_sample.py:261 sith/settings_sample.py:268
#: sith/settings_sample.py:289
msgid "Check"
msgstr "Chèque"
#: sith/settings.py:273 sith/settings.py:281 sith/settings.py:301
#: sith/settings.py:277 sith/settings.py:285 sith/settings.py:305
#: sith/settings_sample.py:262 sith/settings_sample.py:270
#: sith/settings_sample.py:290
msgid "Cash"
msgstr "Espèces"
#: sith/settings.py:274 sith/settings_sample.py:263
#: sith/settings.py:278 sith/settings_sample.py:263
msgid "Transfert"
msgstr "Virement"
#: sith/settings.py:287 sith/settings_sample.py:276
#: sith/settings.py:291 sith/settings_sample.py:276
msgid "Belfort"
msgstr "Belfort"
#: sith/settings.py:288 sith/settings_sample.py:277
#: sith/settings.py:292 sith/settings_sample.py:277
msgid "Sevenans"
msgstr "Sevenans"
#: sith/settings.py:289 sith/settings_sample.py:278
#: sith/settings.py:293 sith/settings_sample.py:278
msgid "Montbéliard"
msgstr "Montbéliard"
#: sith/settings.py:329 sith/settings_sample.py:318
#: sith/settings.py:333 sith/settings_sample.py:318
msgid "One semester"
msgstr "Un semestre, 15 €"
#: sith/settings.py:334 sith/settings_sample.py:323
#: sith/settings.py:338 sith/settings_sample.py:323
msgid "Two semesters"
msgstr "Deux semestres, 28 €"
#: sith/settings.py:339 sith/settings_sample.py:328
#: sith/settings.py:343 sith/settings_sample.py:328
msgid "Common core cursus"
msgstr "Cursus tronc commun, 45 €"
#: sith/settings.py:344 sith/settings_sample.py:333
#: sith/settings.py:348 sith/settings.py:353 sith/settings_sample.py:333
#: sith/settings_sample.py:338
msgid "Branch cursus"
msgstr "Cursus branche, 45 €"
#: sith/settings.py:349
msgid "Alternating cursus"
msgstr "Cursus alternant, 30 €"
#: sith/settings.py:354 sith/settings_sample.py:343
#: sith/settings.py:358 sith/settings_sample.py:343
msgid "Honorary member"
msgstr "Membre honoraire, 0 €"
#: sith/settings.py:359 sith/settings_sample.py:348
#: sith/settings.py:363 sith/settings_sample.py:348
msgid "Assidu member"
msgstr "Membre d'Assidu, 0 €"
#: sith/settings.py:364 sith/settings_sample.py:353
#: sith/settings.py:368 sith/settings_sample.py:353
msgid "Amicale/DOCEO member"
msgstr "Membre de l'Amicale/DOCEO, 0 €"
#: sith/settings.py:369 sith/settings_sample.py:358
#: sith/settings.py:373 sith/settings_sample.py:358
msgid "UT network member"
msgstr "Cotisant du réseau UT, 0 €"
#: sith/settings.py:374 sith/settings_sample.py:363
#: sith/settings.py:378 sith/settings_sample.py:363
msgid "CROUS member"
msgstr "Membres du CROUS, 0 €"
#: sith/settings.py:379 sith/settings_sample.py:368
#: sith/settings.py:383 sith/settings_sample.py:368
msgid "Sbarro/ESTA member"
msgstr "Membre de Sbarro ou de l'ESTA, 15 €"
#: sith/settings.py:387 sith/settings_sample.py:376
#: sith/settings.py:391 sith/settings_sample.py:376
msgid "President"
msgstr "Président"
#: sith/settings.py:388 sith/settings_sample.py:377
#: sith/settings.py:392 sith/settings_sample.py:377
msgid "Vice-President"
msgstr "Vice-Président"
#: sith/settings.py:389 sith/settings_sample.py:378
#: sith/settings.py:393 sith/settings_sample.py:378
msgid "Treasurer"
msgstr "Trésorier"
#: sith/settings.py:390 sith/settings_sample.py:379
#: sith/settings.py:394 sith/settings_sample.py:379
msgid "Communication supervisor"
msgstr "Responsable com"
#: sith/settings.py:391 sith/settings_sample.py:380
#: sith/settings.py:395 sith/settings_sample.py:380
msgid "Secretary"
msgstr "Secrétaire"
#: sith/settings.py:392 sith/settings_sample.py:381
#: sith/settings.py:396 sith/settings_sample.py:381
msgid "IT supervisor"
msgstr "Responsable info"
#: sith/settings.py:393 sith/settings_sample.py:382
#: sith/settings.py:397 sith/settings_sample.py:382
msgid "Board member"
msgstr "Membre du bureau"
#: sith/settings.py:394 sith/settings_sample.py:383
#: sith/settings.py:398 sith/settings_sample.py:383
msgid "Active member"
msgstr "Membre actif"
#: sith/settings.py:395 sith/settings_sample.py:384
#: sith/settings.py:399 sith/settings_sample.py:384
msgid "Curious"
msgstr "Curieux"
@ -2413,35 +2412,41 @@ msgstr "Mauvais type de cotisation"
msgid "Bad payment method"
msgstr "Mauvais type de paiement"
#: subscription/models.py:48
#: subscription/models.py:52
msgid "subscription type"
msgstr "type d'inscription"
#: subscription/models.py:51
#: subscription/models.py:55
msgid "subscription start"
msgstr "début de la cotisation"
#: subscription/models.py:52
#: subscription/models.py:56
msgid "subscription end"
msgstr "fin de la cotisation"
#: subscription/models.py:55
#: subscription/models.py:59
msgid "location"
msgstr "lieu"
#: subscription/models.py:64
#: subscription/models.py:68
msgid "You can not subscribe many time for the same period"
msgstr "Vous ne pouvez pas cotiser plusieurs fois pour la même période"
#: subscription/models.py:68
msgid "You are trying to create a subscription without member"
msgstr "Vous essayez de créer une cotisation sans membre"
#: subscription/models.py:72
msgid "Subscription error"
msgstr "Erreur de cotisation"
#: subscription/views.py:52
#: subscription/views.py:54
msgid "A user with that email address already exists"
msgstr "Un utilisateur avec cette adresse email existe déjà"
#: subscription/views.py:68
#: subscription/views.py:70
msgid "You must either choose an existing user or create a new one properly"
msgstr ""
"Vous devez soit choisir un utilisateur existant, ou en créer un proprement."
#~ msgid "Alternating cursus"
#~ msgstr "Cursus alternant, 30 €"
#~ msgid "You are trying to create a subscription without member"
#~ msgstr "Vous essayez de créer une cotisation sans membre"

View File

@ -69,7 +69,7 @@ class Subscription(models.Model):
except: # This should not happen, because the form should have handled the data before, but sadly, it still
# calls the model validation :'(
# TODO see SubscriptionForm's clean method
raise ValidationError(_("You are trying to create a subscription without member"))
raise ValidationError(_("Subscription error"))
def save(self):
super(Subscription, self).save()

View File

@ -9,6 +9,7 @@
<div id="user_info"></div>
<form action="" method="post" id="subscription_form">
{% csrf_token %}
{{ form.non_field_errors() }}
<p>{{ form.member.errors }}<label for="{{ form.member.name }}">{{ form.member.label }}</label> {{ form.member }}</p>
<div id="new_member">
<p>{{ form.first_name.errors }}<label for="{{ form.first_name.name }}">{{ form.first_name.label }}</label> {{ form.first_name }}</p>

View File

@ -48,6 +48,8 @@ class SubscriptionForm(forms.ModelForm):
and "first_name" not in self.errors.as_data()
and "email" not in self.errors.as_data()):
self.errors.pop("member", None)
if self.errors:
return cleaned_data
if Subscriber.objects.filter(email=cleaned_data.get("email")).first() is not None:
self.add_error("email", ValidationError(_("A user with that email address already exists")))
else: