summaryrefslogtreecommitdiffstats
path: root/bn_django/git_browse/models.py
diff options
context:
space:
mode:
authorbnewbold <bnewbold@manus.(none)>2007-02-08 00:40:46 -0800
committerbnewbold <bnewbold@manus.(none)>2007-02-08 00:40:46 -0800
commit9077a48cf9aeb06ddd751cfa7497fd636ed489a6 (patch)
treed2e946818d743c9c5b72883d60a208b07c9f7710 /bn_django/git_browse/models.py
parentb88372f0327976c31e6b508b26729bab60743f82 (diff)
downloadbnewnet-9077a48cf9aeb06ddd751cfa7497fd636ed489a6.tar.gz
bnewnet-9077a48cf9aeb06ddd751cfa7497fd636ed489a6.zip
first work on git_browser app
for now just returns raw text from shell commands also tries to track repositories... but UI for selecting FilePathFields sucks so have to chose slugs manually for now... i think django support for this will come soon so i'm not bothering.
Diffstat (limited to 'bn_django/git_browse/models.py')
-rw-r--r--bn_django/git_browse/models.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/bn_django/git_browse/models.py b/bn_django/git_browse/models.py
new file mode 100644
index 0000000..93a22b3
--- /dev/null
+++ b/bn_django/git_browse/models.py
@@ -0,0 +1,35 @@
+from django.db import models
+from django.conf import settings
+
+try:
+ GITBROWSE_BASE = settings.GITBROWSE_BASE
+except AttributeError:
+ GITBROWSE_BASE='/home'
+
+try:
+ ADMIN_URL = settings.ADMIN_URL
+except AttributeError:
+ ADMIN_URL='/admin'
+if ADMIN_URL[-1] == '/':
+ ADMIN_URL=ADMIN_URL[:-1]
+
+
+# Create your models here.
+class Repository(models.Model):
+ path = models.FilePathField("relative path to repository", path=GITBROWSE_BASE,recursive=True,match="^.*\.git$",unique=True,blank=False)
+ #path = models.FilePathField("relative path to repository", path='/home/bnewbold/code/',recursive=True,match=".*\.git$",unique=True,blank=False)
+ name = models.CharField(_("name"), maxlength=80)
+ slug = models.SlugField(prepopulate_from=("path",),unique=True)
+ git_version = models.CharField(_("git version"), maxlength=100,default="git version 1.4.4", blank=True, help_text="Output of \'git --version\'")
+
+ description = models.TextField("description of repo",blank=True)
+
+ class Admin:
+ ordering = ['slug']
+
+ def __str__(self):
+ return self.name
+ def get_absolute_url(self):
+ return "/code/%s/" % self.slug
+ def get_admin_url(self):
+ return "%s/code/repository/%s/" % (ADMIN_URL, self.slug)