I just got it done. Thanks.
On Mon, Sep 19, 2016 at 4:19 AM, Ali khan <[email protected]> wrote: > I've tried many ways but it ends with the same error that says: > > Cannot query "alikhan": Must be "User" instance. > > Where alikhan is admin user I've created with createsuperuser. > > Hate to bother you again but please advise. > > Regards, > Ali > > On Sun, Sep 18, 2016 at 11:08 PM, James Schneider <[email protected] > > wrote: > >> On Sep 18, 2016 10:22 PM, "Ali khan" <[email protected]> wrote: >> > >> > Thank you for your kind response James. >> > >> > I must be doing something wrong but I thought that importing different >> models and assigning them with variable may had help me to filter it out. I >> will try your suggestion first to save your valued time and then will post >> with result. >> > >> > Let me add a field for the seller in my "Orders" model like "seller = >> models.ForeignKey(Seller)" and then filter it out. >> > But I tried that before still as per your suggestion I will do that >> again. >> > Thanks again. >> > >> >> Once you do that, you can filter the orders with something like this: >> >> orders = Order.objects.filter(seller__user=user) >> >> Inside of the filter function you defined. The way you are currently >> doing it, you'll end up with Seller objects rather than Order objects. >> >> -James >> >> -- >> 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 [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit https://groups.google.com/d/ms >> gid/django-users/CA%2Be%2BciX6N3eQOnb5dP877WM0FEgj%2BAjt- >> QfT6anwE5jNMafx3Q%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX6N3eQOnb5dP877WM0FEgj%2BAjt-QfT6anwE5jNMafx3Q%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAXvsYk0SN23WotK_ikG7foEHMKYYN7pLzrYLJmPtm-MVRYORw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

