Add multiple categories to portfolio and advanced gallery navigation with swipe support
This commit is contained in:
@@ -59,15 +59,20 @@ class PortfolioImageInline(admin.TabularInline):
|
||||
|
||||
@admin.register(PortfolioItem)
|
||||
class PortfolioItemAdmin(admin.ModelAdmin):
|
||||
list_display = ('title', 'client_name', 'completion_date', 'featured', 'is_active', 'gallery_count')
|
||||
list_filter = ('featured', 'is_active', 'completion_date', 'category')
|
||||
list_display = ('title', 'client_name', 'completion_date', 'featured', 'is_active', 'gallery_count', 'categories_display')
|
||||
list_filter = ('featured', 'is_active', 'completion_date', 'categories')
|
||||
search_fields = ('title', 'client_name', 'description')
|
||||
prepopulated_fields = {'slug': ('title',)}
|
||||
filter_horizontal = ('categories',)
|
||||
inlines = [PortfolioImageInline]
|
||||
|
||||
def gallery_count(self, obj):
|
||||
return obj.gallery_images.count()
|
||||
gallery_count.short_description = 'Фото в галерее' # type: ignore
|
||||
|
||||
def categories_display(self, obj):
|
||||
return ", ".join([cat.name for cat in obj.categories.all()[:3]])
|
||||
categories_display.short_description = 'Категории' # type: ignore
|
||||
|
||||
|
||||
@admin.register(NewsArticle)
|
||||
|
||||
Reference in New Issue
Block a user