Fixed #12952 -- Adjusted admin log change messages to use form labels instead of field names.

This commit is contained in:
Sanyam Khurana 2019-06-14 21:50:29 +05:30 committed by Carlton Gibson
parent 1564e42ad3
commit 87f5d07eed
10 changed files with 128 additions and 17 deletions

View file

@ -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):