Tom Smith wrote: > Thanks... I'm not sure but I don't think this is working > > I have... > > p = Product.objects > if len(notsitelist)>=1: > print "exluding sites: ", notsitelist > p.exclude(fk_site__in=notsitelist) > > if len(cats)>=1: > print "exluding categories: ", cats > p.exclude(catalog__in=cats) > > p.order_by('?') > return p.select_related()[:50] > > ... and funnily the order is the same every time (not random) and > although the print statements are printing, it doesn't seem to be > effecting the results. >
All the QuerySet methods that affect the SQL generation don't change the QuerySet but return a modified QuerySet. You want to do p = p.exclude(...) etc. > Is there way to do > > p.get_query(.)p.show_sql() I really don't get what this is supposed to mean, it just looks like seriously broken syntax. Michael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---