{ "info": { "author": "Ozgur Sefik Altunyurt", "author_email": "altunyurt@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Topic :: Internet :: WWW/HTTP", "Topic :: Text Processing :: Markup :: HTML" ], "description": "Djtemps aims to ease Django - Jinja2 templates integration.\n\nUsage:\n\nSimply add the following line to your imports::\n\n from djtemps import render_to_response\n\nor\n\n from djtemps import render_to_string\n\nand you're done. You can use both just the same as django's render_to_response,\nsuch as\n\n ...\n return render_to_response(filename, context, request_context, mimetype)\n\nI simply use it as::\n\n def view(request):\n ...\n return render_to_response(template_name, locals())\n\nThis way all local variables including request context are passed to render_to_response\nmethod. Implicit, yet handy when your scope is not much polluted.\n\n\nIfyou want to use additional filters, extensions or methods within your templates\nadd any of the following lines to your settings.py::\n\n JINJA_EXTENSIONS = ['name.of.your.extension.module1', 'name.of.your.extension.module2.' ... ]\n JINJA_FILTERS = ['name.of.your.filter.method1', ...]\n JINJA_METHODS = ['name.of.your.method', ...]\n\nnames must be strings, in module name format. such as::\n\n JINJA_METHODS = ['djtemps.jinja_methods.enum', 'djtemps.jinja_methods.url_for',\n 'djtemps.jinja_methods.pagination', 'djtemps.jinja_methods.logger']\n\nBy the way djtemps provides the 4 method above by default, just state them in your settings file\nas mentioned.\n\nShortly:\n - enum is enumerate starting from 1 instead of 0, not really sure why i needed it\n - url_for is identical to url_for in django templates . usage: {{ url_for ('url_name', args, kwargs) }}\n - pagination is a simple pagination method. usage: {{ pagination(page_obj, request, num_items_per_page) }}\n - logger is a logging instance enabling logging in templates. usage: {{ logger.debug('Debug message')}}\n\nMethods are plain python functions. For filter and extension structure, you'll need\nto have a look at the jinja2 documents.\n\nThere are two extensions in the package for now:\n 1. CsrfExtension providing csrf_token for using tokens in forms. Simply put it into your form structure, such as:\n\n
\n and you're done. Credit goes to http://djangosnippets.org/snippets/1847/\n\n\n 2. Markdown2 extension for enabling markdown2 support in templates. For credits and usage details please refer to http://www.silassewell.com/blog/2010/05/\n\n\nIf you want to enable translations in jinja2 templates:\n\n - copy the management directory in this package to your apps' directory (your_project/app/management) as a whole\n - add translation blocks to your jinja2 templates::\n\n {% trans %} text to be translated {% endtrans %}\n\n - issue the makemessages command as usual. If you use another extension for your jinja templates , declare it with\n\"-e extension\" parameter. For example I use .jinja extension for my templates::\n\n ./manage.py makemessages -l lang_code -e .jinja", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/altunyurt/djtemps", "keywords": null, "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "djtemps", "package_url": "https://pypi.org/project/djtemps/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/djtemps/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/altunyurt/djtemps" }, "release_url": "https://pypi.org/project/djtemps/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Django - Jinja2 Templates Integration", "version": "0.1.1" }, "last_serial": 294197, "releases": { "0.1": [], "0.1.1": [] }, "urls": [] }