On Tue, Apr 22, 2008 at 12:02 PM, Explore <[EMAIL PROTECTED]>
wrote:
>
> Hi. I am new to django and I am trying to get a handle around the form
> processing. I am using the svn trunk Revision: 7419 on Windows with
> the development server. I have a views.py setup in my app that looks
> like this:
>
> form = TestingForm()
> print form.as_table()
> print form.as_table
> return render_to_response('testing.html', { 'form':TestingForm })
>
>
You are passing the TestingForm class into the template context instead of
the form instance you created. This should be:
return render_to_response('testing.html', { 'form': form })
Karen
>
> When I look at the output of this on my development server I see that
> form.as_table prints out the object info and form.as_table() prints
> out the tr tags for the form. So this looks like form.as_table() is
> working as it should when printing to the command line.
>
> However, when I try to use this in my template testing.html like this:
>
> test 1<br/>
> <table>
> {{ form.as_table }}
> </table>
>
> nothing prints out (maybe because it is trying to print the object
> instead of calling the method?) However, when I try:
>
> form.as_table() I get the following syntaxerror:
> Could not parse the remainder: '()' from 'form.as_table()'
>
> How can I use form.as_table in my template?
>
> I am new to both python and django so any help would be appreciated.
> Thanks very much.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---