From 3a0e84add08b0028d4b08728073ddf9945dc3be0 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 4 Mar 2007 12:33:37 -0800 Subject: added GITWIKI_DIR var and added new knowledge to frontpage --- bn_django/git_wiki/models.py | 12 ++++++------ bn_django/git_wiki/settings.py | 3 ++- bn_django/templates/frontpage.html | 1 + bn_django/templates/newknowldge_table | 13 +++++++++++++ bn_django/urls.py | 5 +++-- 5 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 bn_django/templates/newknowldge_table (limited to 'bn_django') diff --git a/bn_django/git_wiki/models.py b/bn_django/git_wiki/models.py index ae9ef79..060e9d5 100644 --- a/bn_django/git_wiki/models.py +++ b/bn_django/git_wiki/models.py @@ -150,10 +150,10 @@ def fromslug(reqslug): import commands if reqslug == '' or reqslug == '/': - f = open(GITWIKI_BASE + '/HEAD','r') + f = open(GITWIKI_DIR + '/HEAD','r') head = f.readline().strip().split()[1] f.close() - f = open(GITWIKI_BASE + '/'+head,'r') + f = open(GITWIKI_DIR + '/'+head,'r') hash = f.readline().strip() f.close() ret = Tree(id=hash) @@ -198,13 +198,13 @@ def fromslug(reqslug): def reposcan(): import os heads = dict() - for h in os.listdir(GITWIKI_BASE + '/refs/heads/'): - f = open(GITWIKI_BASE + '/refs/heads/' + h,'r') + for h in os.listdir(GITWIKI_DIR + '/refs/heads/'): + f = open(GITWIKI_DIR + '/refs/heads/' + h,'r') heads[h.strip()] = f.readline().strip() f.close() tags = dict() - for t in os.listdir(GITWIKI_BASE + '/refs/tags/'): - f = open(GITWIKI_BASE + '/refs/tags/' + t,'r') + for t in os.listdir(GITWIKI_DIR + '/refs/tags/'): + f = open(GITWIKI_DIR + '/refs/tags/' + t,'r') tags[t.strip()] = f.readline().strip() f.close() return (heads, tags) diff --git a/bn_django/git_wiki/settings.py b/bn_django/git_wiki/settings.py index ed07f53..965ac26 100644 --- a/bn_django/git_wiki/settings.py +++ b/bn_django/git_wiki/settings.py @@ -9,5 +9,6 @@ GITWIKI_NAME = '' # fill path to the git command GITCOMMAND = '/usr/local/bin/git' +GITWIKI_DIR = str(GITWIKI_BASE) + '/' + str(GITWIKI_NAME) + '.git' GITPREFIX = 'cd ' +str(GITWIKI_BASE) + '; ' + str(GITCOMMAND) + ' --git-dir=' \ - + str(GITWIKI_BASE) + '/' + GITWIKI_NAME + '.git' + + str(GITWIKI_DIR) diff --git a/bn_django/templates/frontpage.html b/bn_django/templates/frontpage.html index dc3f450..d3eed9d 100644 --- a/bn_django/templates/frontpage.html +++ b/bn_django/templates/frontpage.html @@ -39,6 +39,7 @@ For more recent content see the timeline
Latest knowledge
{% if latest_knowledge %} +{% include "newknowldge_table" %} {% else %} None yet!








diff --git a/bn_django/templates/newknowldge_table b/bn_django/templates/newknowldge_table new file mode 100644 index 0000000..686a12f --- /dev/null +++ b/bn_django/templates/newknowldge_table @@ -0,0 +1,13 @@ +{% if latest_knowledge %} + +{% for l in latest_knowledge %} + + + + +{% endfor %} +
+ {{ l.date }} + + {{ l.description|truncatewords:6 }}
+{% else %}No shortlog!{% endif %} diff --git a/bn_django/urls.py b/bn_django/urls.py index 2d833be..c413f39 100644 --- a/bn_django/urls.py +++ b/bn_django/urls.py @@ -1,13 +1,14 @@ from django.conf.urls.defaults import * from photos.models import Photo +import git_wiki.models urlpatterns = patterns('', # Example: # (r'^bn_django/', include('bn_django.foo.urls')), (r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'frontpage.html','extra_context':dict({ \ - 'latest_photos':Photo.objects.order_by('date')[:2] \ + 'latest_photos':Photo.objects.order_by('date')[:2], \ #'latest_comments':Photo.objects.order_by('date')[:4] \ - #'latest_knowledge':Photo.objects.order_by('date')[:4] \ + 'latest_knowledge':git_wiki.models.shortlog() \ })}), (r'^about/$', 'django.views.generic.simple.direct_to_template', {'template': 'about.html'}), (r'^credits/$', 'django.views.generic.simple.direct_to_template', {'template': 'credits.html'}), -- cgit v1.2.3