mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Add old membership views
This commit is contained in:
parent
c5fd9d0076
commit
c62d3f4f4a
19
club/migrations/0003_auto_20160902_2042.py
Normal file
19
club/migrations/0003_auto_20160902_2042.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 = [
|
||||||
|
('club', '0002_auto_20160824_2152'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='membership',
|
||||||
|
name='start_date',
|
||||||
|
field=models.DateField(verbose_name='start date'),
|
||||||
|
),
|
||||||
|
]
|
@ -5,6 +5,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import IntegrityError, transaction
|
from django.db import IntegrityError, transaction
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from core.models import User, MetaGroup, Group, SithFile
|
from core.models import User, MetaGroup, Group, SithFile
|
||||||
from subscription.models import Subscriber
|
from subscription.models import Subscriber
|
||||||
@ -103,9 +104,7 @@ class Club(models.Model):
|
|||||||
"""
|
"""
|
||||||
Method to see if that object can be super edited by the given user
|
Method to see if that object can be super edited by the given user
|
||||||
"""
|
"""
|
||||||
if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP):
|
return user.is_in_group(settings.SITH_MAIN_BOARD_GROUP)
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def can_be_edited_by(self, user):
|
def can_be_edited_by(self, user):
|
||||||
"""
|
"""
|
||||||
@ -144,7 +143,7 @@ class Membership(models.Model):
|
|||||||
"""
|
"""
|
||||||
user = models.ForeignKey(User, verbose_name=_('user'), related_name="membership", null=False, blank=False)
|
user = models.ForeignKey(User, verbose_name=_('user'), related_name="membership", null=False, blank=False)
|
||||||
club = models.ForeignKey(Club, verbose_name=_('club'), related_name="members", null=False, blank=False)
|
club = models.ForeignKey(Club, verbose_name=_('club'), related_name="members", null=False, blank=False)
|
||||||
start_date = models.DateField(_('start date'), auto_now=True)
|
start_date = models.DateField(_('start date'))
|
||||||
end_date = models.DateField(_('end date'), null=True, blank=True)
|
end_date = models.DateField(_('end date'), null=True, blank=True)
|
||||||
role = models.IntegerField(_('role'), choices=sorted(settings.SITH_CLUB_ROLES.items()),
|
role = models.IntegerField(_('role'), choices=sorted(settings.SITH_CLUB_ROLES.items()),
|
||||||
default=sorted(settings.SITH_CLUB_ROLES.items())[0][0])
|
default=sorted(settings.SITH_CLUB_ROLES.items())[0][0])
|
||||||
@ -157,11 +156,31 @@ class Membership(models.Model):
|
|||||||
if Membership.objects.filter(user=self.user).filter(club=self.club).filter(end_date=None).exists():
|
if Membership.objects.filter(user=self.user).filter(club=self.club).filter(end_date=None).exists():
|
||||||
raise ValidationError(_('User is already member of that club'))
|
raise ValidationError(_('User is already member of that club'))
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if not self.id:
|
||||||
|
self.start_date = timezone.now()
|
||||||
|
return super(Membership, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.club.name+' - '+self.user.username+' - '+str(settings.SITH_CLUB_ROLES[self.role])+str(
|
return self.club.name+' - '+self.user.username+' - '+str(settings.SITH_CLUB_ROLES[self.role])+str(
|
||||||
" - "+str(_('past member')) if self.end_date is not None else ""
|
" - "+str(_('past member')) if self.end_date is not None else ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def is_owned_by(self, user):
|
||||||
|
"""
|
||||||
|
Method to see if that object can be super edited by the given user
|
||||||
|
"""
|
||||||
|
return user.is_in_group(settings.SITH_MAIN_BOARD_GROUP)
|
||||||
|
|
||||||
|
def can_be_edited_by(self, user):
|
||||||
|
"""
|
||||||
|
Method to see if that object can be edited by the given user
|
||||||
|
"""
|
||||||
|
if user.membership:
|
||||||
|
ms = user.membership.filter(club=self.club, end_date=None).first()
|
||||||
|
return (ms and ms.role >= self.role) or user.is_in_group(settings.SITH_MAIN_BOARD_GROUP)
|
||||||
|
return user.is_in_group(settings.SITH_MAIN_BOARD_GROUP)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('club:club_members', kwargs={'club_id': self.club.id})
|
return reverse('club:club_members', kwargs={'club_id': self.club.id})
|
||||||
|
|
||||||
|
@ -18,6 +18,14 @@
|
|||||||
>{% trans %}Members{% endtrans %}</a>
|
>{% trans %}Members{% endtrans %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if can_view(club, user) %}
|
||||||
|
<a href="{{ url('club:club_old_members', club_id=club.pk) }}"
|
||||||
|
{%- if tab == "elderlies" -%}
|
||||||
|
class="selected_tab"
|
||||||
|
{%- endif -%}
|
||||||
|
>{% trans %}Old members{% endtrans %}</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if can_view(club, user) %}
|
{% if can_view(club, user) %}
|
||||||
<a href="{{ url('club:tools', club_id=club.id) }}"
|
<a href="{{ url('club:tools', club_id=club.id) }}"
|
||||||
{%- if tab == "tools" -%}
|
{%- if tab == "tools" -%}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<td>{% trans %}User{% endtrans %}</td>
|
<td>{% trans %}User{% endtrans %}</td>
|
||||||
<td>{% trans %}Role{% endtrans %}</td>
|
<td>{% trans %}Role{% endtrans %}</td>
|
||||||
<td>{% trans %}Description{% endtrans %}</td>
|
<td>{% trans %}Description{% endtrans %}</td>
|
||||||
|
<td>{% trans %}Since{% endtrans %}</td>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for m in club.members.filter(end_date=None).order_by('-role').all() %}
|
{% for m in club.members.filter(end_date=None).order_by('-role').all() %}
|
||||||
@ -15,6 +16,10 @@
|
|||||||
<td>{{ user_profile_link(m.user) }}</td>
|
<td>{{ user_profile_link(m.user) }}</td>
|
||||||
<td>{{ settings.SITH_CLUB_ROLES[m.role] }}</td>
|
<td>{{ settings.SITH_CLUB_ROLES[m.role] }}</td>
|
||||||
<td>{{ m.description }}</td>
|
<td>{{ m.description }}</td>
|
||||||
|
<td>{{ m.start_date }}</td>
|
||||||
|
{% if m.can_be_edited_by(user) %}
|
||||||
|
<td><a href="{{ url('club:membership_set_old', membership_id=m.id) }}">{% trans %}Mark as old{% endtrans %}</a></td>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
29
club/templates/club/club_old_members.jinja
Normal file
29
club/templates/club/club_old_members.jinja
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{% extends "club/club_base.jinja" %}
|
||||||
|
{% from 'core/macros.jinja' import user_profile_link %}
|
||||||
|
|
||||||
|
{% block club %}
|
||||||
|
<h2>{% trans %}Club old members{% endtrans %}</h2>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<td>{% trans %}User{% endtrans %}</td>
|
||||||
|
<td>{% trans %}Role{% endtrans %}</td>
|
||||||
|
<td>{% trans %}Description{% endtrans %}</td>
|
||||||
|
<td>{% trans %}From{% endtrans %}</td>
|
||||||
|
<td>{% trans %}To{% endtrans %}</td>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for m in club.members.exclude(end_date=None).order_by('-role', '-end_date').all() %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ user_profile_link(m.user) }}</td>
|
||||||
|
<td>{{ settings.SITH_CLUB_ROLES[m.role] }}</td>
|
||||||
|
<td>{{ m.description }}</td>
|
||||||
|
<td>{{ m.start_date }}</td>
|
||||||
|
<td>{{ m.end_date }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -8,7 +8,9 @@ urlpatterns = [
|
|||||||
url(r'^(?P<club_id>[0-9]+)/$', ClubView.as_view(), name='club_view'),
|
url(r'^(?P<club_id>[0-9]+)/$', ClubView.as_view(), name='club_view'),
|
||||||
url(r'^(?P<club_id>[0-9]+)/edit$', ClubEditView.as_view(), name='club_edit'),
|
url(r'^(?P<club_id>[0-9]+)/edit$', ClubEditView.as_view(), name='club_edit'),
|
||||||
url(r'^(?P<club_id>[0-9]+)/members$', ClubMembersView.as_view(), name='club_members'),
|
url(r'^(?P<club_id>[0-9]+)/members$', ClubMembersView.as_view(), name='club_members'),
|
||||||
|
url(r'^(?P<club_id>[0-9]+)/elderlies$', ClubOldMembersView.as_view(), name='club_old_members'),
|
||||||
url(r'^(?P<club_id>[0-9]+)/prop$', ClubEditPropView.as_view(), name='club_prop'),
|
url(r'^(?P<club_id>[0-9]+)/prop$', ClubEditPropView.as_view(), name='club_prop'),
|
||||||
url(r'^(?P<club_id>[0-9]+)/tools$', ClubToolsView.as_view(), name='tools'),
|
url(r'^(?P<club_id>[0-9]+)/tools$', ClubToolsView.as_view(), name='tools'),
|
||||||
|
url(r'^membership/(?P<membership_id>[0-9]+)/set_old$', MembershipSetOldView.as_view(), name='membership_set_old'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -4,7 +4,9 @@ from django.views.generic import ListView, DetailView
|
|||||||
from django.views.generic.edit import UpdateView, CreateView
|
from django.views.generic.edit import UpdateView, CreateView
|
||||||
from django.forms import CheckboxSelectMultiple
|
from django.forms import CheckboxSelectMultiple
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin
|
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin
|
||||||
from club.models import Club, Membership
|
from club.models import Club, Membership
|
||||||
@ -102,6 +104,19 @@ class ClubMembersView(CanViewMixin, UpdateView):
|
|||||||
kwargs['tab'] = "members"
|
kwargs['tab'] = "members"
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
class ClubOldMembersView(CanViewMixin, DetailView):
|
||||||
|
"""
|
||||||
|
Old members of a club
|
||||||
|
"""
|
||||||
|
model = Club
|
||||||
|
pk_url_kwarg = "club_id"
|
||||||
|
template_name = 'club/club_old_members.jinja'
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
kwargs = super(ClubOldMembersView, self).get_context_data(**kwargs)
|
||||||
|
kwargs['tab'] = "elderlies"
|
||||||
|
return kwargs
|
||||||
|
|
||||||
class ClubEditView(CanEditMixin, UpdateView):
|
class ClubEditView(CanEditMixin, UpdateView):
|
||||||
"""
|
"""
|
||||||
Edit a Club's main informations (for the club's members)
|
Edit a Club's main informations (for the club's members)
|
||||||
@ -139,3 +154,20 @@ class ClubCreateView(CanEditPropMixin, CreateView):
|
|||||||
fields = ['name', 'unix_name', 'parent']
|
fields = ['name', 'unix_name', 'parent']
|
||||||
template_name = 'club/club_edit_prop.jinja'
|
template_name = 'club/club_edit_prop.jinja'
|
||||||
|
|
||||||
|
class MembershipSetOldView(CanEditMixin, DetailView):
|
||||||
|
"""
|
||||||
|
Set a membership as beeing old
|
||||||
|
"""
|
||||||
|
model = Membership
|
||||||
|
pk_url_kwarg = "membership_id"
|
||||||
|
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
self.object = self.get_object()
|
||||||
|
self.object.end_date = timezone.now()
|
||||||
|
self.object.save()
|
||||||
|
return HttpResponseRedirect(reverse('club:club_members', args=self.args, kwargs={'club_id': self.object.club.id}))
|
||||||
|
|
||||||
|
def post(self, request, *args, **kwargs):
|
||||||
|
self.object = self.get_object()
|
||||||
|
return HttpResponseRedirect(reverse('club:club_members', args=self.args, kwargs={'club_id': self.object.club.id}))
|
||||||
|
|
||||||
|
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-09-02 19:31+0200\n"
|
"POT-Creation-Date: 2016-09-02 21:18+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"
|
||||||
@ -17,7 +17,7 @@ msgstr ""
|
|||||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||||
|
|
||||||
#: accounting/models.py:36 accounting/models.py:55 accounting/models.py:82
|
#: accounting/models.py:36 accounting/models.py:55 accounting/models.py:82
|
||||||
#: accounting/models.py:132 club/models.py:18 counter/models.py:52
|
#: accounting/models.py:132 club/models.py:19 counter/models.py:52
|
||||||
#: counter/models.py:77 counter/models.py:111 launderette/models.py:15
|
#: counter/models.py:77 counter/models.py:111 launderette/models.py:15
|
||||||
#: launderette/models.py:60 launderette/models.py:85
|
#: launderette/models.py:60 launderette/models.py:85
|
||||||
msgid "name"
|
msgid "name"
|
||||||
@ -63,7 +63,7 @@ msgstr "IBAN"
|
|||||||
msgid "account number"
|
msgid "account number"
|
||||||
msgstr "numero de compte"
|
msgstr "numero de compte"
|
||||||
|
|
||||||
#: accounting/models.py:58 accounting/models.py:83 club/models.py:146
|
#: accounting/models.py:58 accounting/models.py:83 club/models.py:145
|
||||||
#: counter/models.py:86 counter/models.py:112
|
#: counter/models.py:86 counter/models.py:112
|
||||||
msgid "club"
|
msgid "club"
|
||||||
msgstr "club"
|
msgstr "club"
|
||||||
@ -85,12 +85,12 @@ msgstr "Compte club"
|
|||||||
msgid "%(club_account)s on %(bank_account)s"
|
msgid "%(club_account)s on %(bank_account)s"
|
||||||
msgstr "%(club_account)s sur %(bank_account)s"
|
msgstr "%(club_account)s sur %(bank_account)s"
|
||||||
|
|
||||||
#: accounting/models.py:130 club/models.py:147 counter/models.py:282
|
#: accounting/models.py:130 club/models.py:146 counter/models.py:282
|
||||||
#: launderette/models.py:122
|
#: launderette/models.py:122
|
||||||
msgid "start date"
|
msgid "start date"
|
||||||
msgstr "date de début"
|
msgstr "date de début"
|
||||||
|
|
||||||
#: accounting/models.py:131 club/models.py:148 counter/models.py:283
|
#: accounting/models.py:131 club/models.py:147 counter/models.py:283
|
||||||
msgid "end date"
|
msgid "end date"
|
||||||
msgstr "date de fin"
|
msgstr "date de fin"
|
||||||
|
|
||||||
@ -163,6 +163,7 @@ msgid "target type"
|
|||||||
msgstr "type de cible"
|
msgstr "type de cible"
|
||||||
|
|
||||||
#: accounting/models.py:190 club/templates/club/club_members.jinja:8
|
#: accounting/models.py:190 club/templates/club/club_members.jinja:8
|
||||||
|
#: club/templates/club/club_old_members.jinja:8
|
||||||
#: launderette/templates/launderette/launderette_admin.jinja:44
|
#: launderette/templates/launderette/launderette_admin.jinja:44
|
||||||
msgid "User"
|
msgid "User"
|
||||||
msgstr "Utilisateur"
|
msgstr "Utilisateur"
|
||||||
@ -324,7 +325,7 @@ msgstr "Nouveau compte club"
|
|||||||
#: accounting/templates/accounting/bank_account_list.jinja:21
|
#: accounting/templates/accounting/bank_account_list.jinja:21
|
||||||
#: accounting/templates/accounting/club_account_details.jinja:53
|
#: accounting/templates/accounting/club_account_details.jinja:53
|
||||||
#: accounting/templates/accounting/journal_details.jinja:66
|
#: accounting/templates/accounting/journal_details.jinja:66
|
||||||
#: club/templates/club/club_base.jinja:34 core/templates/core/file.jinja:38
|
#: club/templates/club/club_base.jinja:42 core/templates/core/file.jinja:38
|
||||||
#: core/templates/core/page.jinja:31 core/templates/core/user_base.jinja:33
|
#: core/templates/core/page.jinja:31 core/templates/core/user_base.jinja:33
|
||||||
#: core/templates/core/user_tools.jinja:33
|
#: core/templates/core/user_tools.jinja:33
|
||||||
#: counter/templates/counter/counter_list.jinja:20
|
#: counter/templates/counter/counter_list.jinja:20
|
||||||
@ -507,11 +508,11 @@ msgstr "Types simplifiés"
|
|||||||
msgid "New simplified type"
|
msgid "New simplified type"
|
||||||
msgstr "Nouveau type simplifié"
|
msgstr "Nouveau type simplifié"
|
||||||
|
|
||||||
#: club/models.py:20
|
#: club/models.py:21
|
||||||
msgid "unix name"
|
msgid "unix name"
|
||||||
msgstr "nom unix"
|
msgstr "nom unix"
|
||||||
|
|
||||||
#: club/models.py:24
|
#: club/models.py:25
|
||||||
msgid ""
|
msgid ""
|
||||||
"Enter a valid unix name. This value may contain only letters, numbers ./-/_ "
|
"Enter a valid unix name. This value may contain only letters, numbers ./-/_ "
|
||||||
"characters."
|
"characters."
|
||||||
@ -519,50 +520,50 @@ msgstr ""
|
|||||||
"Entrez un nom UNIX valide. Cette valeur peut contenir uniquement des "
|
"Entrez un nom UNIX valide. Cette valeur peut contenir uniquement des "
|
||||||
"lettres, des nombres, et les caractères ./-/_"
|
"lettres, des nombres, et les caractères ./-/_"
|
||||||
|
|
||||||
#: club/models.py:29
|
#: club/models.py:30
|
||||||
msgid "A club with that unix name already exists."
|
msgid "A club with that unix name already exists."
|
||||||
msgstr "Un club avec ce nom UNIX existe déjà."
|
msgstr "Un club avec ce nom UNIX existe déjà."
|
||||||
|
|
||||||
#: club/models.py:32 core/models.py:168
|
#: club/models.py:33 core/models.py:168
|
||||||
msgid "address"
|
msgid "address"
|
||||||
msgstr "Adresse"
|
msgstr "Adresse"
|
||||||
|
|
||||||
#: club/models.py:38 core/models.py:117
|
#: club/models.py:39 core/models.py:117
|
||||||
msgid "home"
|
msgid "home"
|
||||||
msgstr "home"
|
msgstr "home"
|
||||||
|
|
||||||
#: club/models.py:46
|
#: club/models.py:47
|
||||||
msgid "You can not make loops in clubs"
|
msgid "You can not make loops in clubs"
|
||||||
msgstr "Vous ne pouvez pas faire de boucles dans les clubs"
|
msgstr "Vous ne pouvez pas faire de boucles dans les clubs"
|
||||||
|
|
||||||
#: club/models.py:60
|
#: club/models.py:61
|
||||||
msgid "A club with that unix_name already exists"
|
msgid "A club with that unix_name already exists"
|
||||||
msgstr "Un club avec ce nom UNIX existe déjà."
|
msgstr "Un club avec ce nom UNIX existe déjà."
|
||||||
|
|
||||||
#: club/models.py:145 counter/models.py:280 counter/models.py:294
|
#: club/models.py:144 counter/models.py:280 counter/models.py:294
|
||||||
#: eboutic/models.py:14 eboutic/models.py:47 launderette/models.py:89
|
#: eboutic/models.py:14 eboutic/models.py:47 launderette/models.py:89
|
||||||
#: launderette/models.py:126
|
#: launderette/models.py:126
|
||||||
msgid "user"
|
msgid "user"
|
||||||
msgstr "nom d'utilisateur"
|
msgstr "nom d'utilisateur"
|
||||||
|
|
||||||
#: club/models.py:149 core/models.py:135
|
#: club/models.py:148 core/models.py:135
|
||||||
msgid "role"
|
msgid "role"
|
||||||
msgstr "rôle"
|
msgstr "rôle"
|
||||||
|
|
||||||
#: club/models.py:151 core/models.py:32 counter/models.py:53
|
#: club/models.py:150 core/models.py:32 counter/models.py:53
|
||||||
#: counter/models.py:78
|
#: counter/models.py:78
|
||||||
msgid "description"
|
msgid "description"
|
||||||
msgstr "description"
|
msgstr "description"
|
||||||
|
|
||||||
#: club/models.py:156
|
#: club/models.py:155
|
||||||
msgid "User must be subscriber to take part to a club"
|
msgid "User must be subscriber to take part to a club"
|
||||||
msgstr "L'utilisateur doit être cotisant pour faire partie d'un club"
|
msgstr "L'utilisateur doit être cotisant pour faire partie d'un club"
|
||||||
|
|
||||||
#: club/models.py:158
|
#: club/models.py:157
|
||||||
msgid "User is already member of that club"
|
msgid "User is already member of that club"
|
||||||
msgstr "L'utilisateur est déjà membre de ce club"
|
msgstr "L'utilisateur est déjà membre de ce club"
|
||||||
|
|
||||||
#: club/models.py:162
|
#: club/models.py:166
|
||||||
msgid "past member"
|
msgid "past member"
|
||||||
msgstr "Anciens membres"
|
msgstr "Anciens membres"
|
||||||
|
|
||||||
@ -570,12 +571,16 @@ msgstr "Anciens membres"
|
|||||||
msgid "Members"
|
msgid "Members"
|
||||||
msgstr "Membres"
|
msgstr "Membres"
|
||||||
|
|
||||||
#: club/templates/club/club_base.jinja:26 core/templates/core/base.jinja:25
|
#: club/templates/club/club_base.jinja:26
|
||||||
|
msgid "Old members"
|
||||||
|
msgstr "Anciens membres"
|
||||||
|
|
||||||
|
#: club/templates/club/club_base.jinja:34 core/templates/core/base.jinja:25
|
||||||
#: core/templates/core/user_base.jinja:19
|
#: core/templates/core/user_base.jinja:19
|
||||||
msgid "Tools"
|
msgid "Tools"
|
||||||
msgstr "Outils"
|
msgstr "Outils"
|
||||||
|
|
||||||
#: club/templates/club/club_base.jinja:42
|
#: club/templates/club/club_base.jinja:50
|
||||||
#: counter/templates/counter/counter_list.jinja:23
|
#: counter/templates/counter/counter_list.jinja:23
|
||||||
msgid "Props"
|
msgid "Props"
|
||||||
msgstr "Propriétés"
|
msgstr "Propriétés"
|
||||||
@ -606,18 +611,41 @@ msgid "Club members"
|
|||||||
msgstr "Membres du club"
|
msgstr "Membres du club"
|
||||||
|
|
||||||
#: club/templates/club/club_members.jinja:9
|
#: club/templates/club/club_members.jinja:9
|
||||||
|
#: club/templates/club/club_old_members.jinja:9
|
||||||
msgid "Role"
|
msgid "Role"
|
||||||
msgstr "Rôle"
|
msgstr "Rôle"
|
||||||
|
|
||||||
#: club/templates/club/club_members.jinja:10
|
#: club/templates/club/club_members.jinja:10
|
||||||
|
#: club/templates/club/club_old_members.jinja:10
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Description"
|
msgstr "Description"
|
||||||
|
|
||||||
#: club/templates/club/club_members.jinja:25
|
#: club/templates/club/club_members.jinja:11
|
||||||
|
#: launderette/templates/launderette/launderette_admin.jinja:45
|
||||||
|
msgid "Since"
|
||||||
|
msgstr "Depuis"
|
||||||
|
|
||||||
|
#: club/templates/club/club_members.jinja:21
|
||||||
|
msgid "Mark as old"
|
||||||
|
msgstr "Marquer comme ancien"
|
||||||
|
|
||||||
|
#: club/templates/club/club_members.jinja:30
|
||||||
#: core/templates/core/file_detail.jinja:19 launderette/views.py:146
|
#: core/templates/core/file_detail.jinja:19 launderette/views.py:146
|
||||||
msgid "Add"
|
msgid "Add"
|
||||||
msgstr "Ajouter"
|
msgstr "Ajouter"
|
||||||
|
|
||||||
|
#: club/templates/club/club_old_members.jinja:5
|
||||||
|
msgid "Club old members"
|
||||||
|
msgstr "Anciens membres du club"
|
||||||
|
|
||||||
|
#: club/templates/club/club_old_members.jinja:11
|
||||||
|
msgid "From"
|
||||||
|
msgstr "Du"
|
||||||
|
|
||||||
|
#: club/templates/club/club_old_members.jinja:12
|
||||||
|
msgid "To"
|
||||||
|
msgstr "Au"
|
||||||
|
|
||||||
#: club/templates/club/club_tools.jinja:4
|
#: club/templates/club/club_tools.jinja:4
|
||||||
#: core/templates/core/user_tools.jinja:58
|
#: core/templates/core/user_tools.jinja:58
|
||||||
msgid "Club tools"
|
msgid "Club tools"
|
||||||
@ -2218,10 +2246,6 @@ msgstr "Jetons"
|
|||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Type"
|
msgstr "Type"
|
||||||
|
|
||||||
#: launderette/templates/launderette/launderette_admin.jinja:45
|
|
||||||
msgid "Since"
|
|
||||||
msgstr "Depuis"
|
|
||||||
|
|
||||||
#: launderette/templates/launderette/launderette_book.jinja:11
|
#: launderette/templates/launderette/launderette_book.jinja:11
|
||||||
msgid "Choose"
|
msgid "Choose"
|
||||||
msgstr "Choisir"
|
msgstr "Choisir"
|
||||||
@ -2448,6 +2472,3 @@ msgstr "Un utilisateur avec cette adresse email existe déjà"
|
|||||||
msgid "You must either choose an existing user or create a new one properly"
|
msgid "You must either choose an existing user or create a new one properly"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Vous devez soit choisir un utilisateur existant, ou en créer un proprement."
|
"Vous devez soit choisir un utilisateur existant, ou en créer un proprement."
|
||||||
|
|
||||||
#~ msgid "You are trying to create a subscription without member"
|
|
||||||
#~ msgstr "Vous essayez de créer une cotisation sans membre"
|
|
||||||
|
26
migrate.py
26
migrate.py
@ -26,14 +26,7 @@ from subscription.models import Subscription, Subscriber
|
|||||||
from eboutic.models import Invoice, InvoiceItem
|
from eboutic.models import Invoice, InvoiceItem
|
||||||
from accounting.models import BankAccount, ClubAccount, GeneralJournal, Operation, AccountingType, Company, SimplifiedAccountingType
|
from accounting.models import BankAccount, ClubAccount, GeneralJournal, Operation, AccountingType, Company, SimplifiedAccountingType
|
||||||
|
|
||||||
db = MySQLdb.connect(
|
db = MySQLdb.connect(**settings.OLD_MYSQL_INFOS)
|
||||||
host="ae-db",
|
|
||||||
user="taiste_rw",
|
|
||||||
passwd=input("password: "),
|
|
||||||
db="ae2-taiste",
|
|
||||||
charset='utf8',
|
|
||||||
use_unicode=True)
|
|
||||||
|
|
||||||
start = datetime.datetime.now()
|
start = datetime.datetime.now()
|
||||||
|
|
||||||
def reset_index(*args):
|
def reset_index(*args):
|
||||||
@ -245,6 +238,7 @@ def migrate_club():
|
|||||||
user = User.objects.filter(id=m['id_utilisateur']).first()
|
user = User.objects.filter(id=m['id_utilisateur']).first()
|
||||||
if club and user:
|
if club and user:
|
||||||
new = Membership(
|
new = Membership(
|
||||||
|
id=Membership.objects.count()+1,
|
||||||
club=club,
|
club=club,
|
||||||
user=user,
|
user=user,
|
||||||
start_date=m['date_debut'],
|
start_date=m['date_debut'],
|
||||||
@ -259,7 +253,7 @@ def migrate_club():
|
|||||||
print("Clubs memberships migrated at %s" % datetime.datetime.now())
|
print("Clubs memberships migrated at %s" % datetime.datetime.now())
|
||||||
print("Running time: %s" % (datetime.datetime.now()-start))
|
print("Running time: %s" % (datetime.datetime.now()-start))
|
||||||
|
|
||||||
migrate_clubs()
|
# migrate_clubs()
|
||||||
migrate_club_memberships()
|
migrate_club_memberships()
|
||||||
|
|
||||||
def migrate_subscriptions():
|
def migrate_subscriptions():
|
||||||
@ -953,18 +947,18 @@ def migrate_accounting():
|
|||||||
def main():
|
def main():
|
||||||
print("Start at %s" % start)
|
print("Start at %s" % start)
|
||||||
# Core
|
# Core
|
||||||
migrate_core()
|
# migrate_core()
|
||||||
# Club
|
# Club
|
||||||
migrate_club()
|
# migrate_club()
|
||||||
# Subscriptions
|
# Subscriptions
|
||||||
migrate_subscriptions()
|
# migrate_subscriptions()
|
||||||
# Counters
|
# Counters
|
||||||
migrate_counter()
|
# migrate_counter()
|
||||||
check_accounts()
|
# check_accounts()
|
||||||
# Accounting
|
# Accounting
|
||||||
migrate_accounting()
|
# migrate_accounting()
|
||||||
reset_index('core', 'club', 'subscription', 'accounting', 'eboutic', 'launderette', 'counter')
|
reset_index('core', 'club', 'subscription', 'accounting', 'eboutic', 'launderette', 'counter')
|
||||||
end = datetime.datetime.now()
|
# end = datetime.datetime.now()
|
||||||
print("End at %s" % end)
|
print("End at %s" % end)
|
||||||
print("Running time: %s" % (end-start))
|
print("Running time: %s" % (end-start))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user