Hi Minglei,
First of all I think I would rename "author" in Album to "authors" to
reflect the fact that there can be many authors. You could use
something like this:
objalbum, created = Album.objects.get_or_create(name=album)
objalbum.authors.add(objauthor)
or
objauthor.album_set.get_or_create(name=album)

Please see this page for more info:
http://www.djangoproject.com/documentation/models/many_to_many/


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to