1
0
mirror of https://github.com/django/django.git synced 2025-10-29 08:36:09 +00:00

Fixed ModelState breaking when unique_together has unhashable elements.

This commit is contained in:
Baptiste Mispelon
2013-12-06 15:05:12 +01:00
parent 54d9e3ccf6
commit 19e4374971
3 changed files with 10 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
from django.db import models
from django.db.models.loading import BaseAppCache
from django.db.models.options import DEFAULT_NAMES
from django.db.models.options import DEFAULT_NAMES, normalize_unique_together
from django.utils import six
from django.utils.module_loading import import_by_path
@@ -127,7 +127,8 @@ class ModelState(object):
continue
elif name in model._meta.original_attrs:
if name == "unique_together":
options[name] = set(model._meta.original_attrs["unique_together"])
ut = model._meta.original_attrs["unique_together"]
options[name] = set(normalize_unique_together(ut))
else:
options[name] = model._meta.original_attrs[name]
# Make our record