#4633: Unable to serialize a not yet saved model which has many-to-many
relation.
-----------------------+----------------------------------------------------
Reporter: Bear | Owner: jacob
Status: new | Component: Serialization
Version: SVN | Keywords: model, serialize, many-to-many
Stage: Unreviewed | Has_patch: 0
-----------------------+----------------------------------------------------
If I try to serialize a not yet saved model which has many-to-many
relation, it will raise ValueError while serialize many-to-many field.
for instance:
from django.contrib.auth.models import User
u = User(username="bear", password="bear", email="[EMAIL PROTECTED]")
from django.core import serializers
serializers.serialize("json", [u])
=>
ValueError: <class 'django.contrib.auth.models.Group'> instance needs to
have a
primary key value before a many-to-many relationship can be used.
This makes inconvenient while use ajax in some situation.
--
Ticket URL: <http://code.djangoproject.com/ticket/4633>
Django Code <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
-~----------~----~----~----~------~----~------~--~---