aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django/git_browse
diff options
context:
space:
mode:
Diffstat (limited to 'bn_django/git_browse')
-rw-r--r--bn_django/git_browse/models.py47
1 files changed, 28 insertions, 19 deletions
diff --git a/bn_django/git_browse/models.py b/bn_django/git_browse/models.py
index e805199..5241638 100644
--- a/bn_django/git_browse/models.py
+++ b/bn_django/git_browse/models.py
@@ -1,5 +1,6 @@
from django.db import models
from django.conf import settings
+from django.utils.translation import ugettext as _
try:
GITCOMMAND = settings.GITCOMMAND
@@ -19,12 +20,12 @@ class Repository(models.Model):
# path = models.FilePathField("relative path to repository", \
# path=GITBROWSE_BASE,recursive=True,match="\.git$",unique=True, \
# blank=False)
- path = models.CharField("path to git dir", maxlength=386, unique=True,\
+ path = models.CharField("path to git dir", max_length=386, unique=True,\
blank=False, default="/srv/git/")
- name = models.CharField(_("name"), maxlength=80, unique=True)
+ name = models.CharField(_("name"), max_length=80, unique=True)
slug = models.SlugField("short description of repo", unique=True,\
blank=False)
- git_version = models.CharField(_("git version"), maxlength=100, \
+ git_version = models.CharField(_("git version"), max_length=100, \
default="git version 1.4.4", blank=True, \
help_text="Output of \'git --version\'")
@@ -91,10 +92,10 @@ class Repository(models.Model):
class Tree(models.Model):
repo = models.ForeignKey(Repository)
- mode = models.CharField("file mode/permissions", blank=False,maxlength=4)
- path = models.CharField("relative path from repo base", maxlength=512)
- id = models.CharField("hash", maxlength=40,blank=False,primary_key=True)
- name = models.CharField("name of dir", maxlength=128,blank=False)
+ mode = models.CharField("file mode/permissions", blank=False,max_length=4)
+ path = models.CharField("relative path from repo base", max_length=512)
+ id = models.CharField("hash", max_length=40,blank=False,primary_key=True)
+ name = models.CharField("name of dir", max_length=128,blank=False)
type = 'tree'
class Admin:
@@ -149,11 +150,11 @@ def tree_from_str(s):
class Blob(models.Model):
repo = models.ForeignKey(Repository)
- mode = models.CharField("file mode/permissions", blank=False,maxlength=4)
- path = models.CharField("relative path from repo base", maxlength=512)
- id = models.CharField("hash", maxlength=40,blank=False,primary_key=True)
- name = models.CharField("name of dir", maxlength=128,blank=False)
- size = models.IntegerField("filesize in byte", maxlength=128,blank=False)
+ mode = models.CharField("file mode/permissions", blank=False,max_length=4)
+ path = models.CharField("relative path from repo base", max_length=512)
+ id = models.CharField("hash", max_length=40,blank=False,primary_key=True)
+ name = models.CharField("name of dir", max_length=128,blank=False)
+ size = models.IntegerField("filesize in byte", max_length=128,blank=False)
contents = models.TextField("ASCII contents of the file")
type='blob'
@@ -188,20 +189,20 @@ def blob_from_str(s):
class Commit(models.Model):
repo = models.ForeignKey(Repository)
- id = models.CharField("hash", maxlength=40,blank=False,primary_key=True)
+ id = models.CharField("hash", max_length=40,blank=False,primary_key=True)
rawdiff = models.TextField("ASCII contents of full commit diff")
commit_date = models.DateField("Date of commit to repository")
author_date = models.DateField("Date commit was writen/created")
- author = models.CharField("Name of commit author", maxlength=96)
+ author = models.CharField("Name of commit author", max_length=96)
author_email = models.CharField("Email address of commit author", \
- maxlength=196)
- committer = models.CharField("Name of committer", maxlength=96)
+ max_length=196)
+ committer = models.CharField("Name of committer", max_length=96)
committer_email = models.CharField("Email address of committer", \
- maxlength=196)
+ max_length=196)
comment = models.TextField("Notes on the commit")
- parenthash = models.CharField("parent's hash", maxlength=40)
+ parenthash = models.CharField("parent's hash", max_length=40)
#TODO: parent = models.ForeignKey()
- treehash = models.CharField("tree object's hash", maxlength=40)
+ treehash = models.CharField("tree object's hash", max_length=40)
tree = models.ForeignKey(Tree)
type='commit'
@@ -251,3 +252,11 @@ class Commit(models.Model):
else:
self.comment = '(none)'
return
+
+from django.contrib import admin
+
+admin.site.register(Repository)
+admin.site.register(Tree)
+admin.site.register(Blob)
+admin.site.register(Commit)
+