Remove unused git version

This commit is contained in:
Gabriel Augendre 2019-06-09 17:19:12 +02:00
parent 49e247dd0d
commit 4caa431afb
4 changed files with 0 additions and 29 deletions

View file

@ -13,7 +13,6 @@ dj-database-url = "*"
django-dotenv = "*"
plotly = "*"
django-mailgun = "*"
gitpython = "*"
user-agents = "*"
whitenoise = "*"
requests = ">=2.20.0"

View file

@ -1,23 +0,0 @@
from django.conf import settings
from git import Repo
def get_git_version():
"""
Get the git version of the site.
"""
try:
repo = Repo(settings.BASE_DIR)
branch = repo.active_branch
commit = repo.head.commit.hexsha
name = u'{0}/{1}'.format(branch, commit[:7])
return {'name': name, 'url': u'{}/tree/{}'.format(settings.REPO_URL, commit)}
except (KeyError, TypeError):
return {'name': '', 'url': ''}
def git_version(request):
"""
A context processor to include the git version on all pages.
"""
return {'git_version': get_git_version()}

View file

@ -8,9 +8,6 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="{{ git_version.url }}">Version : {{ git_version.name }}</a>
</li>
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"

View file

@ -81,7 +81,6 @@ TEMPLATES = [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'gym.context_processors.git_version',
],
},
},
@ -139,4 +138,3 @@ EMAIL_BACKEND = 'django_mailgun.MailgunBackend'
MAILGUN_ACCESS_KEY = os.getenv('MAILGUN_ACCESS_KEY', '')
MAILGUN_SERVER_NAME = os.getenv('MAILGUN_SERVER_NAME', '')
REPO_URL = 'https://github.com/Crocmagnon/workout'