How to use this solution https://stackoverflow.com/a/10067749/604240 in jinja 2 template?
相关问题
- java.lang.NullPointerException at java.io.PrintWri
- __call__() missing 1 required positional argument:
- Upload file to Google Cloud Storage using AngularJ
- Where is the best place to put one-time and every-
- facebook “could not retrieve data from URL”
相关文章
- Is there a size limit for HTTP response headers on
- appcfg.py command not found
- Google app engine datastore string encoding proble
- Angular route not working when used with Google Ap
- Using include to dynamically point to HTML
- Doctrine not finding data on Google App Engine?
- Is it possible to have Jinja2 ignore sections of a
- Using OkHttp client via OKClient on Google App Eng
I agree my question was due to lack of knowledge than problem. Eventually I figured it out how to achieve it. Basically I didn't know how to link loop from python code to query so it's available to Jinja2 template.
Although correct solution might be to use map() with callback function https://developers.google.com/appengine/docs/python/ndb/queryclass#Query_map but I am using temporary solution which is working for me for now.
and in template
Why don't you just try
{{ item.key.parent().get().slug }}
on your jinja2 template (assuming that slug is a property of your Gallery entity).