Я хочу отправить имя моего раздела из выпадающего меню в шаблоне (например, Heart) на мой views.py как объект из модели раздела
def SectDetails(request):
if request.method=='GET':
sec_name=request.GET['section_name']
context={
'section':Section.objects.get(section_name=sec_name)
}
return render(request,'hospital_system/sectiondetails.html',context)
else:
return render(request,'hospital_system/home.html')
, затем мой шаблон
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
{% for sec in sections %}
<a method='GET' class="dropdown-item" href="{% url 'Hosp-SectDetails' %}">{{sec.section_name}}</a>
{% endfor %}
</div>