I fixed the earlier issue, which was happening during
serialization, by using add_to_class() class method,
but now I'm running into an issue with deserialize():

[...]

    for deobj in deserialize(fmt, val, ensure_ascii=False,
use_natural_keys=True):
  File "/usr/local/lib/python2.6/dist-packages/django/core/serializers/
json.py", line 38, in Deserializer
    for obj in PythonDeserializer(simplejson.load(stream), **options):
  File "/usr/local/lib/python2.6/dist-packages/django/core/serializers/
python.py", line 127, in Deserializer
    data[field.attname] =
field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/fields/
__init__.py", line 471, in to_python
    raise exceptions.ValidationError(self.error_messages['invalid'])
django.core.exceptions.ValidationError: [u'This value must be an
integer.']

This happens on a user value that's a natural key; in serializers/
python.py,
the code looks for get_by_natural_key() method, does not find it and
tries
to process the id as int, which causes this exception.

How can it be that dynamically updated manager works fine on
serialization but not on deserialize?

Thanks, any hints / ideas are appreciated.  -ak

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to