mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 18:44:23 +00:00
Migrate and improve subscriptions
This commit is contained in:
parent
e1474c7a74
commit
66fdf6cbf7
19
accounting/migrations/0002_auto_20160814_1634.py
Normal file
19
accounting/migrations/0002_auto_20160814_1634.py
Normal file
@ -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')]),
|
||||||
|
),
|
||||||
|
]
|
@ -71,7 +71,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
{% for it in i.items.all() %}
|
{% for it in i.items.all() %}
|
||||||
<li>{{ it.product_name }} - {{ it.product_unit_price }} €</li>
|
<li>{{ it.quantity }} x {{ it.product_name }} - {{ it.product_unit_price }} €</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if form.instance == user %}
|
{% if form.instance == user %}
|
||||||
<p><a href="{{ url('core:password_change') }}">{% trans %}Change my password{% endtrans %}</a></p>
|
<p><a href="{{ url('core:password_change') }}">{% trans %}Change my password{% endtrans %}</a></p>
|
||||||
{% elif user.is_root() %}
|
{% elif user.is_root %}
|
||||||
<p><a href="{{ url('core:password_root_change', user_id=form.instance.id) }}">{% trans %}Change user password{% endtrans %}</a></p>
|
<p><a href="{{ url('core:password_root_change', user_id=form.instance.id) }}">{% trans %}Change user password{% endtrans %}</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
|
19
core/templates/core/user_mini.jinja
Normal file
19
core/templates/core/user_mini.jinja
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<div id="user_profile">
|
||||||
|
<div id="pictures">
|
||||||
|
{% if profile.profile_pict %}
|
||||||
|
<img src="{{ profile.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" />
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<p>{{ profile.get_full_name() }}</p>
|
||||||
|
{% if profile.nick_name %}
|
||||||
|
<p id="nickname">« {{ profile.nick_name }} »</p>
|
||||||
|
{% endif %}
|
||||||
|
{% if profile.date_of_birth %}
|
||||||
|
<p>{% trans %}Born: {% endtrans %}{{ profile.date_of_birth|date("d/m/Y") }}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% if profile.promo %}
|
||||||
|
<p><img src="{{ static('core/img/promo_%02d.png' % profile.promo) }}" alt="Promo {{ profile.promo }}" class="promo_pict" />
|
||||||
|
{% trans %}Promo: {% endtrans %}{{ profile.promo }}</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
@ -25,6 +25,7 @@ urlpatterns = [
|
|||||||
|
|
||||||
# User views
|
# User views
|
||||||
url(r'^user/$', UserListView.as_view(), name='user_list'),
|
url(r'^user/$', UserListView.as_view(), name='user_list'),
|
||||||
|
url(r'^user/(?P<user_id>[0-9]+)/mini$', UserMiniView.as_view(), name='user_profile_mini'),
|
||||||
url(r'^user/(?P<user_id>[0-9]+)/$', UserView.as_view(), name='user_profile'),
|
url(r'^user/(?P<user_id>[0-9]+)/$', UserView.as_view(), name='user_profile'),
|
||||||
url(r'^user/(?P<user_id>[0-9]+)/edit$', UserUpdateProfileView.as_view(), name='user_edit'),
|
url(r'^user/(?P<user_id>[0-9]+)/edit$', UserUpdateProfileView.as_view(), name='user_edit'),
|
||||||
url(r'^user/(?P<user_id>[0-9]+)/groups$', UserUpdateGroupView.as_view(), name='user_groups'),
|
url(r'^user/(?P<user_id>[0-9]+)/groups$', UserUpdateGroupView.as_view(), name='user_groups'),
|
||||||
|
@ -50,7 +50,6 @@ class SelectFile(TextInput):
|
|||||||
'name': name,
|
'name': name,
|
||||||
}
|
}
|
||||||
output += '<span name="' + name + '" class="choose_file_button">' + _("Choose file") + '</span>'
|
output += '<span name="' + name + '" class="choose_file_button">' + _("Choose file") + '</span>'
|
||||||
print(output)
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
# Forms
|
# Forms
|
||||||
|
@ -121,6 +121,15 @@ class UserView(CanViewMixin, DetailView):
|
|||||||
context_object_name = "profile"
|
context_object_name = "profile"
|
||||||
template_name = "core/user_detail.jinja"
|
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):
|
class UserListView(ListView):
|
||||||
"""
|
"""
|
||||||
Displays the user list
|
Displays the user list
|
||||||
|
19
counter/migrations/0003_auto_20160814_1634.py
Normal file
19
counter/migrations/0003_auto_20160814_1634.py
Normal file
@ -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')]),
|
||||||
|
),
|
||||||
|
]
|
@ -30,7 +30,7 @@ class Customer(models.Model):
|
|||||||
ordering = ['account_id',]
|
ordering = ['account_id',]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.user.username
|
return "%s - %s" % (self.user.username, self.account_id)
|
||||||
|
|
||||||
def generate_account_id(number):
|
def generate_account_id(number):
|
||||||
number = str(number)
|
number = str(number)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if request.user.is_in_group(settings.SITH_GROUPS['launderette-admin']['name']) %}
|
{% if request.user.is_root %}
|
||||||
<p><a href="{{ url('core:page_edit', page_name=page.get_full_name()) }}">{% trans %}Edit presentation page{% endtrans %}</a></p>
|
<p><a href="{{ url('core:page_edit', page_name=page.get_full_name()) }}">{% trans %}Edit presentation page{% endtrans %}</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if request.user.is_in_group(settings.SITH_MAIN_MEMBERS_GROUP) %}
|
{% if request.user.is_in_group(settings.SITH_MAIN_MEMBERS_GROUP) %}
|
||||||
|
Binary file not shown.
@ -6,7 +6,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"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"
|
"PO-Revision-Date: 2016-07-18\n"
|
||||||
"Last-Translator: Skia <skia@libskia.so>\n"
|
"Last-Translator: Skia <skia@libskia.so>\n"
|
||||||
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
||||||
@ -66,7 +66,7 @@ msgstr "montant effectif"
|
|||||||
msgid "number"
|
msgid "number"
|
||||||
msgstr "numéro"
|
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
|
#: counter/models.py:209 counter/models.py:244 eboutic/models.py:13
|
||||||
#: eboutic/models.py:46
|
#: eboutic/models.py:46
|
||||||
msgid "date"
|
msgid "date"
|
||||||
@ -122,7 +122,7 @@ msgstr "Compte"
|
|||||||
msgid "Company"
|
msgid "Company"
|
||||||
msgstr "Entreprise"
|
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"
|
msgid "Other"
|
||||||
msgstr "Autre"
|
msgstr "Autre"
|
||||||
|
|
||||||
@ -766,113 +766,113 @@ msgstr "téléphone des parents"
|
|||||||
msgid "parent address"
|
msgid "parent address"
|
||||||
msgstr "adresse des parents"
|
msgstr "adresse des parents"
|
||||||
|
|
||||||
#: core/models.py:253
|
#: core/models.py:254
|
||||||
msgid "A user with that username already exists"
|
msgid "A user with that username already exists"
|
||||||
msgstr "Un utilisateur de ce nom d'utilisateur existe déjà"
|
msgstr "Un utilisateur de ce nom d'utilisateur existe déjà"
|
||||||
|
|
||||||
#: core/models.py:380
|
#: core/models.py:381
|
||||||
msgid "Visitor"
|
msgid "Visitor"
|
||||||
msgstr "Visiteur"
|
msgstr "Visiteur"
|
||||||
|
|
||||||
#: core/models.py:385
|
#: core/models.py:386
|
||||||
msgid "define if we show a users stats"
|
msgid "define if we show a users stats"
|
||||||
msgstr "Definit si l'on montre les statistiques de l'utilisateur"
|
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"
|
msgid "Show your account statistics to others"
|
||||||
msgstr "Montrez vos statistiques de compte aux autres"
|
msgstr "Montrez vos statistiques de compte aux autres"
|
||||||
|
|
||||||
#: core/models.py:394
|
#: core/models.py:395
|
||||||
msgid "file name"
|
msgid "file name"
|
||||||
msgstr "nom du fichier"
|
msgstr "nom du fichier"
|
||||||
|
|
||||||
#: core/models.py:395 core/models.py:528
|
#: core/models.py:396 core/models.py:529
|
||||||
msgid "parent"
|
msgid "parent"
|
||||||
msgstr "parent"
|
msgstr "parent"
|
||||||
|
|
||||||
#: core/models.py:396 core/models.py:406
|
#: core/models.py:397 core/models.py:407
|
||||||
msgid "file"
|
msgid "file"
|
||||||
msgstr "fichier"
|
msgstr "fichier"
|
||||||
|
|
||||||
#: core/models.py:397
|
#: core/models.py:398
|
||||||
msgid "owner"
|
msgid "owner"
|
||||||
msgstr "propriétaire"
|
msgstr "propriétaire"
|
||||||
|
|
||||||
#: core/models.py:398 core/models.py:534
|
#: core/models.py:399 core/models.py:535
|
||||||
msgid "edit group"
|
msgid "edit group"
|
||||||
msgstr "groupe d'édition"
|
msgstr "groupe d'édition"
|
||||||
|
|
||||||
#: core/models.py:399 core/models.py:535
|
#: core/models.py:400 core/models.py:536
|
||||||
msgid "view group"
|
msgid "view group"
|
||||||
msgstr "groupe de vue"
|
msgstr "groupe de vue"
|
||||||
|
|
||||||
#: core/models.py:400
|
#: core/models.py:401
|
||||||
msgid "is folder"
|
msgid "is folder"
|
||||||
msgstr "est un dossier"
|
msgstr "est un dossier"
|
||||||
|
|
||||||
#: core/models.py:401
|
#: core/models.py:402
|
||||||
msgid "mime type"
|
msgid "mime type"
|
||||||
msgstr "type mime"
|
msgstr "type mime"
|
||||||
|
|
||||||
#: core/models.py:402
|
#: core/models.py:403
|
||||||
msgid "size"
|
msgid "size"
|
||||||
msgstr "taille"
|
msgstr "taille"
|
||||||
|
|
||||||
#: core/models.py:432
|
#: core/models.py:433
|
||||||
msgid "Character '/' not authorized in name"
|
msgid "Character '/' not authorized in name"
|
||||||
msgstr "Le caractère '/' n'est pas autorisé dans les noms de fichier"
|
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"
|
msgid "Loop in folder tree"
|
||||||
msgstr "Boucle dans l'arborescence des dossiers"
|
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"
|
msgid "You can not make a file be a children of a non folder file"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Vous ne pouvez pas mettre un fichier enfant de quelque chose qui n'est pas "
|
"Vous ne pouvez pas mettre un fichier enfant de quelque chose qui n'est pas "
|
||||||
"un dossier"
|
"un dossier"
|
||||||
|
|
||||||
#: core/models.py:448
|
#: core/models.py:449
|
||||||
msgid "Duplicate file"
|
msgid "Duplicate file"
|
||||||
msgstr "Un fichier de ce nom existe déjà"
|
msgstr "Un fichier de ce nom existe déjà"
|
||||||
|
|
||||||
#: core/models.py:458
|
#: core/models.py:459
|
||||||
msgid "You must provide a file"
|
msgid "You must provide a file"
|
||||||
msgstr "Vous devez fournir un fichier"
|
msgstr "Vous devez fournir un fichier"
|
||||||
|
|
||||||
#: core/models.py:483
|
#: core/models.py:484
|
||||||
msgid "Folder: "
|
msgid "Folder: "
|
||||||
msgstr "Dossier : "
|
msgstr "Dossier : "
|
||||||
|
|
||||||
#: core/models.py:485
|
#: core/models.py:486
|
||||||
msgid "File: "
|
msgid "File: "
|
||||||
msgstr "Fichier : "
|
msgstr "Fichier : "
|
||||||
|
|
||||||
#: core/models.py:527 core/models.py:531
|
#: core/models.py:528 core/models.py:532
|
||||||
msgid "page name"
|
msgid "page name"
|
||||||
msgstr "nom de la page"
|
msgstr "nom de la page"
|
||||||
|
|
||||||
#: core/models.py:532
|
#: core/models.py:533
|
||||||
msgid "owner group"
|
msgid "owner group"
|
||||||
msgstr "groupe propriétaire"
|
msgstr "groupe propriétaire"
|
||||||
|
|
||||||
#: core/models.py:563
|
#: core/models.py:564
|
||||||
msgid "Duplicate page"
|
msgid "Duplicate page"
|
||||||
msgstr "Une page de ce nom existe déjà"
|
msgstr "Une page de ce nom existe déjà"
|
||||||
|
|
||||||
#: core/models.py:569
|
#: core/models.py:570
|
||||||
msgid "Loop in page tree"
|
msgid "Loop in page tree"
|
||||||
msgstr "Boucle dans l'arborescence des pages"
|
msgstr "Boucle dans l'arborescence des pages"
|
||||||
|
|
||||||
#: core/models.py:676
|
#: core/models.py:677
|
||||||
msgid "revision"
|
msgid "revision"
|
||||||
msgstr "révision"
|
msgstr "révision"
|
||||||
|
|
||||||
#: core/models.py:677
|
#: core/models.py:678
|
||||||
msgid "page title"
|
msgid "page title"
|
||||||
msgstr "titre de la page"
|
msgstr "titre de la page"
|
||||||
|
|
||||||
#: core/models.py:678
|
#: core/models.py:679
|
||||||
msgid "page content"
|
msgid "page content"
|
||||||
msgstr "contenu de la page"
|
msgstr "contenu de la page"
|
||||||
|
|
||||||
@ -931,7 +931,7 @@ msgstr "Services"
|
|||||||
|
|
||||||
#: core/templates/core/base.jinja:55
|
#: core/templates/core/base.jinja:55
|
||||||
msgid "Site made by good people"
|
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
|
#: core/templates/core/create.jinja:4
|
||||||
#, python-format
|
#, python-format
|
||||||
@ -1411,7 +1411,7 @@ msgstr "Ajouter un nouveau dossier"
|
|||||||
msgid "Error creating folder %(folder_name)s: %(msg)s"
|
msgid "Error creating folder %(folder_name)s: %(msg)s"
|
||||||
msgstr "Erreur de création du dossier %(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
|
#, python-format
|
||||||
msgid "Error uploading file %(file_name)s: %(msg)s"
|
msgid "Error uploading file %(file_name)s: %(msg)s"
|
||||||
msgstr "Erreur d'envoie du fichier %(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"
|
msgid "Choose file"
|
||||||
msgstr "Choisir un fichier"
|
msgstr "Choisir un fichier"
|
||||||
|
|
||||||
#: core/views/forms.py:114
|
#: core/views/forms.py:113
|
||||||
msgid ""
|
msgid ""
|
||||||
"Profile: you need to be visible on the picture, in order to be recognized (e."
|
"Profile: you need to be visible on the picture, in order to be recognized (e."
|
||||||
"g. by the barmen)"
|
"g. by the barmen)"
|
||||||
@ -1428,15 +1428,15 @@ msgstr ""
|
|||||||
"Photo de profil: vous devez être visible sur la photo afin d'être reconnu "
|
"Photo de profil: vous devez être visible sur la photo afin d'être reconnu "
|
||||||
"(par exemple par les barmen)"
|
"(par exemple par les barmen)"
|
||||||
|
|
||||||
#: core/views/forms.py:115
|
#: core/views/forms.py:114
|
||||||
msgid "Avatar: used on the forum"
|
msgid "Avatar: used on the forum"
|
||||||
msgstr "Avatar : utilisé sur le 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!"
|
msgid "Scrub: let other know how your scrub looks like!"
|
||||||
msgstr "Blouse : montrez aux autres à quoi ressemble votre blouse !"
|
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"
|
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"
|
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
|
#: counter/models.py:110 eboutic/templates/eboutic/eboutic_main.jinja:20
|
||||||
#: eboutic/templates/eboutic/eboutic_makecommand.jinja:4
|
#: eboutic/templates/eboutic/eboutic_makecommand.jinja:4
|
||||||
#: eboutic/templates/eboutic/eboutic_payment_result.jinja:4
|
#: eboutic/templates/eboutic/eboutic_payment_result.jinja:4
|
||||||
|
#: sith/settings.py:279 sith/settings_sample.py:265
|
||||||
msgid "Eboutic"
|
msgid "Eboutic"
|
||||||
msgstr "Eboutic"
|
msgstr "Eboutic"
|
||||||
|
|
||||||
@ -1676,7 +1677,8 @@ msgstr "ANN"
|
|||||||
msgid "You have not enough money to buy all the basket"
|
msgid "You have not enough money to buy all the basket"
|
||||||
msgstr "Vous n'avez pas assez d'argent pour acheter le panier"
|
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"
|
msgid "Credit card"
|
||||||
msgstr "Carte banquaire"
|
msgstr "Carte banquaire"
|
||||||
|
|
||||||
@ -1824,12 +1826,12 @@ msgid "Washing and drying"
|
|||||||
msgstr "Lavage et séchage"
|
msgstr "Lavage et séchage"
|
||||||
|
|
||||||
#: launderette/templates/launderette/launderette_book.jinja:26
|
#: 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"
|
msgid "Washing"
|
||||||
msgstr "Lavage"
|
msgstr "Lavage"
|
||||||
|
|
||||||
#: launderette/templates/launderette/launderette_book.jinja:30
|
#: 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"
|
msgid "Drying"
|
||||||
msgstr "Séchage"
|
msgstr "Séchage"
|
||||||
|
|
||||||
@ -1884,83 +1886,108 @@ msgstr "L'utilisateur n'a pas réservé de créneau"
|
|||||||
msgid "Token not found"
|
msgid "Token not found"
|
||||||
msgstr "Jeton non trouvé"
|
msgstr "Jeton non trouvé"
|
||||||
|
|
||||||
#: sith/settings.py:269 sith/settings.py:276 sith/settings.py:294
|
#: sith/settings.py:269 sith/settings.py:276 sith/settings.py:296
|
||||||
#: sith/settings_sample.py:259 sith/settings_sample.py:266
|
#: sith/settings_sample.py:255 sith/settings_sample.py:262
|
||||||
#: sith/settings_sample.py:284
|
#: sith/settings_sample.py:282
|
||||||
msgid "Check"
|
msgid "Check"
|
||||||
msgstr "Chèque"
|
msgstr "Chèque"
|
||||||
|
|
||||||
#: sith/settings.py:270 sith/settings.py:277 sith/settings.py:295
|
#: sith/settings.py:270 sith/settings.py:278 sith/settings.py:297
|
||||||
#: sith/settings_sample.py:260 sith/settings_sample.py:267
|
#: sith/settings_sample.py:256 sith/settings_sample.py:264
|
||||||
#: sith/settings_sample.py:285
|
#: sith/settings_sample.py:283
|
||||||
msgid "Cash"
|
msgid "Cash"
|
||||||
msgstr "Espèces"
|
msgstr "Espèces"
|
||||||
|
|
||||||
#: sith/settings.py:271 sith/settings_sample.py:261
|
#: sith/settings.py:271 sith/settings_sample.py:257
|
||||||
msgid "Transfert"
|
msgid "Transfert"
|
||||||
msgstr "Virement"
|
msgstr "Virement"
|
||||||
|
|
||||||
#: sith/settings.py:282 sith/settings_sample.py:272
|
#: sith/settings.py:284 sith/settings_sample.py:270
|
||||||
msgid "Belfort"
|
msgid "Belfort"
|
||||||
msgstr "Belfort"
|
msgstr "Belfort"
|
||||||
|
|
||||||
#: sith/settings.py:283 sith/settings_sample.py:273
|
#: sith/settings.py:285 sith/settings_sample.py:271
|
||||||
msgid "Sevenans"
|
msgid "Sevenans"
|
||||||
msgstr "Sevenans"
|
msgstr "Sevenans"
|
||||||
|
|
||||||
#: sith/settings.py:284 sith/settings_sample.py:274
|
#: sith/settings.py:286 sith/settings_sample.py:272
|
||||||
msgid "Montbéliard"
|
msgid "Montbéliard"
|
||||||
msgstr "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"
|
msgid "One semester"
|
||||||
msgstr "Un semestre"
|
msgstr "Un semestre"
|
||||||
|
|
||||||
#: sith/settings.py:313 sith/settings_sample.py:303
|
#: sith/settings.py:316 sith/settings_sample.py:302
|
||||||
msgid "Two semesters"
|
msgid "Two semesters"
|
||||||
msgstr "Deux semestres"
|
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"
|
msgid "Common core cursus"
|
||||||
msgstr "Cursus tronc commun"
|
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"
|
msgid "Branch cursus"
|
||||||
msgstr "Cursus branche"
|
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"
|
msgid "President"
|
||||||
msgstr "Président"
|
msgstr "Président"
|
||||||
|
|
||||||
#: sith/settings.py:332 sith/settings_sample.py:322
|
#: sith/settings.py:370 sith/settings_sample.py:356
|
||||||
msgid "Vice-President"
|
msgid "Vice-President"
|
||||||
msgstr "Vice-Président"
|
msgstr "Vice-Président"
|
||||||
|
|
||||||
#: sith/settings.py:333 sith/settings_sample.py:323
|
#: sith/settings.py:371 sith/settings_sample.py:357
|
||||||
msgid "Treasurer"
|
msgid "Treasurer"
|
||||||
msgstr "Trésorier"
|
msgstr "Trésorier"
|
||||||
|
|
||||||
#: sith/settings.py:334 sith/settings_sample.py:324
|
#: sith/settings.py:372 sith/settings_sample.py:358
|
||||||
msgid "Communication supervisor"
|
msgid "Communication supervisor"
|
||||||
msgstr "Responsable com"
|
msgstr "Responsable com"
|
||||||
|
|
||||||
#: sith/settings.py:335 sith/settings_sample.py:325
|
#: sith/settings.py:373 sith/settings_sample.py:359
|
||||||
msgid "Secretary"
|
msgid "Secretary"
|
||||||
msgstr "Secrétaire"
|
msgstr "Secrétaire"
|
||||||
|
|
||||||
#: sith/settings.py:336 sith/settings_sample.py:326
|
#: sith/settings.py:374 sith/settings_sample.py:360
|
||||||
msgid "IT supervisor"
|
msgid "IT supervisor"
|
||||||
msgstr "Responsable info"
|
msgstr "Responsable info"
|
||||||
|
|
||||||
#: sith/settings.py:337 sith/settings_sample.py:327
|
#: sith/settings.py:375 sith/settings_sample.py:361
|
||||||
msgid "Board member"
|
msgid "Board member"
|
||||||
msgstr "Membre du bureau"
|
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"
|
msgid "Active member"
|
||||||
msgstr "Membre actif"
|
msgstr "Membre actif"
|
||||||
|
|
||||||
#: sith/settings.py:339 sith/settings_sample.py:329
|
#: sith/settings.py:377 sith/settings_sample.py:363
|
||||||
msgid "Curious"
|
msgid "Curious"
|
||||||
msgstr "Curieux"
|
msgstr "Curieux"
|
||||||
|
|
||||||
|
94
migrate.py
94
migrate.py
@ -16,6 +16,8 @@ from django.db import connection
|
|||||||
|
|
||||||
from core.models import User, SithFile
|
from core.models import User, SithFile
|
||||||
from club.models import Club, Membership
|
from club.models import Club, Membership
|
||||||
|
from counter.models import Customer
|
||||||
|
from subscription.models import Subscription, Subscriber
|
||||||
|
|
||||||
db = MySQLdb.connect(
|
db = MySQLdb.connect(
|
||||||
host="ae-db",
|
host="ae-db",
|
||||||
@ -87,15 +89,15 @@ def migrate_users():
|
|||||||
c.execute("""
|
c.execute("""
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM utilisateurs utl
|
FROM utilisateurs utl
|
||||||
JOIN utl_etu ue
|
LEFT JOIN utl_etu ue
|
||||||
ON ue.id_utilisateur = utl.id_utilisateur
|
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
|
ON ueu.id_utilisateur = utl.id_utilisateur
|
||||||
JOIN utl_extra uxtra
|
LEFT JOIN utl_extra uxtra
|
||||||
ON uxtra.id_utilisateur = utl.id_utilisateur
|
ON uxtra.id_utilisateur = utl.id_utilisateur
|
||||||
JOIN loc_ville ville
|
LEFT JOIN loc_ville ville
|
||||||
ON utl.id_ville = ville.id_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()
|
User.objects.filter(id__gt=0).delete()
|
||||||
print("Users deleted")
|
print("Users deleted")
|
||||||
@ -237,12 +239,88 @@ def migrate_club_memberships():
|
|||||||
print("FAIL for club membership %s: %s" % (m['id_asso'], repr(e)))
|
print("FAIL for club membership %s: %s" % (m['id_asso'], repr(e)))
|
||||||
cur.close()
|
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():
|
def main():
|
||||||
# migrate_users()
|
migrate_users()
|
||||||
# migrate_profile_pict()
|
migrate_profile_pict()
|
||||||
# migrate_clubs()
|
migrate_clubs()
|
||||||
migrate_club_memberships()
|
migrate_club_memberships()
|
||||||
|
migrate_subscriptions()
|
||||||
|
update_customer_account()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -243,10 +243,6 @@ SITH_GROUPS = {
|
|||||||
'id': 5,
|
'id': 5,
|
||||||
'name': "Counter admin",
|
'name': "Counter admin",
|
||||||
},
|
},
|
||||||
'launderette-admin': {
|
|
||||||
'id': 6,
|
|
||||||
'name': "Launderette admin",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SITH_BOARD_SUFFIX="-bureau"
|
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_MAIN_MEMBERS_GROUP=SITH_MAIN_CLUB['unix_name']+SITH_MEMBER_SUFFIX
|
||||||
|
|
||||||
SITH_ACCOUNTING_PAYMENT_METHOD = [
|
SITH_ACCOUNTING_PAYMENT_METHOD = [
|
||||||
('CHEQUE', _('Check')),
|
('CHECK', _('Check')),
|
||||||
('CASH', _('Cash')),
|
('CASH', _('Cash')),
|
||||||
('TRANSFert', _('Transfert')),
|
('TRANSFERT', _('Transfert')),
|
||||||
('CARD', _('Credit card')),
|
('CARD', _('Credit card')),
|
||||||
]
|
]
|
||||||
|
|
||||||
SITH_SUBSCRIPTION_PAYMENT_METHOD = [
|
SITH_SUBSCRIPTION_PAYMENT_METHOD = [
|
||||||
('CHEQUE', _('Check')),
|
('CHECK', _('Check')),
|
||||||
|
('CARD', _('Credit card')),
|
||||||
('CASH', _('Cash')),
|
('CASH', _('Cash')),
|
||||||
|
('EBOUTIC', _('Eboutic')),
|
||||||
('OTHER', _('Other')),
|
('OTHER', _('Other')),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -281,7 +279,7 @@ SITH_COUNTER_BARS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
SITH_COUNTER_PAYMENT_METHOD = [
|
SITH_COUNTER_PAYMENT_METHOD = [
|
||||||
('CHEQUE', _('Check')),
|
('CHECK', _('Check')),
|
||||||
('CASH', _('Cash')),
|
('CASH', _('Cash')),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -292,7 +290,8 @@ SITH_COUNTER_BANK = [
|
|||||||
('CREDIT-MUTUEL', 'Credit Mutuel'),
|
('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 = {
|
SITH_SUBSCRIPTIONS = {
|
||||||
'un-semestre': {
|
'un-semestre': {
|
||||||
'name': _('One semester'),
|
'name': _('One semester'),
|
||||||
@ -314,6 +313,41 @@ SITH_SUBSCRIPTIONS = {
|
|||||||
'price': 45,
|
'price': 45,
|
||||||
'duration': 6,
|
'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....
|
# To be completed....
|
||||||
}
|
}
|
||||||
|
|
||||||
|
24
subscription/migrations/0002_auto_20160814_1634.py
Normal file
24
subscription/migrations/0002_auto_20160814_1634.py
Normal file
@ -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')]),
|
||||||
|
),
|
||||||
|
]
|
@ -53,7 +53,8 @@ class Subscription(models.Model):
|
|||||||
super(Subscription, self).save()
|
super(Subscription, self).save()
|
||||||
from counter.models import Customer
|
from counter.models import Customer
|
||||||
if not Customer.objects.filter(user=self.member).exists():
|
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()
|
self.member.make_home()
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
|
@ -6,9 +6,41 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>{% trans %}New subscription{% endtrans %}</h3>
|
<h3>{% trans %}New subscription{% endtrans %}</h3>
|
||||||
<form action="" method="post">
|
<div id="user_info"></div>
|
||||||
|
<form action="" method="post" id="subscription_form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p() }}
|
<p>{{ form.member.errors }}<label for="{{ form.member.name }}">{{ form.member.label }}</label> {{ form.member }}</p>
|
||||||
|
<div id="new_member">
|
||||||
|
<p>{{ form.last_name.errors }}<label for="{{ form.last_name.name }}">{{ form.last_name.label }}</label> {{ form.last_name }}</p>
|
||||||
|
<p>{{ form.first_name.errors }}<label for="{{ form.first_name.name }}">{{ form.first_name.label }}</label> {{ form.first_name }}</p>
|
||||||
|
<p>{{ form.email.errors }}<label for="{{ form.email.name }}">{{ form.email.label }}</label> {{ form.email }}</p>
|
||||||
|
</div>
|
||||||
|
<p>{{ form.subscription_type.errors }}<label for="{{ form.subscription_type.name }}">{{ form.subscription_type.label }}</label> {{ form.subscription_type }}</p>
|
||||||
|
<p>{{ form.payment_method.errors }}<label for="{{ form.payment_method.name }}">{{ form.payment_method.label }}</label> {{
|
||||||
|
form.payment_method }}</p>
|
||||||
|
<p>{{ form.location.errors }}<label for="{{ form.location.name }}">{{ form.location.label }}</label> {{ form.location }}</p>
|
||||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block script %}
|
||||||
|
{{ super() }}
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
$( function() {
|
||||||
|
select = $("#subscription_form select[name=member]");
|
||||||
|
member_block = $("#subscription_form #new_member");
|
||||||
|
user_info = $("#user_info");
|
||||||
|
function display_new_member() {
|
||||||
|
if (select.val()) {
|
||||||
|
member_block.hide();
|
||||||
|
user_info.load("/user/"+select.val()+"/mini");
|
||||||
|
} else {
|
||||||
|
member_block.show();
|
||||||
|
user_info.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
select.on("change", display_new_member);
|
||||||
|
display_new_member();
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
@ -63,8 +63,8 @@ class NewSubscription(CanEditMixin, CreateView):
|
|||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
if 'member' in self.request.GET.keys():
|
if 'member' in self.request.GET.keys():
|
||||||
return {'member': self.request.GET['member']}
|
return {'member': self.request.GET['member'], 'subscription_type': 'deux-semestres'}
|
||||||
return {}
|
return {'subscription_type': 'deux-semestres'}
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
form.instance.subscription_start = Subscription.compute_start(
|
form.instance.subscription_start = Subscription.compute_start(
|
||||||
|
Loading…
Reference in New Issue
Block a user