16 lines
309 B
Python
16 lines
309 B
Python
from django import template
|
|
import subprocess
|
|
|
|
register = template.Library()
|
|
|
|
|
|
@register.simple_tag
|
|
def version(size):
|
|
command = ['git', 'rev-parse']
|
|
if size == 'short':
|
|
command += ['--short', 'HEAD']
|
|
else:
|
|
command += ['HEAD']
|
|
|
|
return subprocess.check_output(command).decode()
|