I am using django forms as you can see in the view.py file and the result is to have a text box.I can submit values numbers and then use this numbers to run script.py etc. I want to do the same with a range input instead of text so that every time the value on the slider change.
My views.py
def get_name(request):
form = NameForm()
if request.method == 'POST':
a = request.POST['your_name'] # do somethink with the value entered in the form
print(a)
a = int(a)
while a>0:
print(a)
a = a -1
return render(request, 'personal/code2.html', {'form': form})
My code2.html
{% extends "personal/header.html" %}
{% block content %}
<form action="" method="POST">
{% csrf_token %}
{{form}}
</form>
{% endblock %}
And my forms.py
from django import forms
class NameForm(forms.Form):
your_name = forms.DurationField(label='% Brightness ')