mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-05-19 10:01:09 +00:00
Fix: add NewMultilingualManager __eq__()
This commit is contained in:
parent
6a98a0b997
commit
205a8f6c2f
2 changed files with 19 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ from unittest import skipUnless
|
|||
import datetime
|
||||
import fnmatch
|
||||
import imp
|
||||
import io
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
|
@ -164,6 +165,12 @@ class ModeltranslationTransactionTestBase(TransactionTestCase):
|
|||
# 5. makemigrations (``migrate=False`` in case of south)
|
||||
if MIGRATIONS:
|
||||
call_command('makemigrations', 'auth', verbosity=2, interactive=False)
|
||||
# At this point there should not be any migrations to generate
|
||||
out = io.StringIO()
|
||||
call_command('makemigrations', 'auth', verbosity=3,
|
||||
dry_run=True, interactive=False, stdout=out)
|
||||
assert "No changes detected in app 'auth'\n" == out.getvalue(), \
|
||||
"Unexpected auth migration:\n %s" % out.getvalue()
|
||||
|
||||
# 6. Syncdb (``migrate=False`` in case of south)
|
||||
call_command('migrate', verbosity=0, interactive=False, run_syncdb=True)
|
||||
|
|
|
|||
|
|
@ -200,6 +200,18 @@ def patch_manager_class(manager):
|
|||
self._constructor_args[1], # kwargs
|
||||
)
|
||||
|
||||
def __hash__(self):
|
||||
return id(self)
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, NewMultilingualManager):
|
||||
return self._old_module == other._old_module and \
|
||||
self._old_class == other._old_class
|
||||
if hasattr(other, "__module__") and hasattr(other, "__class__"):
|
||||
return self._old_module == other.__module__ and \
|
||||
self._old_class == other.__class__.__name__
|
||||
return False
|
||||
|
||||
manager.__class__ = NewMultilingualManager
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue