3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-22 03:13:12 +00:00

Préférences pour l'utilisation du suivi de pinte

This commit is contained in:
Yoann Pétri 2018-12-21 21:54:39 +01:00
parent 1ddc0734dc
commit 00b0e8e0a0
5 changed files with 80 additions and 2 deletions

View file

@ -0,0 +1,37 @@
# Generated by Django 2.1 on 2018-12-21 20:51
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('gestion', '0002_pinte'),
]
operations = [
migrations.CreateModel(
name='HistoricalPinte',
fields=[
('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
('last_update_date', models.DateTimeField(blank=True, editable=False)),
('history_id', models.AutoField(primary_key=True, serialize=False)),
('history_change_reason', models.CharField(max_length=100, null=True)),
('history_date', models.DateTimeField()),
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
('current_owner', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
('previous_owner', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'historical pinte',
'ordering': ('-history_date', '-history_id'),
'get_latest_by': 'history_date',
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
]

View file

@ -233,3 +233,4 @@ class Pinte(models.Model):
current_owner = models.ForeignKey(User, on_delete=models.PROTECT, null=True, default=None, related_name="pinte_owned_currently")
previous_owner = models.ForeignKey(User, on_delete=models.PROTECT, null=True, default=None, related_name="pinte_owned_previously")
last_update_date = models.DateTimeField(auto_now=True)
history = HistoricalRecords()

View file

@ -0,0 +1,23 @@
# Generated by Django 2.1 on 2018-12-21 20:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('preferences', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='generalpreferences',
name='use_pinte_monitoring',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='historicalgeneralpreferences',
name='use_pinte_monitoring',
field=models.BooleanField(default=False),
),
]

View file

@ -30,6 +30,7 @@ class GeneralPreferences(models.Model):
secretary = models.CharField(max_length=255, blank=True)
brewer = models.CharField(max_length=255, blank=True)
grocer = models.CharField(max_length=255, blank=True)
use_pinte_monitoring = models.BooleanField(default=False)
history = HistoricalRecords()
class Cotisation(models.Model):

View file

@ -1,10 +1,11 @@
{% extends 'base.html' %}
{% block entete %}Administration{% endblock %}
{% block nav %}
{% block navbar %}
<ul>
<li><a href="#first" class="active">Message global</a></li>
<li><a href="#first">Message global</a></li>
<li><a href="#second">Site actif</a></li>
<li><a href="#third">Bureau</a></li>
<li><a href="#fourth">Autre</a></li>
</ul>
{% endblock %}
@ -75,6 +76,21 @@
{{form.brewer}}
</div>
</div>
</div>
</div>
</section>
<section id="fourth" class="main">
<div class="spotlight">
<div class="content">
<header class="major">
<h2>Autre</h2>
</header>
<div class="row uniform">
<div class="12u">
{{form.use_pinte_monitoring}}
<label for="{{form.is_active.id_for_label}}">Utiliser le suivi de pinte ?</label>
</div>
</div>
<div class="row uniform">
<div class="12u">
<button type="submit">Enregistrer</button>