mirror of
https://github.com/django/django.git
synced 2025-08-01 17:42:56 +00:00
Fixed #12952 -- Adjusted admin log change messages to use form labels instead of field names.
This commit is contained in:
parent
1564e42ad3
commit
87f5d07eed
10 changed files with 128 additions and 17 deletions
|
@ -1,11 +1,30 @@
|
|||
from django import forms
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Article, ArticleProxy, Site
|
||||
|
||||
|
||||
class ArticleAdminForm(forms.ModelForm):
|
||||
nolabel_form_field = forms.BooleanField(required=False)
|
||||
|
||||
class Meta:
|
||||
model = Article
|
||||
fields = ['title']
|
||||
|
||||
@property
|
||||
def changed_data(self):
|
||||
data = super().changed_data
|
||||
if data:
|
||||
# Add arbitrary name to changed_data to test
|
||||
# change message construction.
|
||||
return data + ['not_a_form_field']
|
||||
return data
|
||||
|
||||
|
||||
class ArticleInline(admin.TabularInline):
|
||||
model = Article
|
||||
fields = ['title']
|
||||
form = ArticleAdminForm
|
||||
|
||||
|
||||
class SiteAdmin(admin.ModelAdmin):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue