mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-05-04 19:44:43 +00:00
Fix admin exclude usage
This commit is contained in:
parent
e69eb7b07e
commit
0aeede91d6
1 changed files with 4 additions and 3 deletions
|
|
@ -184,12 +184,13 @@ class TranslationBaseModelAdmin(BaseModelAdmin):
|
|||
"""
|
||||
Generic code shared by get_form and get_formset.
|
||||
"""
|
||||
if self.exclude is None:
|
||||
exclude = self.get_exclude(request, obj)
|
||||
if exclude is None:
|
||||
exclude = []
|
||||
else:
|
||||
exclude = list(self.exclude)
|
||||
exclude = list(exclude)
|
||||
exclude.extend(self.get_readonly_fields(request, obj))
|
||||
if not self.exclude and hasattr(self.form, '_meta') and self.form._meta.exclude:
|
||||
if not exclude and hasattr(self.form, '_meta') and self.form._meta.exclude:
|
||||
# Take the custom ModelForm's Meta.exclude into account only if the
|
||||
# ModelAdmin doesn't define its own.
|
||||
exclude.extend(self.form._meta.exclude)
|
||||
|
|
|
|||
Loading…
Reference in a new issue