mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-05-25 12:43:45 +00:00
Fix proxy model handling.
Previously, proxy models would receive transaltion fields twice, as inspeceted by model._meta.get_fields_with_model()
This commit is contained in:
parent
410888517e
commit
42128390e6
1 changed files with 6 additions and 1 deletions
|
|
@ -74,7 +74,7 @@ class TranslationOptions(with_metaclass(FieldsAggregationMetaClass, object)):
|
|||
"""
|
||||
Update with options from a superclass.
|
||||
"""
|
||||
if other.model._meta.abstract or self.model._meta.proxy:
|
||||
if other.model._meta.abstract:
|
||||
self.local_fields.update(other.local_fields)
|
||||
self.fields.update(other.fields)
|
||||
|
||||
|
|
@ -123,6 +123,11 @@ def add_translation_fields(model, opts):
|
|||
model.add_to_class(localized_field_name, translation_field)
|
||||
opts.add_translation_field(field_name, translation_field)
|
||||
|
||||
# Rebuild information about parents fields. If there are opts.local_fields, field cache would be
|
||||
# invalidated (by model._meta.add_field() function). Otherwise, we need to do it manually.
|
||||
if len(opts.local_fields) == 0:
|
||||
model._meta._fill_fields_cache()
|
||||
|
||||
|
||||
def add_manager(model):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue