1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #28357 -- Fixed ModelAdmin.prepopulated_fields on newly added stacked inline.

Thanks Jakob Köhler for the initial patch.
This commit is contained in:
Shubh1815
2021-11-15 19:57:11 +05:30
committed by Mariusz Felisiak
parent 3f0025c18a
commit bb223c6f78
4 changed files with 55 additions and 5 deletions

View File

@@ -767,8 +767,22 @@ class RelatedPrepopulatedInline3(admin.TabularInline):
autocomplete_fields = ['fk', 'm2m']
class RelatedPrepopulatedStackedInlineNoFieldsets(admin.StackedInline):
model = RelatedPrepopulated
extra = 1
prepopulated_fields = {
'slug1': ['name', 'pubdate'],
'slug2': ['status'],
}
class MainPrepopulatedAdmin(admin.ModelAdmin):
inlines = [RelatedPrepopulatedInline1, RelatedPrepopulatedInline2, RelatedPrepopulatedInline3]
inlines = [
RelatedPrepopulatedInline1,
RelatedPrepopulatedInline2,
RelatedPrepopulatedInline3,
RelatedPrepopulatedStackedInlineNoFieldsets,
]
fieldsets = (
(None, {
'fields': (('pubdate', 'status'), ('name', 'slug1', 'slug2', 'slug3'))