From b2b512f3bec6ef72a8c0a395fe65996290d6b969 Mon Sep 17 00:00:00 2001 From: Sanj Date: Sun, 6 Mar 2011 18:12:33 +0530 Subject: [PATCH] best practice stories --- itf/bestpractices/admin.py | 6 +++++- itf/bestpractices/models.py | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/itf/bestpractices/admin.py b/itf/bestpractices/admin.py index 1a0ae99..1313522 100644 --- a/itf/bestpractices/admin.py +++ b/itf/bestpractices/admin.py @@ -5,12 +5,16 @@ class ImageInline(admin.StackedInline): model = BestPracticeImage extra = 2 +class StoryInline(admin.StackedInline): + model = BestPracticeStory + extra = 3 + class LinkInline(admin.StackedInline): model = BestPracticeLink extra = 3 class BestPracticeAdmin(admin.ModelAdmin): - inlines = [ImageInline, LinkInline] + inlines = [ImageInline, LinkInline, StoryInline] list_filter = ['category'] diff --git a/itf/bestpractices/models.py b/itf/bestpractices/models.py index 004d4cd..ecd2365 100644 --- a/itf/bestpractices/models.py +++ b/itf/bestpractices/models.py @@ -11,6 +11,7 @@ class BestPractice(ItfModel): guideline = models.TextField(blank=True) guidelines = models.ManyToManyField("Guideline", null=True, blank=True) law = models.TextField(blank=True) + law_image = models.ImageField(upload_to='upload/images/bestpractices/law/', blank=True, null=True) theatre = models.TextField(blank=True, help_text="Spotlight on Theatre text") quick_howto = models.TextField(blank=True) tags = TagField(blank=True, help_text="Enter as many tags as you like, separated by commas.") @@ -65,6 +66,14 @@ class BestPractice(ItfModel): }) return images +class BestPracticeStory(models.Model): + text = models.TextField() + image = models.ImageField(upload_to='upload/images/bestpractices/stories/') + bestpractice = models.ForeignKey(BestPractice) + + def __unicode__(self): + return self.text + class BestPracticeCategory(models.Model): name = models.CharField(max_length=256)