What is the name of the field in your model? ie: Title, Name, etc.... so one option would be product.title or product.name....
can you just put your model in here? Charlotte Wood, MEd Educator (405) 578-5701 Zoom Meeting ID#: 4055785701 *Zoom URL:* https://epiccharterschools.zoom.us/j/2970513912 Classroom Google Site: https://sites.google.com/epiccharterschools.org/charlottewoodclassroom/home Epic Technical Support: (405) 652-0935 Jordan McKesson Principal 405-749-4550 ext. 309 jordan.mckes...@epiccharterschools.org <http://facebook.com/epiccharterschools> <https://twitter.com/epiccharter> <https://www.instagram.com/epiccharterschools/> <https://www.youtube.com/user/EpicCharterSchools> On Wed, Jul 3, 2019 at 6:25 PM Tosin Ayoola <tosinayoo...@gmail.com> wrote: > Good day guyz > sorry i'm working on a django e-commerce project which i am new to, and > i'm stuck, i wan have a page that will display the list of all for the list > of all products under a particular category, which i have checked out on > stackoverflow, i tried every suggestion and yet since not working below is > my code hoping anyone can lead mr in d right direction > > ##View > > def index(request): > products = Product.objects.all() > category = get_list_or_404(Category) > cat = Category.objects.filter(pk = id) > return render(request, 'shop/index.html', locals()) > > ##product_list Page > <h2>Categories</h2> > {% if cat %} > <ul> > {% for c in cat %} > <li> > <a href="{% url 'product-list' %}"> {{c.name}}</a> > </li> > {% for product in cat.get_product %} > <p> {(product.name}}</p> > {% endfor %} > {% endfor %} > </ul> > {% else %} > <p> There's no item category yet > {% endif %} > </div> > > > > -- > 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 post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAHLKn70PDKYwv30LhTsRaQEJ5V9mwE0xri-EdmwPp8ZoAC5nng%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAHLKn70PDKYwv30LhTsRaQEJ5V9mwE0xri-EdmwPp8ZoAC5nng%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPZR0N619g%2B4WKjJ5DsSKO55xnwa5aR1UfxE9YmKVRmDAVdCug%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.