You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
508 B
20 lines
508 B
from django.contrib import admin |
|
|
|
from .models import Post, Image |
|
|
|
|
|
class ImageInline(admin.StackedInline): |
|
model = Image |
|
extra = 1 # количество полей |
|
fields = ("image", "slug") |
|
|
|
|
|
@admin.register(Post) |
|
class PostAdmin(admin.ModelAdmin): |
|
fieldsets = ( |
|
("Основное", {"classes": ("wide",), "fields": ("title", "text")}), |
|
("Дополнительно", {"classes": ("collapse",), "fields": ("pub_date",)}), |
|
) |
|
inlines = [ |
|
ImageInline, |
|
]
|
|
|