4π
β
You are selecting by name, so the first element with the name βpriβ is selected, which will always be the label element with the name βpriβ and a value of 1. The name of the label should be different to the name of the input element.
π€CJ4
1π
I think you can get the result like this:
meta['pri'] = bool(request.POST.get('pri')=='1')
π€Ryan
- [Django]-Email django from using EmailMultiAlternatives
- [Django]-Adding new form fields dynamically in admin
- [Django]-Using Pandas with Django to read and parse excel file
- [Django]-PDF links getting stuck while loading in Chrome PDF Viewer
- [Django]-Supervisor Django Gunicorn Gevent Memory Usage
0π
Only solution for this is using onclick event on radio button and writing to hidden input with another name, then working with this input in views
π€user2056721
- [Django]-Is there a way to prevent Django from trimming leading white space in a text field?
- [Django]-Reuse same "block" of html in multiple django templates
- [Django]-Django β Is it possible to make a redirect from a function in a view?
- [Django]-Django: can't bind an uploaded image to a form ImageField()
Source:stackexchange.com