On Wed, Feb 6, 2013 at 8:48 AM, Daniel Roseman <dan...@roseman.org.uk>wrote:
> On Tuesday, 5 February 2013 22:39:30 UTC-8, vijay shanker wrote: > >> Hi >> I have two models, a Customer model and a WishListItem model (which >> stores products). I have option of either having a ManyToManyField in >> Customer to WishListItem, or I can have a customer ForeignKey to customer >> for each WishListItem. >> Which one will be more efficient ? >> Thanks >> > > What a strange question. The choice of ManyToMany vs ForeignKey has > nothing at all to do with efficiency, but with which is correct for your > data structure. In your case, ManyToMany makes no sense at all, because an > item can't have many customers - so ForeignKey is the only logical choice. > That would probably depend on whether we're talking about specific physical items in the WishListItem model, in which case each can obviously belong to only one customer, or catalog items, each of which can be bought by multiple customers. Since this is a wishlist, my guess is that they're not physical items and more than one customer can have the same item on their wish list, so a ManyToManyField would work. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.