[damned-lies] Basic display of vertimus models



commit 7cd3392bad0f2055a1e8b691d147ccba6b265977
Author: Claude Paroz <claude 2xlibre net>
Date:   Sun Nov 14 21:33:12 2010 +0100

    Basic display of vertimus models

 vertimus/admin.py  |   13 +++++++++++++
 vertimus/models.py |    5 ++++-
 2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/vertimus/admin.py b/vertimus/admin.py
new file mode 100644
index 0000000..ea4e0fa
--- /dev/null
+++ b/vertimus/admin.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+from django.contrib import admin
+
+from vertimus.models import StateDb, ActionDb
+
+class StateDbAdmin(admin.ModelAdmin):
+    raw_id_fields = ('branch', 'domain', 'person',)
+
+class ActionDbAdmin(admin.ModelAdmin):
+    list_display = ('__unicode__', 'state_db')
+
+admin.site.register(StateDb, StateDbAdmin)
+admin.site.register(ActionDb, ActionDbAdmin)
diff --git a/vertimus/models.py b/vertimus/models.py
index a59c6ab..7eeba16 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -53,6 +53,7 @@ class StateDb(models.Model):
 
     class Meta:
         db_table = 'state'
+        verbose_name = 'state'
         unique_together = ('branch', 'domain', 'language')
 
     def get_state(self):
@@ -61,7 +62,8 @@ class StateDb(models.Model):
         return state
 
     def __unicode__(self):
-        return self.name
+        return "%s: %s %s (%s - %s)" % (self.name, self.branch.module.name,
+            self.branch.name, self.language.name, self.domain.name)
 
     @models.permalink
     def get_absolute_url(self):
@@ -352,6 +354,7 @@ class ActionDb(models.Model):
 
     class Meta:
         db_table = 'action'
+        verbose_name = 'action'
 
     def __unicode__(self):
         return "%s (%s)" % (self.name, self.id)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]