I have ListView and select with options in my Django template and i want to get value from select in my listview to change response by this data but i got None when i try to print that
How am i suppose to do that?
views.py
def get_queryset(self):
url = config('REPORT_PROJECT_BUDGET')
select_front = self.request.GET.get('selection')
payload = {'ObjectGUID': select_front, }
print(payload)
# response = requests.get(url, auth=UNICA_AUTH, params=payload).json()
# print(response)
queryset = []
return queryset
def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(**kwargs)
context['OBJECTS'] = ObjectList.objects.all()
return context
template.html
<div class="select">
<select id="g1" name="selection">
{% for obj in OBJECTS %}
<option value="{{ obj }}">{{ obj }}</option>
{% endfor %}
<option value="1">1</option>
</select>
</div>