From f9be1484b125646b133b091ab28441a85ca58d28 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Tue, 10 Mar 2015 00:28:57 -0400 Subject: [PATCH] Show more fields in admin --- project/admin.py | 9 ++++++++- project/models.py | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/project/admin.py b/project/admin.py index f670181..22aaff1 100644 --- a/project/admin.py +++ b/project/admin.py @@ -6,6 +6,8 @@ from project.models import Project, DueDate, Category class DueDateInline(admin.TabularInline): model = DueDate + extra = 1 + class CategoryClass(OrderableAdmin): list_display = ('__unicode__', 'sort_order_display') @@ -15,6 +17,11 @@ class ProjectAdmin(admin.ModelAdmin): fields = ['title','description','status'] inlines = (DueDateInline,) + +class DueDateClass(admin.ModelAdmin): + list_display = ('__unicode__', 'project', 'due', 'completed') + + admin.site.register(Project, ProjectAdmin) -admin.site.register(DueDate) +admin.site.register(DueDate, DueDateClass) admin.site.register(Category, CategoryClass) \ No newline at end of file diff --git a/project/models.py b/project/models.py index 52fd6e2..1b53982 100644 --- a/project/models.py +++ b/project/models.py @@ -18,6 +18,9 @@ class Project(models.Model): created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) + def __unicode__(self): + return self.title + class Category(Orderable): title = models.CharField(max_length=256)