mirror of https://gitlab.federez.net/re2o/re2o
committed by
chirac
7 changed files with 233 additions and 3 deletions
@ -0,0 +1,54 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.11.23 on 2019-09-21 18:23 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.conf import settings |
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
from django.utils import timezone |
|||
import re2o.mixins |
|||
|
|||
|
|||
def create_current_mandate(apps, schema_editor): |
|||
AssoOption = apps.get_model('preferences', 'AssoOption') |
|||
Mandate = apps.get_model('preferences', 'Mandate') |
|||
Adherent = apps.get_model('users', 'Adherent') |
|||
pres_name = AssoOption.objects.get_or_create()[0].pres_name |
|||
l = pres_name.split(' ') |
|||
try: |
|||
name, surname = l[0], l[1] |
|||
president = Adherent.objects.get(name__icontains=name, surname__icontains=surname) |
|||
Mandate.objects.create( |
|||
president=president, |
|||
start_date=timezone.now(), |
|||
) |
|||
except Exception as e: |
|||
print("Warning : I was unable to find an adherent corresponding to %s. You might want to edit your preferences afterward." % pres_name) |
|||
|
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
|||
('preferences', '0062_auto_20190910_1909'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='Mandate', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('start_date', models.DateTimeField(verbose_name='start date')), |
|||
('end_date', models.DateTimeField(blank=True, null=True, verbose_name='end date')), |
|||
('president', models.ForeignKey(blank=True, help_text='Displayed on subscription vouchers', null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='President of the association')), |
|||
], |
|||
options={ |
|||
'verbose_name': 'Mandate', |
|||
'verbose_name_plural': 'Mandates', |
|||
'permissions': (('view_mandate', 'Can view a mandate'),), |
|||
}, |
|||
bases=(re2o.mixins.RevMixin, re2o.mixins.AclMixin, models.Model), |
|||
), |
|||
migrations.RunPython(create_current_mandate), |
|||
] |
|||
@ -0,0 +1,52 @@ |
|||
{% comment %} |
|||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
se veut agnostique au réseau considéré, de manière à être installable en |
|||
quelques clics. |
|||
|
|||
Copyright © 2018 Hugo Levy-Falk |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; either version 2 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License along |
|||
with this program; if not, write to the Free Software Foundation, Inc., |
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
{% endcomment %} |
|||
{% load i18n %} |
|||
{% load acl %} |
|||
{% load logs_extra %} |
|||
|
|||
<table class="table table-striped"> |
|||
<thead> |
|||
<tr> |
|||
<th>{% trans "Start date" %}</th> |
|||
<th>{% trans "End date" %}</th> |
|||
<th>{% trans "President" %}</th> |
|||
<th></th> |
|||
</tr> |
|||
</thead> |
|||
{% for mandate in mandate_list %} |
|||
<tr> |
|||
<td>{{mandate.start_date|date:"d/m/Y"}}</td> |
|||
<td>{% if mandate.end_date %}{{mandate.end_date|date:"d/m/Y"}}{% else %}{% trans "In progress." %}{% endif %}</td> |
|||
<td><a href="{% url 'users:profil' userid=mandate.president.id %}">{{mandate.president.name}} {{mandate.president.surname}}</a></td> |
|||
<td class="text-right"> |
|||
{% can_edit mandate%} |
|||
{% include 'buttons/edit.html' with href='preferences:edit-mandate' id=mandate.id %} |
|||
{% acl_end %} |
|||
{% can_delete mandate %} |
|||
{% include 'buttons/suppr.html' with href='preferences:del-mandate' id=mandate.id %} |
|||
{% acl_end %} |
|||
{% history_button mandate %} |
|||
</td> |
|||
</tr> |
|||
{% endfor %} |
|||
</table> |
|||
|
|||
Loading…
Reference in new issue