Skip to content

Commit

Permalink
Version Nummer Helper eingefügt
Browse files Browse the repository at this point in the history
- im dev wird aktuelle Version als Badge im Footer angezeigt
  • Loading branch information
clerie committed Mar 17, 2019
1 parent 9b0396c commit d126c47
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
11 changes: 10 additions & 1 deletion demostat/__init__.py
@@ -1,2 +1,11 @@
def __to_version(release):
v = release.split("-")
return v[0]

def __is_develop(release):
return release.endswith("-dev")

name = "demostat"
version = "0.1.1-dev"
release = "0.1.1-dev"
version = __to_version(release)
develop = __is_develop(release)
1 change: 1 addition & 0 deletions demostat/templates/demostat/base.html
Expand Up @@ -51,6 +51,7 @@
{% if SITE_IMPRINT_URL %}<a href="{{ SITE_IMPRINT_URL }}" target="_blank">Impressum</a>{% endif %}
{% if SITE_PRIVACY_URL %}<a href="{{ SITE_PRIVACY_URL }}" target="_blank">Datenschutz</a>{% endif %}
<a href="https://github.com/demostat/demostat" target="_blank">Quellcode auf GitHub</a>
{% if DEMOSTAT_DEVELOP %}<span class="badge badge-danger">{{ DEMOSTAT_RELEASE }}</span>{% endif %}
</div>
</footer>

Expand Down
10 changes: 10 additions & 0 deletions demostat/views.py
Expand Up @@ -9,22 +9,32 @@
import datetime
from .utils import Querystring

from . import version, release, develop

from .models import Organisation, Demo, Tag

def make_context_object(context):
s = {}

s['DEMOSTAT_VERSION'] = version
s['DEMOSTAT_RELEASE'] = release
s['DEMOSTAT_DEVELOP'] = develop

try:
s['SITE_TITLE'] = settings.SITE_TITLE
except:
pass

try:
s['SITE_IMPRINT_URL'] = settings.SITE_IMPRINT_URL
except:
pass

try:
s['SITE_PRIVACY_URL'] = settings.SITE_PRIVACY_URL
except:
pass

return {**s, **context}

def to_slug_array(dicts):
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -28,7 +28,7 @@
# The short X.Y version
version = demostat.version
# The full version, including alpha/beta/rc tags
release = demostat.version
release = demostat.release


# -- General configuration ---------------------------------------------------
Expand Down

0 comments on commit d126c47

Please sign in to comment.