mirror of
https://github.com/django/django.git
synced 2025-09-25 03:32:37 +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
|
@ -893,8 +893,27 @@ class CityInlineAdmin(admin.TabularInline):
|
|||
view_on_site = False
|
||||
|
||||
|
||||
class StateAdminForm(forms.ModelForm):
|
||||
nolabel_form_field = forms.BooleanField(required=False)
|
||||
|
||||
class Meta:
|
||||
model = State
|
||||
fields = '__all__'
|
||||
labels = {"name": "State name (from form's Meta.labels)"}
|
||||
|
||||
@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 StateAdmin(admin.ModelAdmin):
|
||||
inlines = [CityInlineAdmin]
|
||||
form = StateAdminForm
|
||||
|
||||
|
||||
class RestaurantInlineAdmin(admin.TabularInline):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue