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

2016-08-17 Thread Todor Velichkov
I don't know how much you are into Django, but in case you didn't you really need to ready carefully the following articles from the docs. - Working with forms - Creating forms from models

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

2016-08-17 Thread Shamaila Moazzam
shops/admin.py from .models import Shop admin.site.register(Shop) products/admin.py from .models import Product, Variation, ProductImage, Category, ProductFeatured, color_product, size_product class ProductImageInline(admin.TabularInline): model = ProductImage extra = 0 max_num = 10 cla

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

2016-08-17 Thread Shamaila Moazzam
Thanks for reply Todor, But how to fix it in admin.py? On Wednesday, August 17, 2016 at 7:52:20 PM UTC+5, Todor Velichkov wrote: > > I only intend to show products added by the shop owner. >> > > You can do this by using the reverse m2m relation between product and shop. > > products = Product.o

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

2016-08-17 Thread Todor Velichkov
> > I only intend to show products added by the shop owner. > You can do this by using the reverse m2m relation between product and shop. products = Product.objects.filter(shop__shop_user=request.user) However, I think it's more suitable for the product to keep the M2M relation, because natur

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 ne