Skip to content

Commit

Permalink
Merge 205a8f6 into 6a98a0b
Browse files Browse the repository at this point in the history
  • Loading branch information
gregoiredx committed Apr 21, 2020
2 parents 6a98a0b + 205a8f6 commit cceddcd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modeltranslation/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import datetime
import fnmatch
import imp
import io
import os
import shutil

Expand Down Expand Up @@ -164,6 +165,12 @@ def setUpClass(cls):
# 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)
Expand Down
12 changes: 12 additions & 0 deletions modeltranslation/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,18 @@ def deconstruct(self):
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


Expand Down

0 comments on commit cceddcd

Please sign in to comment.