Re: Django filters with Foreign Key

2016-09-19 Thread A.Khan
> > Happy to see we are in same boat. It did work with like: > def prod_sold(self): prod = self.get_prod().filter(seller__user=self.account.user) sold = Order.objects.filter(id=products) return sold But it only shows number of products sold. I couldn't make it happen.

Re: Django filters with Foreign Key

2016-09-19 Thread Shamaila Moazzam
Hi , i am having the same problem ..with my sellers App . can you share your solutionthat how you filter regards On Monday, September 19, 2016 at 5:27:31 PM UTC+5, A.Khan wrote: > > I just got it done. > > Thanks. > > On Mon, Sep 19, 2016 at 4:19 AM, Ali khan

Re: Django filters with Foreign Key

2016-09-19 Thread Ali khan
I just got it done. Thanks. On Mon, Sep 19, 2016 at 4:19 AM, Ali khan 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. > >

Re: Django filters with Foreign Key

2016-09-19 Thread Ali khan
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

Re: Django filters with Foreign Key

2016-09-19 Thread James Schneider
On Sep 18, 2016 10:22 PM, "Ali khan" 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

Re: Django filters with Foreign Key

2016-09-18 Thread Ali khan
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

Re: Django filters with Foreign Key

2016-09-18 Thread James Schneider
On Sep 18, 2016 4:01 AM, "Ali khan" wrote: > > I have two different apps and applying filters by ForeignKey and as newbie I am not able to understand how it works. > > My Order App: > ORDER_STATUS_CHOICES={ > ('created','Created'), >

Django filters with Foreign Key

2016-09-18 Thread Ali khan
I have two different apps and applying filters by ForeignKey and as newbie I am not able to understand how it works. My Order App: ORDER_STATUS_CHOICES={ ('created','Created'), ('paid','Paid'), } class Order(models.Model): status =