diff --git a/coopeV3/templatetags/vip.py b/coopeV3/templatetags/vip.py index 2f95e12..9939623 100644 --- a/coopeV3/templatetags/vip.py +++ b/coopeV3/templatetags/vip.py @@ -102,3 +102,14 @@ def menu(): return '' + str(gp.menu) + '' except: 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 '' + str(gp.alcohol_charter) + '' + except: + return "Pas de document" diff --git a/preferences/migrations/0010_auto_20190428_1319.py b/preferences/migrations/0010_auto_20190428_1319.py new file mode 100644 index 0000000..e263da6 --- /dev/null +++ b/preferences/migrations/0010_auto_20190428_1319.py @@ -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'), + ), + ] diff --git a/preferences/migrations/0011_auto_20190428_1321.py b/preferences/migrations/0011_auto_20190428_1321.py new file mode 100644 index 0000000..18ccc1a --- /dev/null +++ b/preferences/migrations/0011_auto_20190428_1321.py @@ -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', + ), + ] diff --git a/preferences/models.py b/preferences/models.py index a84b8d3..49c58ee 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -116,6 +116,10 @@ class GeneralPreferences(models.Model): """ 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() class Cotisation(models.Model): diff --git a/preferences/templates/preferences/general_preferences.html b/preferences/templates/preferences/general_preferences.html index 18b22b6..14238a3 100644 --- a/preferences/templates/preferences/general_preferences.html +++ b/preferences/templates/preferences/general_preferences.html @@ -146,6 +146,12 @@ +
+
+ {{form.alcohol_charter}} + +
+
diff --git a/templates/footer.html b/templates/footer.html index 5d00040..9399c5b 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -10,6 +10,8 @@
{% autoescape off %}{% rules %}{% endautoescape %}
Carte
{% autoescape off %}{% menu %}{% endautoescape %}
+
Charte alcool
+
{% autoescape off %}{% alcool_charter %}{% endautoescape %}