ok it work, tank to your previous suggestion... I didn't pay enough attention and was invoking that page from a wrong URL
tank again for your preciouse time. On 17 Ago, 21:10, Steve Holden <holden...@gmail.com> wrote: > On 8/17/2010 2:49 PM, djnubbio wrote: > > > tank for your response. I try your suggestion, but it wont work! > > > I try to output zxc writing: > > > {{ comm.id }}#{{ zxc }}<br> > > > and I get the following: > > > ... > > 171# > > 140# > > 30# > > 90# > > ... > > > thus I think zxc was empty, but i may be wrong... > > > waiting again for suggestions. tanks. > > OK, so what URL are you using to access this page, and what does the > corresponding entry in your urlconf (urls.py) look like? > > regards > Steve > > > > > On 17 Ago, 20:22, Steve Holden <holden...@gmail.com> wrote: > >> On 8/17/2010 1:53 PM, djnubbio wrote: > > >>> hi all and tank in advance for wasting your time; i'm very newby in > >>> django framework > > >>> I have the following: > > >>> #views.py > >>> ... > >>> def lista_diario(request, comm_id): > >>> comm_list = > >>> Commessa.objects.all().annotate(oretot=Sum('diario__ore')) > >>> return render_to_response('commesse/lista_diario.html', > >>> dict(comm_list=comm_list, zxc= comm_id )) > > >>> ... > >>> #lista_diario.html > > >>> ... > >>> {% for comm in comm_list %} > > >>> ... > >>> {% if comm.id == zxc %} > > >>> do something > > >>> {% endif %} > >>> ... > >>> {% endfor %} > > >>> the trouble is that the if condition is never TRUE, because comm.id > >>> has its proper value, but zxc is empty. > > >>> any suggestione will be greatly appreciated. > > >> Are you *sure* zxc is empty? It's much more likely that it isn't the > >> same type as comm.id. In Python 1 != "1", so you may find that your code > >> works if you start the lista_diaro() function with > > >> comm_id = int(comm_id) > > >> Remember that if there's any chance that comm_id might not contain an > >> integer you will need error checking and handling. If it's actually > >> verified by the urlconf pattern, however, then errors won't occur. > > >> regards > >> Steve > >> -- > >> DjangoCon US 2010 September 7-9http://djangocon.us/ > > -- > DjangoCon US 2010 September 7-9http://djangocon.us/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.