From c75882878ebad7d6837ab08db4f62afd61753303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Wed, 5 Oct 2022 23:32:44 +0200 Subject: [PATCH] Specify the version in copanier/__init__.py. And use it when loading the css files in order to not have the css files cached by the browsers after an update. Fix #124 --- copanier/__init__.py | 1 + copanier/templates/base.html | 66 ++++++++++++++++++++---------------- copanier/views/core.py | 2 ++ setup.cfg | 2 +- 4 files changed, 41 insertions(+), 30 deletions(-) diff --git a/copanier/__init__.py b/copanier/__init__.py index 5baa65c..9009f0c 100644 --- a/copanier/__init__.py +++ b/copanier/__init__.py @@ -5,6 +5,7 @@ from roll.extensions import simple_server, static from .models import Product, Person, Order, Delivery from .views.core import app +__version__ = "0.0.5" @minicli.cli() def shell(): diff --git a/copanier/templates/base.html b/copanier/templates/base.html index 2305b26..588e911 100644 --- a/copanier/templates/base.html +++ b/copanier/templates/base.html @@ -1,13 +1,13 @@ - {% import "includes/macros.html" as macros %} + - {% if title %}{{ title }} - {% endif %}{{ config.SITE_NAME }} + {% if title %}{{ title }} - {% endif %}{{ config.SITE_NAME }} - + @@ -18,11 +18,13 @@ {% endblock head %} + {% if config.DEMO_MODE %}
-

Le site est en mode démo. désactiver

+

Le site est en mode démo. désactiver

{% endif %} @@ -35,23 +37,27 @@ - - + - + + \ No newline at end of file diff --git a/copanier/views/core.py b/copanier/views/core.py index bc6cbb2..f15b17f 100644 --- a/copanier/views/core.py +++ b/copanier/views/core.py @@ -20,6 +20,8 @@ class Response(RollResponse): context["config"] = config context["request"] = self.request context["url_for"] = app.url_for + from .. import __version__ + context["version"] = __version__ if self.request.cookies.get("message"): try: message = json.loads(self.request.cookies["message"]) diff --git a/setup.cfg b/setup.cfg index 2c3fce1..919dc50 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = copanier -version = 0.0.4 +version-from-file = copanier/__init__.py [options] packages = find: