Thanks for your reply,
It works if I hardcode the values, but if I set them to the ones passed from the selection list it won't work on the template page, but inside the console I see the values are being passed from template page to the views fine without problems, I can get the results for var1, var2,var3 fine as well, but all in the console.
Thanks
On Wed, Jun 22, 2016 at 12:50 PM, ludovic coues <couesl@gmail.com> wrote:
Have you tried {{item1|pprint}} ?
Or to check the raw page, not the one displayed by the brother ?
I got bitten more than once by brother not displaying variable whose
value looked like <Object date>
2016-06-22 20:31 GMT+02:00 <ayshalab@gmail.com>:
> Hello everyone,
>
> I am trying to do the following:
>
> Grab Year/Month values from a template page via dropdown select list and
> send them via ajax post (this part is working)
>
> Process the submitted values and return new variables to the same template
> page, it works if I hard code the Month/Year but it won't display anything
> when I change values and re-submit them.
>
> In the console I can print selected Month/Year and values for the 3
> variables without any issues, but the template page is not displaying
> anything
>
>
> Thanks!
>
>
> here is my code:
>
> page.html
>
> {% for item1, item2, item3 in list_results %}
> <td>{{ item1 }}</td>
> <td>{{ item2 }}</td>
> <td>{{ item3 }}</td>
>
> </tr>
> {% endfor %}
>
> views.py
>
> def data_web(request):
>
> if request.method == 'POST':
> year = request.POST.get('the_year')
> month = request.POST.get('the_month')
> year = int(year)
> month = int(month)
>
> var1, var2, var3 = count_files(year, month)
> list_results = zip(var1, var2, var3)
>
> print "Year", year, "month", month, list_results
>
>
> return render(request, 'page.html', {'list_results': list_results})
> else:
> return render(request, 'page.html')
>
>
>
> --
> 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 django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e4a5ea8f-3b44-44d8-8946-7e6d7f131463%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Cordialement, Coues Ludovic
+336 148 743 42
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/MV2Omxkp804/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEuG%2BTYs%2BR%3DJw%2ByFDQGTw%3DC47qpbzFBncJO-TazLfOgLo0K97Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAM2q4GtUrA%2BAik_nZ6Hd8a7DSd_a8ZGrKPUs5pBJLrtKNa0rBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment