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 %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/44d42c51-81cb-446c-a938-3d146f5f68e5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to