1👍
You could try it like this:
View:
UPDATE: You can use two variables like this:
class_names_for_radio = ['alpha', 'beta']
class_names = ','.join(class_names_for_radio)
context = {'class_names': class_names,
'class_names_for_radio': class_names_for_radio}
return render(request, 'teacher/query.html', context)
Template:
<form method="post">
<input type="hidden" name="class_names" value="{{ class_names }}"/>
<input type="submit" value="Submit" />
</form>
When you receive the value:
class_names = request.POST['class_names'].split(',') #unsafe, just a demo
for x in _class_names:
print x
Source:stackexchange.com