Hi
New to django,need help! just trying to retrieve values from a template to a view.py (ie user may input text, make choice selection, select a radio button value)
like to know the poll list section, market selection, coupon code, and discount text, and poll choice selection from radio button
view
def current_datetime(request):
current_date = datetime.datetime.now()
latest_poll_list = Poll.objects.filter( pub_date__lte=timezone.now()).order_by('-pub_date')[:5]
all_entries = FStatistics.objects.all()
return render_to_response('polls/current_datetime.html', locals())
=====================================================
current_datetime.html' Template like
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" />
{% if latest_poll_list %}
<ul>
{% for poll in latest_poll_list %}
<li><a href="{% url 'polls:detail'
poll.id %}">{{ poll.question }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>No polls are available.</p>
{% endif %}
<br>
<html><body>Markets</body></html><br>
<select name="market" id="marketid" size="2" multiple="multiple">
<option value="0">All</option>
{% for stat in all_entries %}
<option value="{{
stat.id }}">{{ stat.market }}</option>
{% endfor %}
</select>
<label for="user">Coupon code :</label>
<input type="text" id="coupon_Code" maxlength="100" />
<br>
<label for="user">Discount :</label>
<textarea rows="2" cols="19" minlength="15" id="coupon_Discount"></textarea>
<br>
{% for choice in poll.choice_set.all %}
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{
choice.id }}" />
<label for="choice{{ forloop.counter }}">{{
choice.id }} - {{ choice.choice }}</label><br />
{% endfor %}