[damned-lies/develop] fix: in case VERSION is not defined



commit 99fcc47f107054af3f4bb37c2a08a06ba3241542
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date:   Sun Sep 18 12:42:01 2022 +0200

    fix: in case VERSION is not defined

 common/views.py      | 3 ++-
 templates/about.html | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/common/views.py b/common/views.py
index 43178ded..08c1ee4b 100644
--- a/common/views.py
+++ b/common/views.py
@@ -43,10 +43,11 @@ def about(request):
     else:
         translator_credits = [obfuscate_email(line) for line in translator_credits.split("\n")]
     context = {
-        "damned_lies_version": settings.VERSION or "unknown",
+        "damned_lies_version": settings.VERSION if hasattr(settings, "VERSION") else None,
         "pageSection": "home",
         "translator_credits": translator_credits,
     }
+
     return render(request, "about.html", context)
 
 
diff --git a/templates/about.html b/templates/about.html
index 3faeda8c..34991826 100644
--- a/templates/about.html
+++ b/templates/about.html
@@ -6,7 +6,9 @@
 <div id="about_page" class="mainpage">
 
 <div class="row clearfix display-inline-block align-middle">
-    <button class="btn btn-info pull-right hidden-xs hidden-sm" style="margin: 20px 0 20px">{{ 
damned_lies_version }}</button>
+    {% if damned_lies_version %}
+        <button class="btn btn-info pull-right hidden-xs hidden-sm" style="margin: 20px 0 20px">{{ 
damned_lies_version }}</button>
+    {% endif %}
     <h1>{% trans "About Damned Lies" %}</h1>
 </div>
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]