Re: [google-appengine] The Newbie Doubts on Django Template

43 views
Skip to first unread message
Message has been deleted
Message has been deleted

djidjadji BG

unread,
Aug 24, 2008, 10:27:58 AM8/24/08
to google-a...@googlegroups.com
Hi Davide ,

http://www.djangoproject.com/documentation/templates/
The Section "Behind the scenes'

If the method has no parameters you can use

{{ model.key }}

If it is a tuple of list you can use

{{ item.0 }}

Is it possible to call methods that have parameters in the Django template?

Djidjadji

2008/8/24 Davide Rognoni <davide....@gmail.com>:
>
> Into Django templates you can not use Python syntax, for example:
>
> {{model.key()}}
> TemplateSyntaxError: Could not parse the remainder: ()
> http://groups.google.com/group/google-appengine/browse_thread/thread/28f3c3880c6510d7#
>
> {{item[0]}}
> TemplateSyntaxError: Could not parse the remainder: [1]
> http://groups.google.com/group/google-appengine/browse_thread/thread/58aa920ed20ba0c9#
>
> If you want to use the Python syntax, you can use:
> http://pypi.python.org/pypi/PyOoHtml/
>
> >
>

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Tim Hoffman

unread,
Aug 30, 2008, 7:34:50 AM8/30/08
to Google App Engine
Hi

zpt (which comes from zope and has been integrated with django)
runs fine on gae,

Alternately you can quite easily get raw zope page templates
working with gae

I have a live gae app which uses a cut down zope3 stack and z3c.forms
and some patches and hacks.

Once I get past our movie launch this week, I will point it out and
start documenting how I got a useable zope3 stack working.

Rgds

Tim

On Aug 30, 5:29 am, Davide Rognoni <davide.rogn...@gmail.com> wrote:
> Here another problem: "Re-using Template Snippets - Where's my {%with
> %}"http://groups.google.com/group/google-appengine/browse_thread/thread/...
>
> """I'd happily switch to a different template language that would
> allow me to re-use snippets, but it looks like most template languages
> don't work on appengine"""
>
> PyOoHtml works!
>
> On Aug 24, 7:07 pm, Davide Rognoni <davide.rogn...@gmail.com> wrote:
>
> > Here another problem "parsing xml in the template"http://groups.google.com/group/google-appengine/browse_thread/thread/...
>
> > The response: "Django template syntax is more limited than standard
> > Python syntax..."
>
> > My response is "PyOoHtml - Python Object Oriented HTML" (but it need
> > more code to resolve the common problems)
>
> > On Aug 24, 6:39 pm,DavideRognoni<davide.rogn...@gmail.com> wrote:
>
> > > and
>
> > > """Variable names must consist of any letter (A-Z), any digit (0-9),
> > > an underscore or a dot.
>
> > > Dots have a special meaning in template rendering. A dot in a variable
> > > name signifies lookup. Specifically, when the template system
> > > encounters a dot in a variable name, it tries the following lookups,
> > > in this order:
>
> > > - Dictionary lookup. Example: foo["bar"]
> > > - Attribute lookup. Example: foo.bar
> > > - Method call. Example: foo.bar()
> > > - List-index lookup. Example: foo[bar]
>
> > > The template system uses the first lookup type that works. It’s short-
> > > circuit logic."""http://www.djangoproject.com/documentation/templates_python/
>
> > > but I like Python syntax thenhttp://pypi.python.org/pypi/PyOoHtml/
> > > :-)
>
> > > On Aug 24, 6:05 pm,DavideRognoni<davide.rogn...@gmail.com> wrote:
>
> > > > "A method call will only work if the method has no required arguments"http://www.djangoproject.com/documentation/templates_python/
>
> > > > On Aug 24, 4:27 pm, "djidjadji BG" <djidja...@gmail.com> wrote:
>
> > > > > HiDavide,
>
> > > > >http://www.djangoproject.com/documentation/templates/
> > > > > The Section "Behind the scenes'
>
> > > > > If the method has no parameters you can use
>
> > > > > {{ model.key }}
>
> > > > > If it is a tuple of list you can use
>
> > > > > {{ item.0 }}
>
> > > > > Is it possible to call methods that have parameters in the Django template?
>
> > > > > Djidjadji
>
> > > > > 2008/8/24DavideRognoni<davide.rogn...@gmail.com>:
>
> > > > > > Into Django templates you can not use Python syntax, for example:
>
> > > > > > {{model.key()}}
> > > > > > TemplateSyntaxError: Could not parse the remainder: ()
> > > > > >http://groups.google.com/group/google-appengine/browse_thread/thread/...
>
> > > > > > {{item[0]}}
> > > > > > TemplateSyntaxError: Could not parse the remainder: [1]
> > > > > >http://groups.google.com/group/google-appengine/browse_thread/thread/...
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages