Hello, I have this following model structure model category : name & description fields model seller : name & some address fields... model offer: category (FK to category table), name, picture, etc... model offer_seller: offer (FK to offer), seller (FK to seller), price, amount, etc....
the seller has the string representation something like <seller:aldi>, and the offer_seller has a string representation something like <OfferSeller: meat at Aldi> when I dont use select_related, I have no problem for example.. off_seller_1=OfferSeller.objects.filter(offer__in=[1, 2, 3]) off_seller_1[0].seller for example gives me the proper seller for that offer...<seller:aldi> and off_seller_1[0] ... gives me the _str representation something like "<OfferSeller: meat at Aldi>" now when I use select_related like this off_seller_2=OfferSeller.objects.select_related(depth=2).filter(offer__in=[1, 2, 3]) off_seller_2[0].seller for example gives me the category instead of the seller! <seller:food> and off_seller_2[0] ... gives me the _str representation something like <OfferSeller: meat at food> so the statment off_seller_2[0].seller.shop_name gives me "food" which is the category name... instead of the shop_name, which was "aldi".... Maybe the problem is with the depth parameter, but since I have a self reference in the offer model, I have to use depth parameter. I have increased the depth prameter, but I get the same error. Any ideas on how to solve this? Till then i will use the version without select_related, and hence incurring database access whenever i want to get info in related tables :-( thanks in advance, Oumer class category(models.Model) : --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---