front page image slider admin
This commit is contained in:
parent
69b4ba873e
commit
219352ff42
|
@ -53,12 +53,13 @@ class BestPractice(ItfModel):
|
||||||
}
|
}
|
||||||
|
|
||||||
def main_image(self):
|
def main_image(self):
|
||||||
|
if self.display_image:
|
||||||
|
return self.display_image
|
||||||
imgs = self.get_images()
|
imgs = self.get_images()
|
||||||
if len(imgs) > 0:
|
if len(imgs) > 0:
|
||||||
img = imgs[0]
|
img = imgs[0]
|
||||||
return img.image
|
return img.image
|
||||||
else:
|
return None
|
||||||
return None
|
|
||||||
|
|
||||||
def list_dict(self):
|
def list_dict(self):
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -16,6 +16,10 @@ class MenuHeadingAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'order',)
|
list_display = ('name', 'order',)
|
||||||
list_editable = ['order']
|
list_editable = ['order']
|
||||||
|
|
||||||
|
|
||||||
|
class FrontImageAdmin(admin.ModelAdmin):
|
||||||
|
pass
|
||||||
|
|
||||||
admin.site.register(MenuHeading, MenuHeadingAdmin)
|
admin.site.register(MenuHeading, MenuHeadingAdmin)
|
||||||
admin.site.register(SliderBox, SliderBoxAdmin)
|
admin.site.register(SliderBox, SliderBoxAdmin)
|
||||||
|
admin.site.register(FrontImage, FrontImageAdmin)
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
from django.db import models
|
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):
|
class SliderBox(models.Model):
|
||||||
title = models.CharField(max_length=64)
|
title = models.CharField(max_length=64)
|
||||||
image = models.ImageField(upload_to='upload/sliderImages/')
|
image = models.ImageField(upload_to='upload/sliderImages/')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user