As I was learning the Django Docs (
https://docs.djangoproject.com/en/1.6/topics/db/models/#extra-fields-on-many-to-many-relationships),
 
I found the following code not working. Is it a bug? At least the result is 
unexpected.

ringo = Person(name="Ringo")
beatles = Group(name="Beatles")
m1 = Membership(person=ringo, group=beatles,
                date_joined=date.today(),
                reason='whatever')
ringo.save(), beatles.save()
print m1.person.id, m1.group.id  # yes, they have values.
m1.save()  # IntegrityError: membership.person_id may not be NULL


Why can't m1 be save, since both its foreign key fields have been save 
successfully?

Thanks.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1d4d456f-abff-48fe-bf4c-0014c50abe9c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to