From 7cccbad9e50163d75dcd60abbb335ec660cda096 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Sun, 24 Mar 2019 21:29:10 +0100 Subject: [PATCH] Very minimal staff management --- copanier/config.py | 1 + copanier/models.py | 4 ++++ copanier/templates/base.html | 8 +++++--- copanier/templates/delivery.html | 8 +++++--- copanier/templates/edit_delivery.html | 1 + 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/copanier/config.py b/copanier/config.py index 96278ee..3acddf4 100644 --- a/copanier/config.py +++ b/copanier/config.py @@ -11,6 +11,7 @@ SMTP_HOST = "mail.gandi.net" SMTP_PASSWORD = "" SMTP_LOGIN = "" FROM_EMAIL = "contact@epinamap.org" +STAFF = ["yohanboniface@free.fr"] def init(): diff --git a/copanier/models.py b/copanier/models.py index 6c51f0c..5a8d364 100644 --- a/copanier/models.py +++ b/copanier/models.py @@ -82,6 +82,10 @@ class Person(Base): first_name: str = "" last_name: str = "" + @property + def is_staff(self): + return self.email in config.STAFF + @dataclass class Product(Base): diff --git a/copanier/templates/base.html b/copanier/templates/base.html index 3b8c504..f5ff2fe 100644 --- a/copanier/templates/base.html +++ b/copanier/templates/base.html @@ -19,9 +19,11 @@ diff --git a/copanier/templates/delivery.html b/copanier/templates/delivery.html index 80bbfa1..2d41ea4 100644 --- a/copanier/templates/delivery.html +++ b/copanier/templates/delivery.html @@ -41,9 +41,6 @@
{% endblock body %} diff --git a/copanier/templates/edit_delivery.html b/copanier/templates/edit_delivery.html index 557abc2..4eb3fff 100644 --- a/copanier/templates/edit_delivery.html +++ b/copanier/templates/edit_delivery.html @@ -31,6 +31,7 @@ +
{% if delivery %}

Importer des produits (CSV)

Colonnes: ref*, name*, price*, description