[Answer]-Django views.py code for parameter

1👍

Your query is incorrect, you can query it using

e_piclist = image_archive.objects.filter(event_id = event_id).

Also, try to use .filter() instead of .get().

👤Rohan

0👍

from django.shortcuts import render, get_object_or_404

def eventimage(request,event_id):

    my_event = get_object_or_404(Event, pk=event_id)
    image_list = my_event.image_archive_set.all()

    return render(request,'gallery/image.html',{'e_piclist':image_list})   

Leave a comment