mirror of
https://github.com/django/django.git
synced 2025-07-30 08:35:23 +00:00
Fixed #29414 -- Restored form inputs on admin inlines when the user doesn't have the change permission.
Regression in 825f0beda8
.
This commit is contained in:
parent
a7bc1aea03
commit
ffb72a95bc
4 changed files with 35 additions and 6 deletions
|
@ -7,9 +7,9 @@ from .models import (
|
|||
Consigliere, EditablePKBook, ExtraTerrestrial, Fashionista, Holder,
|
||||
Holder2, Holder3, Holder4, Inner, Inner2, Inner3, Inner4Stacked,
|
||||
Inner4Tabular, NonAutoPKBook, NonAutoPKBookChild, Novel,
|
||||
ParentModelWithCustomPk, Poll, Profile, ProfileCollection, Question,
|
||||
ReadOnlyInline, ShoppingWeakness, Sighting, SomeChildModel,
|
||||
SomeParentModel, SottoCapo, Title, TitleCollection,
|
||||
NovelReadonlyChapter, ParentModelWithCustomPk, Poll, Profile,
|
||||
ProfileCollection, Question, ReadOnlyInline, ShoppingWeakness, Sighting,
|
||||
SomeChildModel, SomeParentModel, SottoCapo, Title, TitleCollection,
|
||||
)
|
||||
|
||||
site = admin.AdminSite(name="admin")
|
||||
|
@ -153,6 +153,17 @@ class NovelAdmin(admin.ModelAdmin):
|
|||
inlines = [ChapterInline]
|
||||
|
||||
|
||||
class ReadOnlyChapterInline(admin.TabularInline):
|
||||
model = Chapter
|
||||
|
||||
def has_change_permission(self, request, obj=None):
|
||||
return False
|
||||
|
||||
|
||||
class NovelReadonlyChapterAdmin(admin.ModelAdmin):
|
||||
inlines = [ReadOnlyChapterInline]
|
||||
|
||||
|
||||
class ConsigliereInline(admin.TabularInline):
|
||||
model = Consigliere
|
||||
|
||||
|
@ -231,6 +242,7 @@ site.register(Holder3, inlines=[InnerInline3])
|
|||
|
||||
site.register(Poll, PollAdmin)
|
||||
site.register(Novel, NovelAdmin)
|
||||
site.register(NovelReadonlyChapter, NovelReadonlyChapterAdmin)
|
||||
site.register(Fashionista, inlines=[InlineWeakness])
|
||||
site.register(Holder4, Holder4Admin)
|
||||
site.register(Author, AuthorAdmin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue