#14438: Deserializer raises ValidationError if natural key is given as string
------------------------------------+---------------------------------------
Reporter: zimnyx | Owner: nobody
Status: closed | Milestone:
Component: Serialization | Version: SVN
Resolution: worksforme | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Changes (by ramiro):
* status: new => closed
* resolution: => worksforme
Comment:
I've tested this locally and the YAML generated is correct (see fixtures6
and fixures8 in Django's `tests/modeltests/fixtures` test case, Visa has a
FK to Person that has a one-field natural key).
{{{
- fields:
permissions:
- [add_user, auth, user]
- [change_user, auth, user]
- [delete_user, auth, user]
person: [Django Reinhardt]
model: fixtures.visa
pk: 1
- fields:
permissions:
- [add_user, auth, user]
person: [Stephane Grappelli]
model: fixtures.visa
pk: 2
- fields:
permissions: []
person: [Prince]
model: fixtures.visa
pk: 3
}}}
I suspect the problem is the `natural_key` method of the model your FK
points to isn't returning a tuple. This is documented:
http://docs.djangoproject.com/en/1.2/topics/serialization/#serialization-
of-natural-keys
--
Ticket URL: <http://code.djangoproject.com/ticket/14438#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.