Re: how to display a foreign key image of an object in an object_list view/template?

2017-07-11 Thread Bledi
Thanks, but I am getting this error: 'Product' object has no attribute 'productimages_set' On Tuesday, July 11, 2017 at 5:29:15 AM UTC-4, ecas wrote: > > > You can query for the images, and keep the first one for the template > rendering. > > products = Product.objects.all() > for product in p

Re: How can create multiple Model objects at the same time from the same form?

2017-07-10 Thread Bledi
I think you should use formsets. https://docs.djangoproject.com/en/1.11/topics/forms/formsets/ On Monday, July 10, 2017 at 11:20:19 AM UTC-4, Denis Cosmin wrote: > > I have a form Author that contains the field first_name, last_name, and > email. > > I want to be able to create 1-10 of them at

how to display a foreign key image of an object in an object_list view/template?

2017-07-10 Thread Bledi
I am trying to build a website where you can sell stuff. I want the user to be able to upload multiple images per product/post. I think I have figured that part out. But I am struggling to display one image per product. Here are the details: models.py (I have left out some basic methods) clas

Re: django sample projects

2017-04-10 Thread Bledi
Hi Shahab, I am in a similar position like you. I strongly suggest you do the following tutorial: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django Its made by Mozilla Developers and it is amazing! Good luck! On Monday, March 27, 2017 at 12:27:59 PM UTC-4, Shahab Emami wrote: