front page image slider admin
This commit is contained in:
parent
69b4ba873e
commit
219352ff42
|
@ -53,11 +53,12 @@ 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
|
||||
|
||||
def list_dict(self):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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/')
|
||||
|
|
Loading…
Reference in New Issue
Block a user