front page image slider admin

This commit is contained in:
Sanj 2011-11-01 01:38:22 +00:00
parent 69b4ba873e
commit 219352ff42
3 changed files with 15 additions and 3 deletions

View File

@ -53,12 +53,13 @@ class BestPractice(ItfModel):
}
def main_image(self):
if self.display_image:
return self.display_image
imgs = self.get_images()
if len(imgs) > 0:
img = imgs[0]
return img.image
else:
return None
return None
def list_dict(self):
return {

View File

@ -16,6 +16,10 @@ class MenuHeadingAdmin(admin.ModelAdmin):
list_display = ('name', 'order',)
list_editable = ['order']
class FrontImageAdmin(admin.ModelAdmin):
pass
admin.site.register(MenuHeading, MenuHeadingAdmin)
admin.site.register(SliderBox, SliderBoxAdmin)
admin.site.register(FrontImage, FrontImageAdmin)

View File

@ -1,5 +1,12 @@
from django.db import models
class FrontImage(models.Model):
image = models.ImageField(upload_to='upload/frontImages/')
caption = models.TextField(blank=True)
def __unicode__(self):
return self.image.url
class SliderBox(models.Model):
title = models.CharField(max_length=64)
image = models.ImageField(upload_to='upload/sliderImages/')