Wednesday, March 30, 2011

Re: How to store multiple instances of a single object in the database

Have you considered using the 'through' argument for the many to many field?  This lets you specify your own intermediate table to which you can add extra data.  So you could add in a quantity field so you would know how many of each molecule you need.

Here is the documentation: http://docs.djangoproject.com/en/1.3/topics/db/models/#intermediary-manytomany

Hope this helps,

Ryan

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment