mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-04-26 16:04:42 +00:00
Connect signal only for registered model, not all.
This commit is contained in:
parent
b2f6da433e
commit
f97695ac5a
1 changed files with 3 additions and 1 deletions
|
|
@ -168,7 +168,6 @@ def patch_constructor(model):
|
|||
model.__init__ = new_init
|
||||
|
||||
|
||||
@receiver(post_init)
|
||||
def delete_mt_init(sender, instance, **kwargs):
|
||||
if hasattr(instance, '_mt_init'):
|
||||
del instance._mt_init
|
||||
|
|
@ -353,6 +352,9 @@ class Translator(object):
|
|||
# Patch __init__ to rewrite fields
|
||||
patch_constructor(model)
|
||||
|
||||
# Connect signal for model
|
||||
post_init.connect(delete_mt_init, sender=model)
|
||||
|
||||
# Patch clean_fields to verify form field clearing
|
||||
patch_clean_fields(model)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue