Skip to content

Commit

Permalink
Revert "Fix JSONfield for inherited models"
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjasper committed Dec 22, 2014
1 parent d34e3dd commit b3e42fe
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions jsonfield/fields.py
Expand Up @@ -69,15 +69,10 @@ def pre_init(self, value, obj):
deserialized"""

if obj._state.adding:
meta_pk = obj._meta.pk
if isinstance(meta_pk, models.OneToOneField):
real_pk_name = meta_pk.related_field.name
else:
real_pk_name = meta_pk.name
# Make sure the primary key actually exists on the object before
# checking if it's empty. This is a special case for South datamigrations
# see: https://github.com/bradjasper/django-jsonfield/issues/52
if getattr(obj, real_pk_name, None) is not None:
if getattr(obj, "pk", None) is not None:
if isinstance(value, six.string_types):
try:
return json.loads(value, **self.load_kwargs)
Expand Down

0 comments on commit b3e42fe

Please sign in to comment.