{% for cinema_hall in cinema_halls %}
<div>
<h2>{{ cinema_hall.name }}</h2>
<div class="show-container" id="show-container-{{ cinema_hall.id }}">
<!-- Loop through shows for each cinema hall -->
{% for show in shows %}
{% if show.cinemahall == cinema_hall %}
<div class="show-box" data-cinema_hall_id="{{ cinema_hall.id }}" data-show_id="{{ show.id }}">
Show: {{ show.timings }}
<br>
₹ {{ show.price }}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endfor %}
this is html code
// Click event handler for show-box elements
$(document).on('click', '.show-box', function() {
// Get the cinema hall ID and show ID from the clicked element's data attributes
const cinemaHallId = $(this).data('cinema_hall_id');
const showId = $(this).data('show_id');
// Redirect to seats.html with the cinema hall ID and show ID as query parameters
window.location.href = `/seats/?cinema_hall_id=${cinemaHallId}&show_id=${showId}`;
});
this is js code
def seats(request):
cinema_hall_id = request.GET.get('cinema_hall_id')
show_id = request.GET.get('show_id')
# Use cinema_hall_id and show_id to fetch relevant data
# For example:
# seats_data = Seat.objects.filter(cinema_hall__id=cinema_hall_id, show__id=show_id)
context = {
'cinema_hall_id': cinema_hall_id,
'show_id': show_id,
# Include other context data as needed
}
return render(request, 'screen/seats.html', context)
this is views.py code now what i want is that when that div is clicked it takes me to new url with website screen/seats.html but i am keep getting this error Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/seats/?cinema_hall_id=undefined&show_id=undefined please help what the problem in my code , why it’s not working