Try a ManyToManyField, which essentially creates the article_devices table but abstracts it away so you don't have to think about it.
On Jul 19, 7:52 pm, Alex Hall <mehg...@gmail.com> wrote: > Hello all, > I am trying to figure out the best way to represent a field in a > model. The model is an article, which is associated with multiple > devices (devices is another model). When adding a new article, an > admin is presented with a multiple select list of all the rows in the > devices table. All selections should then be stored in the article's > "devices" field. What should this "devices" field be, though? It has > to represent a bunch of primary keys in the devices table, which > sounds like a comma-separated list, but it also has to be of type > ForeignKey. Is there a way to do this, or am I better off just making > a model for article_devices, with pk article_id and a foreign key into > the devices table (so the article_devices table has a composite key of > [article_id, device_id])? I hope I explained that well enough. Thanks. > > -- > Have a great day, > Alex (msg sent from GMail website) > mehg...@gmail.com;http://www.facebook.com/mehgcap -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.