Галерея с переключением
This commit is contained in:
1 parent
395b0b9fe3
commit
319608f1a1
19 files changed
+67
-43
No files matched your search
@@ -7,9 +7,8 @@ class GalleryInline(admin.TabularInline):
|
||||
model = Gallery
|
||||
fields = ( 'img', 'get_html_photo')
|
||||
readonly_fields=('get_html_photo',)
|
||||
can_delete = False
|
||||
show_change_link = False
|
||||
extra = 0
|
||||
extra = 1
|
||||
|
||||
def get_html_photo(self, object):
|
||||
if object.img:
|
||||
@@ -33,10 +32,14 @@ class NewsAdmin(admin.ModelAdmin):
|
||||
if object.link:
|
||||
return mark_safe(f"<img src='{object.link.url}' width=50>")
|
||||
|
||||
|
||||
|
||||
get_html_photo.short_description="Превью изображения"
|
||||
|
||||
inlines = [GalleryInline]
|
||||
|
||||
|
||||
|
||||
class CarouselsAdmin(admin.ModelAdmin):
|
||||
list_display=('title', 'cdate', 'enddate', 'get_html_photo', 'link','published', 'sender', 'order')
|
||||
readonly_fields=('get_html_photo',)
|
||||
|
||||
Reference in new issue
Block a user