aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django/git_wiki/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'bn_django/git_wiki/models.py')
-rw-r--r--bn_django/git_wiki/models.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/bn_django/git_wiki/models.py b/bn_django/git_wiki/models.py
index 78a26f6..ba133b6 100644
--- a/bn_django/git_wiki/models.py
+++ b/bn_django/git_wiki/models.py
@@ -83,7 +83,12 @@ class Item(models.Model):
def get_admin_url(self):
return "%s/k/%s/" % (ADMIN_URL, self.id)
-
+ def isfig(self):
+ if self.name.find('.') != -1:
+ return True
+ else:
+ return False
+
def update(self):
import commands
if (not self.id): return
@@ -94,6 +99,11 @@ class Item(models.Model):
self.size = commands.getoutput(GITPREFIX + ' cat-file -s ' + self.id)
self.save()
+ def getfile(self):
+ import commands
+ if (not self.id): return
+ return open(str(GITWIKI_DIR + '/objects/' + self.id[:2] + '/' + self.id[2:]),'r')
+
class Commit(models.Model):
id = models.CharField("hash", maxlength=40,blank=False,primary_key=True)
rawdiff = models.TextField("ASCII contents of full commit diff")