Can't make Django ORM work for multiple models

2016-08-17 Thread Shamaila Moazzam
I am trying to create a parent model for my products app and I need to provide the user reference. I've registered the Shop model with admin.py. Now I have problem that when I see in model it shows all the products listed before. I only intend to show products added by the shop owner. Also I

Re: Can't make Django ORM work for multiple models

2016-08-17 Thread Shamaila Moazzam
you can add > user FK to products as well. These things are not mutually exclusive. > > > > On Wednesday, August 17, 2016 at 4:37:51 PM UTC+3, Shamaila Moazzam wrote: >> >> I am trying to create a parent model for my products app and I need to >> provide the user

Re: Implementing django auth system with relational models

2016-08-17 Thread Shamaila Moazzam
@Mudassar this is exactly what I need. On Wednesday, August 17, 2016 at 6:37:51 PM UTC+5, Shamaila Moazzam wrote: > > Hi, > > I am a beginner and please forgive me if my question is not up to the > standard. I've got two models one is Product which is saved in db already &g

Re: Implementing django auth system with relational models

2016-08-17 Thread Shamaila Moazzam
@Ludovic there is no error. Just I don't want to get all the products pre-populated. I need empty products field and only when user uploads products then it should show me products. Please advise On Wednesday, August 17, 2016 at 6:37:51 PM UTC+5, Shamaila Moazzam wrote: > > Hi, &g

Implementing django auth system with relational models

2016-08-17 Thread Shamaila Moazzam
Hi, I am a beginner and please forgive me if my question is not up to the standard. I've got two models one is Product which is saved in db already and another one is Shop. I am trying to related both models with following code. class Product(models.Model): user =

Re: Can't make Django ORM work for multiple models

2016-08-17 Thread Shamaila Moazzam
:51 PM UTC+5, Shamaila Moazzam wrote: > > I am trying to create a parent model for my products app and I need to > provide the user reference. I've registered the Shop model with admin.py. > Now I have problem that when I see in model it shows all the products > listed before

Re: Implementing django auth system with relational models

2016-08-17 Thread Shamaila Moazzam
On Wednesday, August 17, 2016 at 6:37:51 PM UTC+5, Shamaila Moazzam wrote: > > Hi, > > I am a beginner and please forgive me if my question is not up to the > standard. I've got two models one is Product which is saved in db already > and another one is Shop. I am trying to r

Re: Implementing django auth system with relational models

2016-08-17 Thread Shamaila Moazzam
e your admin.py file ? > > You might be interested into this part of the documentation: > > https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_foreignkey > > > 2016-08-17 17:20 GMT+02:00 Shamaila Moazzam <shamaila...

Re: Filtering models by user or by items

2016-09-02 Thread Shamaila Moazzam
r(*pk__in=[id for i.product in **account > **]*) > > return products > > I hope this help you. > > > On Thursday, September 1, 2016 at 9:15:45 PM UTC+5:30, Shamaila Moazzam > wrote: >> >> am making a shops dashboard view .in that view i have used a mixin a

Filtering models by user or by items

2016-09-01 Thread Shamaila Moazzam
am making a shops dashboard view .in that view i have used a mixin as mentioned belowmy issue is i want to get products related to a specific account or user . i have products m2m in shop model and also have user f.k in Shop model. In get_shopproducts() function in ShopAccountMixin()..i am

Re: Filtering models by user or by items

2016-09-01 Thread Shamaila Moazzam
egards, > Mudassar > > On Thu, Sep 1, 2016 at 8:45 AM, Shamaila Moazzam <shamaila...@gmail.com > > wrote: > >> am making a shops dashboard view .in that view i have used a mixin as >> mentioned belowmy issue is i want to get products related to a specific >> acc

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: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-20 Thread Shamaila Moazzam
n order? Is there a way to get a >> list of products sold for each order? >> >> Asad Jibran Ahmed <surf...@gmail.com > >> http://blog.asadjb.com >> >> On Tue, Sep 20, 2016 at 9:24 AM, Shamaila Moazzam <shamaila...@gmail.com >> > wrote: >> >

Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Shamaila Moazzam
hi I am a beginner in django/python * :(* I am making a dashboard of sellers App. I am stuck in filtering orders of the products according to the logged in user(seller) *sellers/models.py* from django.conf import settings from django.core.urlresolvers import reverse from django.db import

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-19 Thread Shamaila Moazzam
ds, > Jibran > > On Tuesday, September 20, 2016 at 9:04:18 AM UTC+4, Shamaila Moazzam wrote: >> >> hi >> I am a beginner in django/python * :(* >> >> I am making a dashboard of sellers App. >> I am stuck in filtering orders of the products according to the logged

Re: Issue in filtering .....(want to show only the products that are sold and have status of paid in orders App)

2016-09-20 Thread Shamaila Moazzam
st() > for o in orders: > for p in o.cart.products: >products_list.append(p) > > return products_list > > This depends on their being a ManyToMany relationship to Product in the > Cart model. > > Asad Jibran Ahmed <surfer...@gmail.com> > http://blog.asadjb.com

Re: Implementing django auth system with relational models

2016-08-18 Thread Shamaila Moazzam
duct.objects.filter(user=request.user) > return super(ShopAdmin, > self).formfield_for_manytomany(db_field, request, **kwargs) > > admin.site.register(Shop, ShopAdmin) > > ### > > It should give you the desired result > > 2016-08-17 19:31 GMT+02:00 Shamaila

Re: Displaying the multiple images in the product detail page

2017-04-25 Thread Shamaila Moazzam
{% for item in product.productimage_set.all %} {% endfor %} this code is displaying different images of a single product ,but the question is how to slice them ,how to get image[0], image[1] ..on the product page... can any

how to show image with index in python as context variable

2017-04-25 Thread Shamaila Moazzam
hi, i am trying to display a set of images with the use of index. here is the code: {% for item in product.productimage_set.all %} {% endfor %} the above code is displaying a set of images for one product .right. i want to