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 > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> > <head> > <link rel="stylesheet" href="style.css" /> > <title>Testr</title> > </head> > > <body> > > <div> > <form method="post" action=""> > <table>{{ form.as_table }}</table> > <input type="submit" /> > </form> > </div> > > {% if Entry %} > <div> > Entry : {{Entry}} > > </div> > {% endif %} > > </body> > > 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. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---