Hi use single quote ‘product.image.url’ and it should be work On Fri, 6 Mar, 2020 at 6:17 PM, Omar Abou Mrad <omar.aboum...@gmail.com> wrote:
> > https://docs.djangoproject.com/en/3.0/howto/static-files/#configuring-static-files > > {% load static %}<img src="{% static product.image.url %}" alt="My image"> > > > On Fri, Mar 6, 2020 at 2:04 PM Aly_34_04 MR_34_04 < > allaberdi16yazha...@gmail.com> wrote: > >> it doesn't work, I tried( >> [06/Mar/2020 15:01:39] "GET /products/ HTTP/1.1" 200 1719 >> Not Found: /products/3.png >> [06/Mar/2020 15:01:39] "GET /products/3.png HTTP/1.1" 404 2137 >> >> >> >> On Friday, March 6, 2020 at 2:35:52 PM UTC+3, Omkar Parab wrote: >>> >>> {{ product.image.url }} >>> >>> On Fri, Mar 6, 2020, 4:50 PM Aly_34_04 MR_34_04 <allaberdi...@gmail.com> >>> wrote: >>> >>>> [image: Capture.JPG] >>>> Enter code here... >>>> #django templates >>>> >>>> {% extends 'base.html' %} >>>> {% block content %} >>>> <h1>Products</h1> >>>> <div class="row"> >>>> {% for product in products %} >>>> <div class="col"> >>>> <div class="card" style="width: 18rem;"> >>>> <img src="{{product.image}}.jpg" class="card-img-top" alt="..."> >>>> <div class="card-body"> >>>> <h5 class="card-title">{{product.name}}</h5> >>>> <p class="card-text">$ {{product.price}}</p> >>>> <a href="#" class="btn btn-primary">add to card</a> >>>> </div> >>>> </div> >>>> </div> >>>> {% endfor %} >>>> </div> >>>> {% endblock %}... >>>> >>>> >>>> #python code >>>> >>>> class Product(models.Model): >>>> name = models.CharField(max_length=50) >>>> price = models.FloatField() >>>> image = models.FileField() >>>> >>>> >>>> >>>> -- >>>> 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 django...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/django-users/a9354269-5866-4332-9acb-a0b558501d0d%40googlegroups.com >>>> <https://groups.google.com/d/msgid/django-users/a9354269-5866-4332-9acb-a0b558501d0d%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>> >>> >>>> -- >> 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 django-users+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/509b5541-dfbb-43a8-a3b9-5e4c56807fbe%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/509b5541-dfbb-43a8-a3b9-5e4c56807fbe%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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 django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAFwtXp2rCiDCxxJjs_ZcqQN0dK0Lts-AaQ%2BxKNG5r9x-va1TZg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAFwtXp2rCiDCxxJjs_ZcqQN0dK0Lts-AaQ%2BxKNG5r9x-va1TZg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- *Signed By...* Md. Wasim Rana CEO & DIRECTOR WP CONSULTATION : Ring Road, Shyamoli, Dhaka, Bangladesh - 1207. Cell: +880 164 678 2796 https://www.wpconsultation.com *Warning:* This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. The information is intended to be for the use of the individual or entity designated above. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited. *Thank You So Much. | T*he sender accepts no responsibility for changes made to this email or any attachments after transmission from the sender. -- 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 django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALbNXK6yV1UHx_nmimeTCt_5v8eef5%2BA34CMba1Sz9Mj1ixoZQ%40mail.gmail.com.