Created
March 1, 2012 13:32
-
-
Save carlosrberto/1949838 to your computer and use it in GitHub Desktop.
django template revision number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from django import template | |
from django.utils import version | |
from settings import PROJECT_PATH | |
STATIC_PATH = os.path.join(PROJECT_PATH, '../static') | |
register = template.Library() | |
@register.simple_tag | |
def revision_number(): | |
rev = version.get_svn_revision(STATIC_PATH) | |
return rev.split('-')[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load svn_revision %} | |
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>title</title> | |
<link rel="stylesheet" href="path/to/file.css?rev={% revision_number %}" /> | |
</head> | |
<body> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut.</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment