From c62d3f4f4a4c3c036d68ebfd5000705417e721be Mon Sep 17 00:00:00 2001 From: Skia Date: Fri, 2 Sep 2016 21:21:57 +0200 Subject: [PATCH] Add old membership views --- club/migrations/0003_auto_20160902_2042.py | 19 +++++ club/models.py | 27 +++++-- club/templates/club/club_base.jinja | 8 +++ club/templates/club/club_members.jinja | 5 ++ club/templates/club/club_old_members.jinja | 29 ++++++++ club/urls.py | 2 + club/views.py | 34 ++++++++- locale/fr/LC_MESSAGES/django.mo | Bin 33246 -> 33458 bytes locale/fr/LC_MESSAGES/django.po | 79 +++++++++++++-------- migrate.py | 26 +++---- 10 files changed, 179 insertions(+), 50 deletions(-) create mode 100644 club/migrations/0003_auto_20160902_2042.py create mode 100644 club/templates/club/club_old_members.jinja diff --git a/club/migrations/0003_auto_20160902_2042.py b/club/migrations/0003_auto_20160902_2042.py new file mode 100644 index 00000000..f0d7e014 --- /dev/null +++ b/club/migrations/0003_auto_20160902_2042.py @@ -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'), + ), + ] diff --git a/club/models.py b/club/models.py index 44aeb373..19b2caa1 100644 --- a/club/models.py +++ b/club/models.py @@ -5,6 +5,7 @@ from django.utils.translation import ugettext_lazy as _ from django.core.exceptions import ValidationError from django.db import IntegrityError, transaction from django.core.urlresolvers import reverse +from django.utils import timezone from core.models import User, MetaGroup, Group, SithFile 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 """ - if user.is_in_group(settings.SITH_MAIN_BOARD_GROUP): - return True - return False + return user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) 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) 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) role = models.IntegerField(_('role'), choices=sorted(settings.SITH_CLUB_ROLES.items()), 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(): 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): 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 "" ) + 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): return reverse('club:club_members', kwargs={'club_id': self.club.id}) diff --git a/club/templates/club/club_base.jinja b/club/templates/club/club_base.jinja index 240fffe6..16ea246a 100644 --- a/club/templates/club/club_base.jinja +++ b/club/templates/club/club_base.jinja @@ -18,6 +18,14 @@ >{% trans %}Members{% endtrans %} {% endif %} + {% if can_view(club, user) %} + {% trans %}Old members{% endtrans %} + {% endif %} + {% if can_view(club, user) %} {% trans %}User{% endtrans %} {% trans %}Role{% endtrans %} {% trans %}Description{% endtrans %} + {% trans %}Since{% endtrans %} {% for m in club.members.filter(end_date=None).order_by('-role').all() %} @@ -15,6 +16,10 @@ {{ user_profile_link(m.user) }} {{ settings.SITH_CLUB_ROLES[m.role] }} {{ m.description }} + {{ m.start_date }} + {% if m.can_be_edited_by(user) %} + {% trans %}Mark as old{% endtrans %} + {% endif %} {% endfor %} diff --git a/club/templates/club/club_old_members.jinja b/club/templates/club/club_old_members.jinja new file mode 100644 index 00000000..4c99697b --- /dev/null +++ b/club/templates/club/club_old_members.jinja @@ -0,0 +1,29 @@ +{% extends "club/club_base.jinja" %} +{% from 'core/macros.jinja' import user_profile_link %} + +{% block club %} +

{% trans %}Club old members{% endtrans %}

+ + + + + + + + + + {% for m in club.members.exclude(end_date=None).order_by('-role', '-end_date').all() %} + + + + + + + + {% endfor %} + +
{% trans %}User{% endtrans %}{% trans %}Role{% endtrans %}{% trans %}Description{% endtrans %}{% trans %}From{% endtrans %}{% trans %}To{% endtrans %}
{{ user_profile_link(m.user) }}{{ settings.SITH_CLUB_ROLES[m.role] }}{{ m.description }}{{ m.start_date }}{{ m.end_date }}
+{% endblock %} + + + diff --git a/club/urls.py b/club/urls.py index 497c0818..50625ebf 100644 --- a/club/urls.py +++ b/club/urls.py @@ -8,7 +8,9 @@ urlpatterns = [ url(r'^(?P[0-9]+)/$', ClubView.as_view(), name='club_view'), url(r'^(?P[0-9]+)/edit$', ClubEditView.as_view(), name='club_edit'), url(r'^(?P[0-9]+)/members$', ClubMembersView.as_view(), name='club_members'), + url(r'^(?P[0-9]+)/elderlies$', ClubOldMembersView.as_view(), name='club_old_members'), url(r'^(?P[0-9]+)/prop$', ClubEditPropView.as_view(), name='club_prop'), url(r'^(?P[0-9]+)/tools$', ClubToolsView.as_view(), name='tools'), + url(r'^membership/(?P[0-9]+)/set_old$', MembershipSetOldView.as_view(), name='membership_set_old'), ] diff --git a/club/views.py b/club/views.py index 5798158c..82bffb56 100644 --- a/club/views.py +++ b/club/views.py @@ -4,7 +4,9 @@ from django.views.generic import ListView, DetailView from django.views.generic.edit import UpdateView, CreateView from django.forms import CheckboxSelectMultiple 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 club.models import Club, Membership @@ -102,6 +104,19 @@ class ClubMembersView(CanViewMixin, UpdateView): kwargs['tab'] = "members" 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): """ Edit a Club's main informations (for the club's members) @@ -139,3 +154,20 @@ class ClubCreateView(CanEditPropMixin, CreateView): fields = ['name', 'unix_name', 'parent'] 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})) + diff --git a/locale/fr/LC_MESSAGES/django.mo b/locale/fr/LC_MESSAGES/django.mo index 763b35c3b74dfb6e47010a7bec2343ec8d83c97a..a89e6afe490b81aeab75783825c792c03f092bde 100644 GIT binary patch delta 12141 zcmYk?2V7R=`^WLaQicNJ0#`V2pdt=b+#v3iTNDjc+@OMcJ!+XFD=SxOsaaZ9E-FWv zE6cRpnVDMVtX!p5j(+_=-{)NZU!K?N;(cHDeV==s^E_a`-}z^Kx6JbOoR9EdJpISIvL1E_vY^j^l%EF(0aV{lE!DS|~&^|2U&4N*I3g&LqE7Q`OthXYalhoJ7ChynN#M&LrL zUxym!GYn*YXCDQv_#4zt9-sz}spWR8jZx$c&>y>D0Zhd(9E3XZaTtLgq8`a^RKHVL z2rr^e^d4%#{li`4sy64ZmoASA9obRT%XS%cbisApfx=NMFO3?o8tReM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^G8lWR; zN0Lz;k3bDL8r6OxYGK~yla3;DP_?bB|l&m0rRYgsxCaS&(YKPmPCYETXphp#>C}?KWQTJ*NY9*`9 zEvPL&fZCD6s2#hA+Ty=aw9Q|N$kI7*54WqM$LEv zs>5mK64X|2Fw;>J-iaDupLr6!$b0GshbFBf+?%fPl?H#8%7kOoQ<}5C_ke74RM6nOk^H6Ip-nz=*LoO zb^moFkb4tv5;}GfM=2l1iiB>Dj)DvjhbxJ*)^-%-N0fV_j(3O|c5X^W4gW5HYpiZP zdP?zQFO?^VZo~#cM|WZ?QIhlC45p(n<(h8MxlUQfQoKO?UfWinoy%=I@D+6ri5JA4m(IUq<>RzH zM!6O)#$CiEB3+$uoTmIP2H|4-UH5+r@h`E5iuHt!5)62fx}3ya@;`}dI>GT7bvnK@ zUr^pbj3j^C>Kd9SslP>e5Z*%{qATSPj38LQ`rl<3s}aD6B$^Cbp4xz)FOUj^Yh1e*UrsQ^>Oto*PyXMzWgFQNYxi$I?ttihUauMT*(!{IOw^&7)Q%^zS>DHx)wMT<59;w{UFb0?T?ZUP#s5e z!k-1r;#|Fq8eUcM?U<6E<(o| zVlZuDiDaTEZENFP>hnc|u1~ z7bk~pmyhL}IbV_RvHITDel3=@@+w?G%;cIPY8O#DIdw$OZatEd)2CD@;g`NGW}8p? zuo_pq)4SC??v-AxcD#T3q=qAN`BthCTe(vDi#EfurcX~g;+x*K=fo`OzxS@\n" "Language-Team: AE info \n" @@ -17,7 +17,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: 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 #: launderette/models.py:60 launderette/models.py:85 msgid "name" @@ -63,7 +63,7 @@ msgstr "IBAN" msgid "account number" 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 msgid "club" msgstr "club" @@ -85,12 +85,12 @@ msgstr "Compte club" msgid "%(club_account)s on %(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 msgid "start date" 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" msgstr "date de fin" @@ -163,6 +163,7 @@ msgid "target type" msgstr "type de cible" #: 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 msgid "User" msgstr "Utilisateur" @@ -324,7 +325,7 @@ msgstr "Nouveau compte club" #: accounting/templates/accounting/bank_account_list.jinja:21 #: accounting/templates/accounting/club_account_details.jinja:53 #: accounting/templates/accounting/journal_details.jinja:66 -#: club/templates/club/club_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/user_tools.jinja:33 #: counter/templates/counter/counter_list.jinja:20 @@ -507,11 +508,11 @@ msgstr "Types simplifiés" msgid "New simplified type" msgstr "Nouveau type simplifié" -#: club/models.py:20 +#: club/models.py:21 msgid "unix name" msgstr "nom unix" -#: club/models.py:24 +#: club/models.py:25 msgid "" "Enter a valid unix name. This value may contain only letters, numbers ./-/_ " "characters." @@ -519,50 +520,50 @@ msgstr "" "Entrez un nom UNIX valide. Cette valeur peut contenir uniquement des " "lettres, des nombres, et les caractères ./-/_" -#: club/models.py:29 +#: club/models.py:30 msgid "A club with that unix name already exists." 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" msgstr "Adresse" -#: club/models.py:38 core/models.py:117 +#: club/models.py:39 core/models.py:117 msgid "home" msgstr "home" -#: club/models.py:46 +#: club/models.py:47 msgid "You can not make loops in 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" 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 #: launderette/models.py:126 msgid "user" msgstr "nom d'utilisateur" -#: club/models.py:149 core/models.py:135 +#: club/models.py:148 core/models.py:135 msgid "role" 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 msgid "description" msgstr "description" -#: club/models.py:156 +#: club/models.py:155 msgid "User must be subscriber to take part to a 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" msgstr "L'utilisateur est déjà membre de ce club" -#: club/models.py:162 +#: club/models.py:166 msgid "past member" msgstr "Anciens membres" @@ -570,12 +571,16 @@ msgstr "Anciens membres" msgid "Members" 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 msgid "Tools" msgstr "Outils" -#: club/templates/club/club_base.jinja:42 +#: club/templates/club/club_base.jinja:50 #: counter/templates/counter/counter_list.jinja:23 msgid "Props" msgstr "Propriétés" @@ -606,18 +611,41 @@ msgid "Club members" msgstr "Membres du club" #: club/templates/club/club_members.jinja:9 +#: club/templates/club/club_old_members.jinja:9 msgid "Role" msgstr "Rôle" #: club/templates/club/club_members.jinja:10 +#: club/templates/club/club_old_members.jinja:10 msgid "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 msgid "Add" 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 #: core/templates/core/user_tools.jinja:58 msgid "Club tools" @@ -2218,10 +2246,6 @@ msgstr "Jetons" msgid "Type" msgstr "Type" -#: launderette/templates/launderette/launderette_admin.jinja:45 -msgid "Since" -msgstr "Depuis" - #: launderette/templates/launderette/launderette_book.jinja:11 msgid "Choose" 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" msgstr "" "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" diff --git a/migrate.py b/migrate.py index a1aa79a0..b22d902d 100644 --- a/migrate.py +++ b/migrate.py @@ -26,14 +26,7 @@ from subscription.models import Subscription, Subscriber from eboutic.models import Invoice, InvoiceItem from accounting.models import BankAccount, ClubAccount, GeneralJournal, Operation, AccountingType, Company, SimplifiedAccountingType -db = MySQLdb.connect( - host="ae-db", - user="taiste_rw", - passwd=input("password: "), - db="ae2-taiste", - charset='utf8', - use_unicode=True) - +db = MySQLdb.connect(**settings.OLD_MYSQL_INFOS) start = datetime.datetime.now() def reset_index(*args): @@ -245,6 +238,7 @@ def migrate_club(): user = User.objects.filter(id=m['id_utilisateur']).first() if club and user: new = Membership( + id=Membership.objects.count()+1, club=club, user=user, start_date=m['date_debut'], @@ -259,7 +253,7 @@ def migrate_club(): print("Clubs memberships migrated at %s" % datetime.datetime.now()) print("Running time: %s" % (datetime.datetime.now()-start)) - migrate_clubs() + # migrate_clubs() migrate_club_memberships() def migrate_subscriptions(): @@ -953,18 +947,18 @@ def migrate_accounting(): def main(): print("Start at %s" % start) # Core - migrate_core() + # migrate_core() # Club - migrate_club() + # migrate_club() # Subscriptions - migrate_subscriptions() + # migrate_subscriptions() # Counters - migrate_counter() - check_accounts() + # migrate_counter() + # check_accounts() # Accounting - migrate_accounting() + # migrate_accounting() reset_index('core', 'club', 'subscription', 'accounting', 'eboutic', 'launderette', 'counter') - end = datetime.datetime.now() + # end = datetime.datetime.now() print("End at %s" % end) print("Running time: %s" % (end-start))