How to iterate through an int within template ?
Hello, Does someone knows how to do a loop on a int inside template, e.g. : Result Page: : {% for p in pages %} {% ifequal p page %} {{p}} {% else %} {{p}} {% endifequal %} {% endfor %} Where pages is an int. Do i have to use a special filter function ? Cheers, Vincent. -- ---<[EMAIL PROTECTED]>---- Vincent Garonne http://cern.ch/vincent.garonne CERN PH, CH-1211, Geneva 23, Switzerland Tel. +41 22 76 71181Fax. +41 22 76 78350 --=- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: first naive question for a new fresh Django user
Hi, I know it was just an illustration... My final idea is to implement a browser for our system which could be represent as a file system. I've found this beautiful interface for SVN : https://xbmcajax.bountysource.com/svn/ This is in Ruby + Ajax but as our application is purely in python i would prefer a python solution. Django seems to me a good candidate for that. Vincent. MikeHowarth a écrit : > To be honest I'm not really sure the use of Ajax in printing a piece > of text from a field is that necessary. This could easily be acheived > using good old javascript. > > On Sep 11, 3:25 pm, vincent garonne <[EMAIL PROTECTED]> wrote: > >> * would like >> >> vincent garonne a écrit : >> >> >> >> >>> Hi, >>> >>> I would to do the same than this example: >>> >>> http://www.hackorama.com/ajax/ >>> >>> Vince >>> >>> MikeHowarth a écrit : >>> >>>> I'm not entirely sure I follow your request. >>>> >>>> However using Ajax in Django is a fairly simple affair:http://www.b- >>>> list.org/weblog/2006/jul/02/django-and-ajax/ >>>> >>>> On Sep 11, 3:11 pm, garonne <[EMAIL PROTECTED]> wrote: >>>> >>>>> Hello, >>>>> >>>>> I 've started playing with Django which seems very well for what i >>>>> need but i still can figure out how to implement a very simple ajax >>>>> example: >>>>> >>>>> I would like to have a form with a textarea and after pressing the >>>>> button, i wish to see the form and the text print below. For some >>>>> reason i'm not able to keep both on the same page. I put my code >>>>> below. >>>>> >>>>>> cat views.py >>>>>> >>>>> from django.http import HttpResponse >>>>> from django.shortcuts import render_to_response >>>>> >>>>> from django import newforms as forms >>>>> >>>>> from django.contrib.admin.views.decorators import >>>>> staff_member_required >>>>> >>>>> class Form(forms.Form): >>>>> Entry = forms.CharField(max_length=100) >>>>> >>>>> def index(request): >>>>> if request.method == 'POST': >>>>> form = Form(request.POST) >>>>> if form['Entry'].data == "" or form['Entry'].data is >>>>> None : >>>>> Entry = " No entry" >>>>> else: >>>>> Entry = form['Entry'].data >>>>> return render_to_response('index.html', {'Entry': Entry}) >>>>> else: >>>>> form = Form() >>>>> return render_to_response('index.html', {'form': form}) >>>>> >>>>>> cat index.html >>>>>> >>>>> >>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> >>>>> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> >>>>> >>>>> >>>>> Testr >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> {{ form.as_table }} >>>>> >>>>> >>>>> >>>>> >>>>> {% if Entry %} >>>>> >>>>> Entry : {{Entry}} >>>>> >>>>> >>>>> {% endif %} >>>>> >>>>> >>>>> >>>>> I've found a way which is to resent a form variable to index HTML but >>>>> i think this is not the right thing to do. I would like to fill my >>>>> page in a incremental way. I think this is a trivial recipe... >>>>> >>>>> Thanks for your help, >>>>> Vincent. >>>>> >> -- >> ---<[EMAIL PROTECTED]> >> Vincent Garonne http://cern.ch/vincent.garonne >> CERN PH, CH-1211, Geneva 23, Switzerland >> Tel. +41 22 76 71181Fax. +41 22 76 78350 >> --=- >> > > > > > -- ---<[EMAIL PROTECTED]> Vincent Garonne http://cern.ch/vincent.garonne CERN PH, CH-1211, Geneva 23, Switzerland Tel. +41 22 76 71181Fax. +41 22 76 78350 --=- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: first naive question for a new fresh Django user
* would like vincent garonne a écrit : > Hi, > > I would to do the same than this example: > > http://www.hackorama.com/ajax/ > > Vince > > MikeHowarth a écrit : > >> I'm not entirely sure I follow your request. >> >> However using Ajax in Django is a fairly simple affair:http://www.b- >> list.org/weblog/2006/jul/02/django-and-ajax/ >> >> >> >> On Sep 11, 3:11 pm, garonne <[EMAIL PROTECTED]> wrote: >> >> >>> Hello, >>> >>> I 've started playing with Django which seems very well for what i >>> need but i still can figure out how to implement a very simple ajax >>> example: >>> >>> I would like to have a form with a textarea and after pressing the >>> button, i wish to see the form and the text print below. For some >>> reason i'm not able to keep both on the same page. I put my code >>> below. >>> >>> >>> >>>> cat views.py >>>> >>>> >>> from django.http import HttpResponse >>> from django.shortcuts import render_to_response >>> >>> from django import newforms as forms >>> >>> from django.contrib.admin.views.decorators import >>> staff_member_required >>> >>> class Form(forms.Form): >>> Entry = forms.CharField(max_length=100) >>> >>> def index(request): >>> if request.method == 'POST': >>> form = Form(request.POST) >>> if form['Entry'].data == "" or form['Entry'].data is >>> None : >>> Entry = " No entry" >>> else: >>> Entry = form['Entry'].data >>> return render_to_response('index.html', {'Entry': Entry}) >>> else: >>> form = Form() >>> return render_to_response('index.html', {'form': form}) >>> >>> >>> >>>> cat index.html >>>> >>>> >>> >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> >>> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> >>> >>> >>> Testr >>> >>> >>> >>> >>> >>> >>> {{ form.as_table }} >>> >>> >>> >>> >>> {% if Entry %} >>> >>> Entry : {{Entry}} >>> >>> >>> {% endif %} >>> >>> >>> >>> I've found a way which is to resent a form variable to index HTML but >>> i think this is not the right thing to do. I would like to fill my >>> page in a incremental way. I think this is a trivial recipe... >>> >>> Thanks for your help, >>> Vincent. >>> >>> >> >> >> > > > -- ---<[EMAIL PROTECTED]> Vincent Garonne http://cern.ch/vincent.garonne CERN PH, CH-1211, Geneva 23, Switzerland Tel. +41 22 76 71181Fax. +41 22 76 78350 --=- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: first naive question for a new fresh Django user
Hi, I would to do the same than this example: http://www.hackorama.com/ajax/ Vince MikeHowarth a écrit : > I'm not entirely sure I follow your request. > > However using Ajax in Django is a fairly simple affair:http://www.b- > list.org/weblog/2006/jul/02/django-and-ajax/ > > > > On Sep 11, 3:11 pm, garonne <[EMAIL PROTECTED]> wrote: > >> Hello, >> >> I 've started playing with Django which seems very well for what i >> need but i still can figure out how to implement a very simple ajax >> example: >> >> I would like to have a form with a textarea and after pressing the >> button, i wish to see the form and the text print below. For some >> reason i'm not able to keep both on the same page. I put my code >> below. >> >> >>> cat views.py >>> >> from django.http import HttpResponse >> from django.shortcuts import render_to_response >> >> from django import newforms as forms >> >> from django.contrib.admin.views.decorators import >> staff_member_required >> >> class Form(forms.Form): >> Entry = forms.CharField(max_length=100) >> >> def index(request): >> if request.method == 'POST': >> form = Form(request.POST) >> if form['Entry'].data == "" or form['Entry'].data is >> None : >> Entry = " No entry" >> else: >> Entry = form['Entry'].data >> return render_to_response('index.html', {'Entry': Entry}) >> else: >> form = Form() >> return render_to_response('index.html', {'form': form}) >> >> >>> cat index.html >>> >> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> >> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> >> >> >> Testr >> >> >> >> >> >> >> {{ form.as_table }} >> >> >> >> >> {% if Entry %} >> >> Entry : {{Entry}} >> >> >> {% endif %} >> >> >> >> I've found a way which is to resent a form variable to index HTML but >> i think this is not the right thing to do. I would like to fill my >> page in a incremental way. I think this is a trivial recipe... >> >> Thanks for your help, >> Vincent. >> > > > > > -- ---<[EMAIL PROTECTED]> Vincent Garonne http://cern.ch/vincent.garonne CERN PH, CH-1211, Geneva 23, Switzerland Tel. +41 22 76 71181Fax. +41 22 76 78350 --=- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---