From 66fdf6cbf70054a8965ec930e796927b59dba797 Mon Sep 17 00:00:00 2001 From: Skia Date: Sun, 14 Aug 2016 19:28:14 +0200 Subject: [PATCH] Migrate and improve subscriptions --- .../migrations/0002_auto_20160814_1634.py | 19 +++ core/templates/core/user_account.jinja | 2 +- core/templates/core/user_edit.jinja | 2 +- core/templates/core/user_mini.jinja | 19 +++ core/urls.py | 1 + core/views/forms.py | 1 - core/views/user.py | 9 ++ counter/migrations/0003_auto_20160814_1634.py | 19 +++ counter/models.py | 2 +- .../launderette/launderette_main.jinja | 2 +- locale/fr/LC_MESSAGES/django.mo | Bin 27462 -> 27811 bytes locale/fr/LC_MESSAGES/django.po | 151 +++++++++++------- migrate.py | 94 ++++++++++- sith/settings_sample.py | 52 ++++-- .../migrations/0002_auto_20160814_1634.py | 24 +++ subscription/models.py | 3 +- .../templates/subscription/subscription.jinja | 36 ++++- subscription/views.py | 4 +- 18 files changed, 351 insertions(+), 89 deletions(-) create mode 100644 accounting/migrations/0002_auto_20160814_1634.py create mode 100644 core/templates/core/user_mini.jinja create mode 100644 counter/migrations/0003_auto_20160814_1634.py create mode 100644 subscription/migrations/0002_auto_20160814_1634.py diff --git a/accounting/migrations/0002_auto_20160814_1634.py b/accounting/migrations/0002_auto_20160814_1634.py new file mode 100644 index 00000000..6a281517 --- /dev/null +++ b/accounting/migrations/0002_auto_20160814_1634.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounting', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='operation', + name='mode', + field=models.CharField(verbose_name='payment method', max_length=255, choices=[('CHECK', 'Check'), ('CASH', 'Cash'), ('TRANSFERT', 'Transfert'), ('CARD', 'Credit card')]), + ), + ] diff --git a/core/templates/core/user_account.jinja b/core/templates/core/user_account.jinja index c36440fb..d3c94889 100644 --- a/core/templates/core/user_account.jinja +++ b/core/templates/core/user_account.jinja @@ -71,7 +71,7 @@ diff --git a/core/templates/core/user_edit.jinja b/core/templates/core/user_edit.jinja index 2969f985..4135376a 100644 --- a/core/templates/core/user_edit.jinja +++ b/core/templates/core/user_edit.jinja @@ -28,7 +28,7 @@ {% endif %} {% if form.instance == user %}

{% trans %}Change my password{% endtrans %}

- {% elif user.is_root() %} + {% elif user.is_root %}

{% trans %}Change user password{% endtrans %}

{% endif %} diff --git a/core/templates/core/user_mini.jinja b/core/templates/core/user_mini.jinja new file mode 100644 index 00000000..1dcfacec --- /dev/null +++ b/core/templates/core/user_mini.jinja @@ -0,0 +1,19 @@ +
+
+ {% if profile.profile_pict %} + {% trans %}Profile{% endtrans %} + {% endif %} +
+

{{ profile.get_full_name() }}

+ {% if profile.nick_name %} +

« {{ profile.nick_name }} »

+ {% endif %} + {% if profile.date_of_birth %} +

{% trans %}Born: {% endtrans %}{{ profile.date_of_birth|date("d/m/Y") }}

+ {% endif %} + {% if profile.promo %} +

Promo {{ profile.promo }} + {% trans %}Promo: {% endtrans %}{{ profile.promo }}

+ {% endif %} +
+ diff --git a/core/urls.py b/core/urls.py index e3a2331b..14aedbc2 100644 --- a/core/urls.py +++ b/core/urls.py @@ -25,6 +25,7 @@ urlpatterns = [ # User views url(r'^user/$', UserListView.as_view(), name='user_list'), + url(r'^user/(?P[0-9]+)/mini$', UserMiniView.as_view(), name='user_profile_mini'), url(r'^user/(?P[0-9]+)/$', UserView.as_view(), name='user_profile'), url(r'^user/(?P[0-9]+)/edit$', UserUpdateProfileView.as_view(), name='user_edit'), url(r'^user/(?P[0-9]+)/groups$', UserUpdateGroupView.as_view(), name='user_groups'), diff --git a/core/views/forms.py b/core/views/forms.py index 92254d67..56a14425 100644 --- a/core/views/forms.py +++ b/core/views/forms.py @@ -50,7 +50,6 @@ class SelectFile(TextInput): 'name': name, } output += '' + _("Choose file") + '' - print(output) return output # Forms diff --git a/core/views/user.py b/core/views/user.py index 3bff6535..b45f25fd 100644 --- a/core/views/user.py +++ b/core/views/user.py @@ -121,6 +121,15 @@ class UserView(CanViewMixin, DetailView): context_object_name = "profile" template_name = "core/user_detail.jinja" +class UserMiniView(CanViewMixin, DetailView): + """ + Display a user's profile + """ + model = User + pk_url_kwarg = "user_id" + context_object_name = "profile" + template_name = "core/user_mini.jinja" + class UserListView(ListView): """ Displays the user list diff --git a/counter/migrations/0003_auto_20160814_1634.py b/counter/migrations/0003_auto_20160814_1634.py new file mode 100644 index 00000000..7f0f86f0 --- /dev/null +++ b/counter/migrations/0003_auto_20160814_1634.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('counter', '0002_auto_20160810_1348'), + ] + + operations = [ + migrations.AlterField( + model_name='refilling', + name='payment_method', + field=models.CharField(verbose_name='payment method', default='cash', max_length=255, choices=[('CHECK', 'Check'), ('CASH', 'Cash')]), + ), + ] diff --git a/counter/models.py b/counter/models.py index dcc950b6..c9fa9829 100644 --- a/counter/models.py +++ b/counter/models.py @@ -30,7 +30,7 @@ class Customer(models.Model): ordering = ['account_id',] def __str__(self): - return self.user.username + return "%s - %s" % (self.user.username, self.account_id) def generate_account_id(number): number = str(number) diff --git a/launderette/templates/launderette/launderette_main.jinja b/launderette/templates/launderette/launderette_main.jinja index d3f7653e..6075cc31 100644 --- a/launderette/templates/launderette/launderette_main.jinja +++ b/launderette/templates/launderette/launderette_main.jinja @@ -5,7 +5,7 @@ {% endblock %} {% block content %} -{% if request.user.is_in_group(settings.SITH_GROUPS['launderette-admin']['name']) %} +{% if request.user.is_root %}

{% trans %}Edit presentation page{% endtrans %}

{% endif %} {% if request.user.is_in_group(settings.SITH_MAIN_MEMBERS_GROUP) %} diff --git a/locale/fr/LC_MESSAGES/django.mo b/locale/fr/LC_MESSAGES/django.mo index a21daa90f0dc0453eb3e3b242d80bdd09e943b19..f33d73d12bc5138919a7f4298be84324da7b4437 100644 GIT binary patch delta 10193 zcmZwMdwh@e|HtubHk&b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LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 57a9d329..95ba7aad 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-08-13 17:14+0200\n" +"POT-Creation-Date: 2016-08-14 16:36+0200\n" "PO-Revision-Date: 2016-07-18\n" "Last-Translator: Skia \n" "Language-Team: AE info \n" @@ -66,7 +66,7 @@ msgstr "montant effectif" msgid "number" msgstr "numéro" -#: accounting/models.py:154 core/models.py:403 core/models.py:679 +#: accounting/models.py:154 core/models.py:404 core/models.py:680 #: counter/models.py:209 counter/models.py:244 eboutic/models.py:13 #: eboutic/models.py:46 msgid "date" @@ -122,7 +122,7 @@ msgstr "Compte" msgid "Company" msgstr "Entreprise" -#: accounting/models.py:163 sith/settings.py:278 sith/settings_sample.py:268 +#: accounting/models.py:163 sith/settings.py:280 sith/settings_sample.py:266 msgid "Other" msgstr "Autre" @@ -766,113 +766,113 @@ msgstr "téléphone des parents" msgid "parent address" msgstr "adresse des parents" -#: core/models.py:253 +#: core/models.py:254 msgid "A user with that username already exists" msgstr "Un utilisateur de ce nom d'utilisateur existe déjà" -#: core/models.py:380 +#: core/models.py:381 msgid "Visitor" msgstr "Visiteur" -#: core/models.py:385 +#: core/models.py:386 msgid "define if we show a users stats" msgstr "Definit si l'on montre les statistiques de l'utilisateur" -#: core/models.py:387 +#: core/models.py:388 msgid "Show your account statistics to others" msgstr "Montrez vos statistiques de compte aux autres" -#: core/models.py:394 +#: core/models.py:395 msgid "file name" msgstr "nom du fichier" -#: core/models.py:395 core/models.py:528 +#: core/models.py:396 core/models.py:529 msgid "parent" msgstr "parent" -#: core/models.py:396 core/models.py:406 +#: core/models.py:397 core/models.py:407 msgid "file" msgstr "fichier" -#: core/models.py:397 +#: core/models.py:398 msgid "owner" msgstr "propriétaire" -#: core/models.py:398 core/models.py:534 +#: core/models.py:399 core/models.py:535 msgid "edit group" msgstr "groupe d'édition" -#: core/models.py:399 core/models.py:535 +#: core/models.py:400 core/models.py:536 msgid "view group" msgstr "groupe de vue" -#: core/models.py:400 +#: core/models.py:401 msgid "is folder" msgstr "est un dossier" -#: core/models.py:401 +#: core/models.py:402 msgid "mime type" msgstr "type mime" -#: core/models.py:402 +#: core/models.py:403 msgid "size" msgstr "taille" -#: core/models.py:432 +#: core/models.py:433 msgid "Character '/' not authorized in name" msgstr "Le caractère '/' n'est pas autorisé dans les noms de fichier" -#: core/models.py:435 core/models.py:440 +#: core/models.py:436 core/models.py:441 msgid "Loop in folder tree" msgstr "Boucle dans l'arborescence des dossiers" -#: core/models.py:444 +#: core/models.py:445 msgid "You can not make a file be a children of a non folder file" msgstr "" "Vous ne pouvez pas mettre un fichier enfant de quelque chose qui n'est pas " "un dossier" -#: core/models.py:448 +#: core/models.py:449 msgid "Duplicate file" msgstr "Un fichier de ce nom existe déjà" -#: core/models.py:458 +#: core/models.py:459 msgid "You must provide a file" msgstr "Vous devez fournir un fichier" -#: core/models.py:483 +#: core/models.py:484 msgid "Folder: " msgstr "Dossier : " -#: core/models.py:485 +#: core/models.py:486 msgid "File: " msgstr "Fichier : " -#: core/models.py:527 core/models.py:531 +#: core/models.py:528 core/models.py:532 msgid "page name" msgstr "nom de la page" -#: core/models.py:532 +#: core/models.py:533 msgid "owner group" msgstr "groupe propriétaire" -#: core/models.py:563 +#: core/models.py:564 msgid "Duplicate page" msgstr "Une page de ce nom existe déjà" -#: core/models.py:569 +#: core/models.py:570 msgid "Loop in page tree" msgstr "Boucle dans l'arborescence des pages" -#: core/models.py:676 +#: core/models.py:677 msgid "revision" msgstr "révision" -#: core/models.py:677 +#: core/models.py:678 msgid "page title" msgstr "titre de la page" -#: core/models.py:678 +#: core/models.py:679 msgid "page content" msgstr "contenu de la page" @@ -931,7 +931,7 @@ msgstr "Services" #: core/templates/core/base.jinja:55 msgid "Site made by good people" -msgstr "Site réalisé par des gens biens" +msgstr "Site réalisé par des gens bons" #: core/templates/core/create.jinja:4 #, python-format @@ -1411,7 +1411,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:62 core/views/forms.py:155 core/views/forms.py:159 +#: core/views/files.py:62 core/views/forms.py:154 core/views/forms.py:158 #, python-format msgid "Error uploading file %(file_name)s: %(msg)s" msgstr "Erreur d'envoie du fichier %(file_name)s : %(msg)s" @@ -1420,7 +1420,7 @@ msgstr "Erreur d'envoie du fichier %(file_name)s : %(msg)s" msgid "Choose file" msgstr "Choisir un fichier" -#: core/views/forms.py:114 +#: core/views/forms.py:113 msgid "" "Profile: you need to be visible on the picture, in order to be recognized (e." "g. by the barmen)" @@ -1428,15 +1428,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:115 +#: core/views/forms.py:114 msgid "Avatar: used on the forum" msgstr "Avatar : utilisé sur le forum" -#: core/views/forms.py:116 +#: core/views/forms.py:115 msgid "Scrub: let other know how your scrub looks like!" msgstr "Blouse : montrez aux autres à quoi ressemble votre blouse !" -#: core/views/forms.py:160 +#: core/views/forms.py:159 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" @@ -1491,6 +1491,7 @@ msgstr "Bureau" #: counter/models.py:110 eboutic/templates/eboutic/eboutic_main.jinja:20 #: eboutic/templates/eboutic/eboutic_makecommand.jinja:4 #: eboutic/templates/eboutic/eboutic_payment_result.jinja:4 +#: sith/settings.py:279 sith/settings_sample.py:265 msgid "Eboutic" msgstr "Eboutic" @@ -1676,7 +1677,8 @@ msgstr "ANN" msgid "You have not enough money to buy all the basket" msgstr "Vous n'avez pas assez d'argent pour acheter le panier" -#: eboutic/models.py:47 sith/settings.py:272 sith/settings_sample.py:262 +#: eboutic/models.py:47 sith/settings.py:272 sith/settings.py:277 +#: sith/settings_sample.py:258 sith/settings_sample.py:263 msgid "Credit card" msgstr "Carte banquaire" @@ -1824,12 +1826,12 @@ msgid "Washing and drying" msgstr "Lavage et séchage" #: launderette/templates/launderette/launderette_book.jinja:26 -#: sith/settings.py:360 sith/settings_sample.py:350 +#: sith/settings.py:398 sith/settings_sample.py:384 msgid "Washing" msgstr "Lavage" #: launderette/templates/launderette/launderette_book.jinja:30 -#: sith/settings.py:360 sith/settings_sample.py:350 +#: sith/settings.py:398 sith/settings_sample.py:384 msgid "Drying" msgstr "Séchage" @@ -1884,83 +1886,108 @@ msgstr "L'utilisateur n'a pas réservé de créneau" msgid "Token not found" msgstr "Jeton non trouvé" -#: sith/settings.py:269 sith/settings.py:276 sith/settings.py:294 -#: sith/settings_sample.py:259 sith/settings_sample.py:266 -#: sith/settings_sample.py:284 +#: sith/settings.py:269 sith/settings.py:276 sith/settings.py:296 +#: sith/settings_sample.py:255 sith/settings_sample.py:262 +#: sith/settings_sample.py:282 msgid "Check" msgstr "Chèque" -#: sith/settings.py:270 sith/settings.py:277 sith/settings.py:295 -#: sith/settings_sample.py:260 sith/settings_sample.py:267 -#: sith/settings_sample.py:285 +#: sith/settings.py:270 sith/settings.py:278 sith/settings.py:297 +#: sith/settings_sample.py:256 sith/settings_sample.py:264 +#: sith/settings_sample.py:283 msgid "Cash" msgstr "Espèces" -#: sith/settings.py:271 sith/settings_sample.py:261 +#: sith/settings.py:271 sith/settings_sample.py:257 msgid "Transfert" msgstr "Virement" -#: sith/settings.py:282 sith/settings_sample.py:272 +#: sith/settings.py:284 sith/settings_sample.py:270 msgid "Belfort" msgstr "Belfort" -#: sith/settings.py:283 sith/settings_sample.py:273 +#: sith/settings.py:285 sith/settings_sample.py:271 msgid "Sevenans" msgstr "Sevenans" -#: sith/settings.py:284 sith/settings_sample.py:274 +#: sith/settings.py:286 sith/settings_sample.py:272 msgid "Montbéliard" msgstr "Montbéliard" -#: sith/settings.py:308 sith/settings_sample.py:298 +#: sith/settings.py:311 sith/settings_sample.py:297 msgid "One semester" msgstr "Un semestre" -#: sith/settings.py:313 sith/settings_sample.py:303 +#: sith/settings.py:316 sith/settings_sample.py:302 msgid "Two semesters" msgstr "Deux semestres" -#: sith/settings.py:318 sith/settings_sample.py:308 +#: sith/settings.py:321 sith/settings_sample.py:307 msgid "Common core cursus" msgstr "Cursus tronc commun" -#: sith/settings.py:323 sith/settings_sample.py:313 +#: sith/settings.py:326 sith/settings.py:331 sith/settings_sample.py:312 +#: sith/settings_sample.py:317 msgid "Branch cursus" msgstr "Cursus branche" -#: sith/settings.py:331 sith/settings_sample.py:321 +#: sith/settings.py:336 sith/settings_sample.py:322 +msgid "Honorary member" +msgstr "Membre honoraire" + +#: sith/settings.py:341 sith/settings_sample.py:327 +msgid "Assidu member" +msgstr "Membre d'Assidu" + +#: sith/settings.py:346 sith/settings_sample.py:332 +msgid "Amicale/DOCEO member" +msgstr "Membre de l'Amicale/DOCEO" + +#: sith/settings.py:351 sith/settings_sample.py:337 +msgid "UT network member" +msgstr "Cotisant du réseau UT" + +#: sith/settings.py:356 sith/settings_sample.py:342 +msgid "CROUS member" +msgstr "Membres du CROUS" + +#: sith/settings.py:361 sith/settings_sample.py:347 +msgid "Sbarro/ESTA member" +msgstr "Membre de Sbarro ou de l'ESTA" + +#: sith/settings.py:369 sith/settings_sample.py:355 msgid "President" msgstr "Président" -#: sith/settings.py:332 sith/settings_sample.py:322 +#: sith/settings.py:370 sith/settings_sample.py:356 msgid "Vice-President" msgstr "Vice-Président" -#: sith/settings.py:333 sith/settings_sample.py:323 +#: sith/settings.py:371 sith/settings_sample.py:357 msgid "Treasurer" msgstr "Trésorier" -#: sith/settings.py:334 sith/settings_sample.py:324 +#: sith/settings.py:372 sith/settings_sample.py:358 msgid "Communication supervisor" msgstr "Responsable com" -#: sith/settings.py:335 sith/settings_sample.py:325 +#: sith/settings.py:373 sith/settings_sample.py:359 msgid "Secretary" msgstr "Secrétaire" -#: sith/settings.py:336 sith/settings_sample.py:326 +#: sith/settings.py:374 sith/settings_sample.py:360 msgid "IT supervisor" msgstr "Responsable info" -#: sith/settings.py:337 sith/settings_sample.py:327 +#: sith/settings.py:375 sith/settings_sample.py:361 msgid "Board member" msgstr "Membre du bureau" -#: sith/settings.py:338 sith/settings_sample.py:328 +#: sith/settings.py:376 sith/settings_sample.py:362 msgid "Active member" msgstr "Membre actif" -#: sith/settings.py:339 sith/settings_sample.py:329 +#: sith/settings.py:377 sith/settings_sample.py:363 msgid "Curious" msgstr "Curieux" diff --git a/migrate.py b/migrate.py index d110ef9e..dd615028 100644 --- a/migrate.py +++ b/migrate.py @@ -16,6 +16,8 @@ from django.db import connection from core.models import User, SithFile from club.models import Club, Membership +from counter.models import Customer +from subscription.models import Subscription, Subscriber db = MySQLdb.connect( host="ae-db", @@ -87,15 +89,15 @@ def migrate_users(): c.execute(""" SELECT * FROM utilisateurs utl - JOIN utl_etu ue + LEFT JOIN utl_etu ue ON ue.id_utilisateur = utl.id_utilisateur - JOIN utl_etu_utbm ueu + LEFT JOIN utl_etu_utbm ueu ON ueu.id_utilisateur = utl.id_utilisateur - JOIN utl_extra uxtra + LEFT JOIN utl_extra uxtra ON uxtra.id_utilisateur = utl.id_utilisateur - JOIN loc_ville ville + LEFT JOIN loc_ville ville ON utl.id_ville = ville.id_ville - -- WHERE utl.id_utilisateur > 9000 + -- WHERE utl.id_utilisateur = 9248 """) User.objects.filter(id__gt=0).delete() print("Users deleted") @@ -237,12 +239,88 @@ def migrate_club_memberships(): print("FAIL for club membership %s: %s" % (m['id_asso'], repr(e))) cur.close() +def migrate_subscriptions(): + LOCATION = { + 5: "SEVENANS", + 6: "BELFORT", + 9: "MONTBELIARD", + None: "SEVENANS", + } + TYPE = { + 0: 'un-semestre', + 1: 'deux-semestres', + 2: 'cursus-tronc-commun', + 3: 'cursus-branche', + 4: 'membre-honoraire', + 5: 'assidu', + 6: 'amicale/doceo', + 7: 'reseau-ut', + 8: 'crous', + 9: 'sbarro/esta', + 10: 'cursus-alternant', + None: 'un-semestre', + } + PAYMENT = { + 1: "CHECK", + 2: "CARD", + 3: "CASH", + 4: "OTHER", + 5: "EBOUTIC", + 0: "OTHER", + } + cur = db.cursor(MySQLdb.cursors.DictCursor) + cur.execute(""" + SELECT * + FROM ae_cotisations + """) + + Subscription.objects.all().delete() + print("Subscriptions deleted") + Customer.objects.all().delete() + print("Customers deleted") + for r in cur.fetchall(): + try: + user = Subscriber.objects.filter(id=r['id_utilisateur']).first() + if user: + new = Subscription( + id=r['id_cotisation'], + member=user, + subscription_start=r['date_cotis'], + subscription_end=r['date_fin_cotis'], + subscription_type=TYPE[r['type_cotis']], + payment_method=PAYMENT[r['mode_paiement_cotis']], + location=LOCATION[r['id_comptoir']], + ) + new.save() + except Exception as e: + print("FAIL for subscription %s: %s" % (r['id_cotisation'], repr(e))) + cur.close() + +def update_customer_account(): + cur = db.cursor(MySQLdb.cursors.DictCursor) + cur.execute(""" + SELECT * + FROM ae_carte carte + JOIN ae_cotisations cotis + ON carte.id_cotisation = cotis.id_cotisation + """) + for r in cur.fetchall(): + try: + user = Customer.objects.filter(user_id=r['id_utilisateur']).first() + if user: + user.account_id = str(r['id_carte_ae']) + r['cle_carteae'].lower() + user.save() + except Exception as e: + print("FAIL to update customer account for %s: %s" % (r['id_cotisation'], repr(e))) + cur.close() def main(): - # migrate_users() - # migrate_profile_pict() - # migrate_clubs() + migrate_users() + migrate_profile_pict() + migrate_clubs() migrate_club_memberships() + migrate_subscriptions() + update_customer_account() if __name__ == "__main__": main() diff --git a/sith/settings_sample.py b/sith/settings_sample.py index 4c2f5708..29ff73e3 100644 --- a/sith/settings_sample.py +++ b/sith/settings_sample.py @@ -243,10 +243,6 @@ SITH_GROUPS = { 'id': 5, 'name': "Counter admin", }, - 'launderette-admin': { - 'id': 6, - 'name': "Launderette admin", - }, } SITH_BOARD_SUFFIX="-bureau" @@ -256,15 +252,17 @@ SITH_MAIN_BOARD_GROUP=SITH_MAIN_CLUB['unix_name']+SITH_BOARD_SUFFIX SITH_MAIN_MEMBERS_GROUP=SITH_MAIN_CLUB['unix_name']+SITH_MEMBER_SUFFIX SITH_ACCOUNTING_PAYMENT_METHOD = [ - ('CHEQUE', _('Check')), + ('CHECK', _('Check')), ('CASH', _('Cash')), - ('TRANSFert', _('Transfert')), + ('TRANSFERT', _('Transfert')), ('CARD', _('Credit card')), ] SITH_SUBSCRIPTION_PAYMENT_METHOD = [ - ('CHEQUE', _('Check')), + ('CHECK', _('Check')), + ('CARD', _('Credit card')), ('CASH', _('Cash')), + ('EBOUTIC', _('Eboutic')), ('OTHER', _('Other')), ] @@ -281,7 +279,7 @@ SITH_COUNTER_BARS = [ ] SITH_COUNTER_PAYMENT_METHOD = [ - ('CHEQUE', _('Check')), + ('CHECK', _('Check')), ('CASH', _('Cash')), ] @@ -292,7 +290,8 @@ SITH_COUNTER_BANK = [ ('CREDIT-MUTUEL', 'Credit Mutuel'), ] -# Subscription durations are in semestres (should be settingized) +# Subscription durations are in semestres +# Be careful, modifying this parameter will need a migration to be applied SITH_SUBSCRIPTIONS = { 'un-semestre': { 'name': _('One semester'), @@ -314,6 +313,41 @@ SITH_SUBSCRIPTIONS = { 'price': 45, 'duration': 6, }, + 'cursus-alternant': { + 'name': _('Branch cursus'), + 'price': 30, + 'duration': 6, + }, + 'membre-honoraire': { + 'name': _('Honorary member'), + 'price': 0, + 'duration': 666, + }, + 'assidu': { + 'name': _('Assidu member'), + 'price': 0, + 'duration': 2, + }, + 'amicale/doceo': { + 'name': _('Amicale/DOCEO member'), + 'price': 0, + 'duration': 2, + }, + 'reseau-ut': { + 'name': _('UT network member'), + 'price': 0, + 'duration': 1, + }, + 'crous': { + 'name': _('CROUS member'), + 'price': 0, + 'duration': 2, + }, + 'sbarro/esta': { + 'name': _('Sbarro/ESTA member'), + 'price': 15, + 'duration': 2, + }, # To be completed.... } diff --git a/subscription/migrations/0002_auto_20160814_1634.py b/subscription/migrations/0002_auto_20160814_1634.py new file mode 100644 index 00000000..0c82cd2b --- /dev/null +++ b/subscription/migrations/0002_auto_20160814_1634.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('subscription', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='subscription', + name='payment_method', + field=models.CharField(verbose_name='payment method', max_length=255, choices=[('CHECK', 'Check'), ('CARD', 'Credit card'), ('CASH', 'Cash'), ('EBOUTIC', 'Eboutic'), ('OTHER', 'Other')]), + ), + migrations.AlterField( + model_name='subscription', + name='subscription_type', + field=models.CharField(verbose_name='subscription type', max_length=255, choices=[('amicale/doceo', 'Amicale/DOCEO member'), ('assidu', 'Assidu member'), ('crous', 'CROUS member'), ('cursus-alternant', 'Branch cursus'), ('cursus-branche', 'Branch cursus'), ('cursus-tronc-commun', 'Common core cursus'), ('deux-semestres', 'Two semesters'), ('membre-honoraire', 'Honorary member'), ('reseau-ut', 'UT network member'), ('sbarro/esta', 'Sbarro/ESTA member'), ('un-semestre', 'One semester')]), + ), + ] diff --git a/subscription/models.py b/subscription/models.py index 034dae81..8ed0f555 100644 --- a/subscription/models.py +++ b/subscription/models.py @@ -53,7 +53,8 @@ class Subscription(models.Model): super(Subscription, self).save() from counter.models import Customer if not Customer.objects.filter(user=self.member).exists(): - Customer(user=self.member, account_id=Customer.generate_account_id(self.id), amount=0).save() + last_id = Customer.objects.count() + 5195 # Number to keep a continuity with the old site + Customer(user=self.member, account_id=Customer.generate_account_id(last_id+1), amount=0).save() self.member.make_home() def get_absolute_url(self): diff --git a/subscription/templates/subscription/subscription.jinja b/subscription/templates/subscription/subscription.jinja index c68c0d2a..f0cb1173 100644 --- a/subscription/templates/subscription/subscription.jinja +++ b/subscription/templates/subscription/subscription.jinja @@ -6,9 +6,41 @@ {% block content %}

{% trans %}New subscription{% endtrans %}

-
+
+ {% csrf_token %} - {{ form.as_p() }} +

{{ form.member.errors }} {{ form.member }}

+
+

{{ form.last_name.errors }} {{ form.last_name }}

+

{{ form.first_name.errors }} {{ form.first_name }}

+

{{ form.email.errors }} {{ form.email }}

+
+

{{ form.subscription_type.errors }} {{ form.subscription_type }}

+

{{ form.payment_method.errors }} {{ + form.payment_method }}

+

{{ form.location.errors }} {{ form.location }}

{% endblock %} + +{% block script %} + {{ super() }} + +{% endblock %} diff --git a/subscription/views.py b/subscription/views.py index f9c1af45..2a681c42 100644 --- a/subscription/views.py +++ b/subscription/views.py @@ -63,8 +63,8 @@ class NewSubscription(CanEditMixin, CreateView): def get_initial(self): if 'member' in self.request.GET.keys(): - return {'member': self.request.GET['member']} - return {} + return {'member': self.request.GET['member'], 'subscription_type': 'deux-semestres'} + return {'subscription_type': 'deux-semestres'} def form_valid(self, form): form.instance.subscription_start = Subscription.compute_start(