noteworthy images
This commit is contained in:
parent
aa6954ea67
commit
6b5fd58eca
|
@ -7,6 +7,11 @@ class ProjectImageInline(admin.TabularInline):
|
||||||
extra = 20
|
extra = 20
|
||||||
|
|
||||||
|
|
||||||
|
class NoteworthyImageInline(admin.TabularInline):
|
||||||
|
model = NoteworthyImage
|
||||||
|
extra = 3
|
||||||
|
|
||||||
|
|
||||||
class ProjectAdmin(admin.ModelAdmin):
|
class ProjectAdmin(admin.ModelAdmin):
|
||||||
class Media:
|
class Media:
|
||||||
js = (
|
js = (
|
||||||
|
@ -28,7 +33,7 @@ class NoteworthyAdmin(admin.ModelAdmin):
|
||||||
'js/jquery-ui-1.8.16.custom.min.js',
|
'js/jquery-ui-1.8.16.custom.min.js',
|
||||||
'js/admin_list_reorder.js',
|
'js/admin_list_reorder.js',
|
||||||
)
|
)
|
||||||
|
inlines = [NoteworthyImageInline]
|
||||||
list_display = ('__unicode__', 'position',)
|
list_display = ('__unicode__', 'position',)
|
||||||
list_editable = ('position',)
|
list_editable = ('position',)
|
||||||
exclude = ('position',)
|
exclude = ('position',)
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Link(models.Model):
|
||||||
|
|
||||||
class Noteworthy(models.Model):
|
class Noteworthy(models.Model):
|
||||||
position = models.IntegerField(null=True)
|
position = models.IntegerField(null=True)
|
||||||
image = models.ImageField(blank=True, upload_to='noteworthy_imgs/')
|
image = models.ImageField(blank=True, upload_to='noteworthy_imgs/', help_text="main image")
|
||||||
title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255)
|
||||||
description = models.TextField(blank=True)
|
description = models.TextField(blank=True)
|
||||||
url = models.URLField(blank=True)
|
url = models.URLField(blank=True)
|
||||||
|
@ -122,5 +122,19 @@ class Noteworthy(models.Model):
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
|
|
||||||
|
class NoteworthyImage(models.Model):
|
||||||
|
noteworthy = models.ForeignKey(Noteworthy)
|
||||||
|
image = models.ImageField(upload_to='noteworthy_imgs/')
|
||||||
|
order = models.IntegerField(default=1)
|
||||||
|
name = models.CharField(max_length=128, blank=True)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.image.url
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['order', 'id']
|
||||||
|
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user