Search Results

Search found 6 results on 1 pages for 'jinja'.

Page 1/1 | 1 

  • Jinja2 returns "None" string for Google App Engine models

    - by Brian M. Hunt
    Google App Engine models, likeso: from google.appengine.ext.db import Model class M(): name = db.StringProperty() Then in a Jinja2 template called from a Django view with an in instance of M passed in as m: The name of this M is {{ m.name }}. When m is initialized without name being set, the following is printed: The name of this M is None. The preferable and expected output (and the output when using Django templates) would be/is: The name of this M is . Do you know why this is happening, and how to get the preferred & expected output?

    Read the article

  • Jquery data() returning undefined

    - by David Lockwood
    I have been doing a simple jquery data() test. However it is returning undefined. It works on jsfiddle though (http://jsfiddle.net/yrCdj/). I have a jinja2 loop which populates a div and I want to tag it with some metadata for use later : {% for s in siteInfo[:markers[0]] %} <div class="sitebox2"> <script> $(".sitebox2:last").append('<a href="/sites/d?siteid={{s[5]}}">{{s[0]}}</a><br>Distance from {{loc}} is {{s[6]}} km.<br>'); $(".sitebox2:last").data('fruit', 'apple'); </script> </div> {% endfor %} I then try to call this data to test if it is working: <script type="text/javascript"> $(".sitebox2").each(function(k, v) { var f = $(v).data('fruit'); alert(f); }); </script> It returns undefined. Any ideas on what is going wrong?

    Read the article

  • Import / include assigned variables in Jinja2

    - by Brian M. Hunt
    In Jinja2, how can one access assigned variables (i.e. {% set X=Y %}) within files incorporated with include? I'd expect the following to work given two Jinja2 files: A.jinja: Stuff {% include 'B.jinja' -%} B has {{ N }} references B.jinja: {% set N = 12 %} I'd expect that A.jinja, when compiled with Jinja2, would produce the following output: Stuff B has 12 references However, it produces: Stuff B has references I'd be much obliged for any input as to how to access the Jinja2 variables, such as N above, in the file that includes the file where N is set. Thank you for reading. Brian

    Read the article

  • Why should I use a web framework's template language over python's templating options?

    - by stariz77
    I'm coming from a python CGI background and was wanting to move into something more contemporary and think I have decided upon web.py as the framework I would like to use. In regards to templating, previously I used formatted strings and the string.Template module to effect most of my templating needs. After reading through a few of the templating options I have heard mentioned, I began wondering what the main benefits of using something like the Django or jinja templating options over "native" Python templating options were? Am I just going to be replacing $tmpl_var with {{ tmpl_var }} and s.substitute(tmpl_var=value) with t.render(s), i.e., alternate syntax? or will I gain additional advantages from using these templating systems?

    Read the article

  • How do I access session data in Jinja2 templates (Bottle framework on app engine)?

    - by TylerW
    Hello! I'm running the micro framework Bottle on Google App Engine. I'm using Jinja2 for my templates. And I'm using Beaker to handle the sessions. I'm still a pretty big Python newbie and am pretty stoked I got this far :) My question is how do I access the session data within the templates? I can get the session data no problem within the actual python code. And I could pass the session data each time I call a jinja template. But since I need the session data in the main menu bar of the site... that means I would have to pass it on every single page. Does anyone know if I can access it directly in the templates? For example I need the session data for my header links: Home | FAQ | Login or Home | FAQ | Logout Any help is greatly appreciated! :D

    Read the article

  • Where do files included in MANIFEST.in end up?

    - by Brian Hicks
    I'm not sure if I can't find this or if my google-fu is just lacking at the moment: I've got some HTML template files included in a package, with the following MANIFEST.in: recursive-include flockdoc/templates *.html In development, I'm including these (for Jinja) by doing path calculations, assuming that the "templates" directory is next to a certain file. When the package is installed with setup.py (using setuptools) the templates aren't copied into site-packages with the code. I understand that they're supposed to be somewhere like dist-packages, but none of the documentation I can find is pointing me to where the actual files are. It's also not giving me "best practice" for including these in my code. Any suggestions would be welcome there. the setup.py in question So: where are my files?

    Read the article

1