Permalink
Browse files

use get_prep_save instead get_db_prep_save

  • Loading branch information...
1 parent c26ef2b commit 550883124b26ce6b83d7367f5168bd9f9f2d699c @bmihelac committed Dec 20, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 django_extensions/db/fields/json.py
@@ -69,12 +69,12 @@ def to_python(self, value):
else:
return value
- def get_db_prep_save(self, value):
+ def get_prep_save(self, value):
"""Convert our JSON object to a string before we save"""
if not value:
- return super(JSONField, self).get_db_prep_save("")
+ return super(JSONField, self).get_prep_save("")
else:
- return super(JSONField, self).get_db_prep_save(dumps(value))
+ return super(JSONField, self).get_prep_save(dumps(value))
def south_field_triple(self):
"Returns a suitable description of this field for South."

2 comments on commit 5508831

trbs replied Jan 25, 2011

Is does not read like this patch is safe for backwards compatibility right ?

Could you please change the patch to make it work on both Django pre 1.3 and trunk ?

Owner

bmihelac replied Jan 25, 2011

get_prep_value is added in Django 1.2. indeed:
http://docs.djangoproject.com/en/dev/howto/custom-model-fields/#converting-python-objects-to-query-values

Which one is current minimum django version for django-extension?

Please sign in to comment.