3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-29 08:02:25 +00:00

Add alcohol charter

This commit is contained in:
Yoann Pétri 2019-04-28 13:22:09 +02:00
parent 7a2c4e14ee
commit b82fef0634
6 changed files with 69 additions and 0 deletions

View file

@ -102,3 +102,14 @@ def menu():
return '<a target="_blank" href="' + gp.menu.url + '">' + str(gp.menu) + '</a>' return '<a target="_blank" href="' + gp.menu.url + '">' + str(gp.menu) + '</a>'
except: except:
return "Pas de document" return "Pas de document"
@register.simple_tag
def alcool_charter():
"""
A tag which returns :attr:`preferences.models.GeneralPreferences.alcool_charter`.
"""
gp,_ = GeneralPreferences.objects.get_or_create(pk=1)
try:
return '<a target="_blank" href="' + gp.alcohol_charter.url + '">' + str(gp.alcohol_charter) + '</a>'
except:
return "Pas de document"

View file

@ -0,0 +1,23 @@
# Generated by Django 2.1 on 2019-04-28 11:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('preferences', '0009_auto_20190227_0859'),
]
operations = [
migrations.AddField(
model_name='generalpreferences',
name='alchohol_charter',
field=models.FileField(blank=True, null=True, upload_to='', verbose_name='Charte alcool'),
),
migrations.AddField(
model_name='historicalgeneralpreferences',
name='alchohol_charter',
field=models.TextField(blank=True, max_length=100, null=True, verbose_name='Charte alcool'),
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 2.1 on 2019-04-28 11:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('preferences', '0010_auto_20190428_1319'),
]
operations = [
migrations.RenameField(
model_name='generalpreferences',
old_name='alchohol_charter',
new_name='alcohol_charter',
),
migrations.RenameField(
model_name='historicalgeneralpreferences',
old_name='alchohol_charter',
new_name='alcohol_charter',
),
]

View file

@ -116,6 +116,10 @@ class GeneralPreferences(models.Model):
""" """
The file of the menu The file of the menu
""" """
alcohol_charter = models.FileField(blank=True, null=True, verbose_name="Charte alcool")
"""
The file of the alcohol charter
"""
history = HistoricalRecords() history = HistoricalRecords()
class Cotisation(models.Model): class Cotisation(models.Model):

View file

@ -146,6 +146,12 @@
<label for="{{form.menu.id_for_label}}">Menu / Carte</label> <label for="{{form.menu.id_for_label}}">Menu / Carte</label>
</div> </div>
</div> </div>
<div class="row uniform">
<div class="12u">
{{form.alcohol_charter}}
<label for="{{form.menu.id_for_label}}">Charte alcool</label>
</div>
</div>
<div class="row uniform"> <div class="row uniform">
<div class="12u"> <div class="12u">
<button type="submit"><i class="fa fa-save"></i> Enregistrer</button> <button type="submit"><i class="fa fa-save"></i> Enregistrer</button>

View file

@ -10,6 +10,8 @@
<dd>{% autoescape off %}{% rules %}{% endautoescape %}</dd> <dd>{% autoescape off %}{% rules %}{% endautoescape %}</dd>
<dt>Carte</dt> <dt>Carte</dt>
<dd>{% autoescape off %}{% menu %}{% endautoescape %}</dd> <dd>{% autoescape off %}{% menu %}{% endautoescape %}</dd>
<dt>Charte alcool</dt>
<dd>{% autoescape off %}{% alcool_charter %}{% endautoescape %}</dd>
</dl> </dl>
</section> </section>
<section> <section>