Saravanan666/pypi-org huggingface dataset:
Package: django-template-minifying-loader
Django application, providing simple template loader. It reduces HTML output in templates by stripping out whitespace characters between HTML and django template tags. This is an update ofdjango-template-minifierthat works with django 1.10.Things to note:Itdoes notmake any fancy compression, to do that useGZip Middleware.To compress CSS and JS usedjango-compressor.Installationviavirtualenv- yup we highly recommend it!pipinstalldjango-template-minifying-loaderBasic usageModify Your Django project settings’s module.For production(note cached loader):TEMPLATES=[{'DIRS':[str(APPS_DIR.path('templates')),],'OPTIONS':{'loaders':['django.template.loaders.cached.Loader','template_minifying_loader.loaders.filesystem.Loader','template_minifying_loader.loaders.app_directories.Loader',],},},]For development(each refresh reloads template):TEMPLATES=[{'DIRS':[str(APPS_DIR.path('templates')),],'OPTIONS':{'loaders':['template_minifying_loader.loaders.filesystem.Loader','template_minifying_loader.loaders.app_directories.Loader',],},},]Be happy having less spaces and new lines in Your templates!Advanced usage:Using modified settings You can:
* turn off stripping spaces between HTML tagsTEMPLATE_MINIFIER_HTML_TAGS=False# default = Trueturn off stripping spaces between Django template tags (s{%, %}s)TEMPLATE_MINIFIER_TEMPLATE_TAGS=False# default = Trueturn off all strippingTEMPLATE_MINIFIER=False# default = Truerun Your own strip_function, which preprocess templatesTEMPLATE_MINIFER_STRIP_FUNCTION='template_minifier.utils.strip_spaces_in_template'(There is a typo in variable name, see #2 for details)use only in productionifDEBUG:TEMPLATE_MINIFIER=FalseKnown issues:Don’t use // one line comments in Your inline javascript &lt;script&gt; or .js templates. In some cases, if You are using lot of {% if %} there, it can comment out }; or }, for example:// comment something - !!it's evil!!{%if%}functionname(){}{%endif%}Use /* */ instead/* comment something - it's nice and clean <3! */{%if%}functionname(){}{%endif%}Or just set TEMPLATE_MINIFIER_TEMPLATE_TAGS = FalseTo do:{% new_line %} template_tag
Package: django-template-mixins
A template filter that allows you to define and use mixins.InstallationIn your Django project, run:pip install django-template-mixinsand add mixin_templatetag to yourINSTALLED_APPSsetting:INSTALLED_APPS = [
  ...,
  'mixin_templatetag'
]and from there you can use it as follows:{% load mixins %}

{% mixin foo %}
    <div>
        <div>{{ name }}</div>
        <div>{{ description }}</div>
    </div>
{% endmixin %}

{% block content %}
...
{% mix foo with name="hello" description="world" %}
...
{% endblock %}If you want to use components instead, note that the feature is EXPERIMENTAL + there is a restriction that components can’t extend or include another file.Here’s an example of using components:component.html:<body>
    {% slot foo %}
    <div>DEFAULT_FOO{{ some_var }}</div>
    {% endslot %}


    {% slot bar %}
    <div>DEFAULT_BAR</div>
    {% endslot %}
</body>content.html:{% component 'component.html' with some_var=':(' %}
    {% slot bar %}
        my way
    {% endslot %}
{% endcomponent %}Why django-template-mixins?Currently in Django, if you want to repeat a block multiple times in separate blocks / areas in the same block, you have to create a separate file. The worst part is that these extracted bits of template tend to be single purpose - you aren’t likely to need it anywhere else besides that first template.Mixins allow you to keep things in one place and allows you to avoid DRY.I added in components (EXPERIMENTALLY) to the mix because it was requested, and after thinking about it for awhile it seemed like a useful feature that I would also want. From my basic tests it seems to work.Reporting bugsYou can report bugs inhttps://github.com/benlei/django-template-mixins/issues.If you believe you’ve found a bug, please try to identify the root cause and write up some sample code on how to reproduce it.AuthorBenjamin LeiContributors:xblitz
Package: django-template-model
django-template-modelDescriptionThis application will allow you to store templates in
your database, and discovering with any Template EngineSetupEdit your settings file as follows:INSTALLED_APPS = [
    ...
    template_model,
]TEMPLATES = [
  {
      'BACKEND': 'django.template.backends.django.DjangoTemplates',
      'DIRS': [ # your template dirs here
      ],
      'APP_DIRS': False,  # Disable auto discovering
      'OPTIONS': {
          'context_processors': [
              'django.contrib.auth.context_processors.auth',
              'django.template.context_processors.debug',
              'django.template.context_processors.i18n',
              'django.template.context_processors.media',
              'django.template.context_processors.static',
              'django.template.context_processors.tz',
              'django.contrib.messages.context_processors.messages',
              'django.template.context_processors.request',
          ],
          'loaders': [
              'django.template.loaders.filesystem.Loader',
              'django.template.loaders.app_directories.Loader',
              # add loader here if you want to use it with this backend
              'template_model.loader.Loader',
          ],
      },
  },Versions1.0.6           (2020-09-09)Support django 3.11.0.5           (2020-06-09)Simplify rendering1.0.4           (2020-06-08)Handle text or binary based templates (Compatibility with django-template-engines)1.0.3           (2020-06-05)Delete views / urls and useless restframework dependenciesNow with loader config, Template are discoverable like any other template1.0.2           (2020-06-05)Add python 3.8 and django 3.0 supportAdd loader to handle Django Template Engine support1.0.1           (2019-09-24)Update:mimetype and magic are no longer used1.0.0From now on,Templatemodel contains:a name (name),a mime type (mime_type),a file (template_file),the date of its creation (added),the date of its last update (updated).0.1.1This package is compatible withDjango>=2.1.0,<3.0.0etdjangorestframework>=3.8.0,<3.11.0.0.1.0From now on,Templatemodel contains:a name,a format,a content,the date of its creation,the date of its last update.0.0.1TemplatemodelAdmin siteView set with an additional route to download a template
Package: django-template-obfuscator
Obfuscates desired content in a Django template in order to be difficult to scrapeDocumentationThe full documentation is athttps://django-template-obfuscator.readthedocs.io.QuickstartInstall django-template-obfuscator:pip install django-template-obfuscatorAdd it to yourINSTALLED_APPS:INSTALLED_APPS = (
    ...
    'django_template_obfuscator.apps.DjangoTemplateObfuscatorConfig',
    ...
)How to use django-template-obfuscator’s template tags:{%loadstatic%}{%loadobfuscator%}<!-- Place text to encode in between the{%obfuscate%}and{%endobfuscate%}template
tags, then embed it into an Html element with the "obfuscated" class, that will will be
"deobfuscated" using Javascript  -->

<!-- CSS file that will avoid the user to copy the content in obfuscated class -->
<link rel="stylesheet" href="{%static'css/django_template_obfuscator.css'%}">

<p class="obfuscated">{%obfuscate%}Text difficult to scrape.{%endobfuscate%}</p>

<p class="obfuscated">{%obfuscate%}This text as well.{%endobfuscate%}</p>

<!-- JS in charge of deobfuscation, making the content understandable to the web's user -->
<script src="{%static'js/django_template_obfuscator.js'%}"></script>FeaturesTODORunning TestsDoes the code actually work?source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install selenium
(myenv) $ python django_template_obfuscator/tests.pyCreditsTools used in rendering this package:Cookiecuttercookiecutter-djangopackageHistory0.1.5 (2019-09-17)Testsupdated docs0.1.4 (2019-09-05)Improve docs.0.1.3 (2019-09-04)Fix small errors.0.1.2 (2019-09-04)Improvements-CSS copy prevention0.1.0 (2019-09-02)First release on PyPI.
Package: django-templatepages
django-templatepagesdjango-templatepagesis a Django app for mapping URLs to templates
on the filesystem as if they were static web pages. This is useful
for integrating static content into your Django project while still
leveraging the Django templating language.templatepages differs from django.contrib.flatpages in that the
content is stored entirely in templates on the filesystem, rather
than in a database. We developed this app to address a real-world
situation where much of the content in a project is static and
managed on the filesystem under version control. templatepages
allows us to factor out the page layout using the Django templating
language, and cleanly integrate the static content with other dynamic
components implemented as Django apps.Python’smimetypes.guess_type()is used to determine appropriate
Content-type and Content-encoding headers for the HTTP response.
This means that you can use templatepages for more than just HTML
files; for example, we use it to serve dynamically-generated CSS
stylesheets.UsageUsing templatepages is relatively straightforward: just add it toINSTALLED_APPSin your project’s settings.py file, and integrate
the URL mapping in your project’s urls.py file. Then place your
templates in your project’s templates/templatepages folder.For example, the following stanza in urls.py will configure your
project to map all requests beginning with articles/ to
templatepages:urlpatterns = patterns('',
    (r'^articles/', include('templatepages.urls')),
)In this example, a request forhttp://your.site/articles/contact.htmlshould result in templatepages attempting to return a rendered
template based ontemplates/templatepages/contact.html.
If this file cannot be found, templatepages will raise Http404.If no filename is specified in the URL, templatepages will attempt
to renderindex.html.templatepages passes RequestContext to the template, so full access
to template context processor variables is available.
Package: django-template-preview
=====Template Preview=====Template Preview is a simple Django app to preview Django-rendered templates within a browser.For example, if you send emails from Django, this is a quick and easy way to see your changes,without needing to constantly be sending yourself emails.Quick start-----------1. Add "template_preview" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [...'template_preview',]2. Include the template_preview URLconf in your project urls.py like this::url(r'^template_preview/', include('template_preview.urls')),Note: you might to only register this app/urls when DEBUG is set to True3. Start the development server and visit http://127.0.0.1:8000/template_preview/to view a list of your registered templates4. Click on a template name to view a form containing all of your template variables5. Provide any values you'd like to see in the rendered template.6. Click "Render" and your rendered template will appear in a modal.
Package: django-templatequery
InstallationInstall thedjango-templatequerypackage from the Python Package Index with
one of the following commands:easy_install django-templatequeryor:pip intall django-templatequeryIf you want to use the templatetags that come withdjango-templatequeryyou
need to put'django_templatequery'to the end of yourINSTALLED_APPSsetting.Please note: It maybe is a risk to make the templatetags available for template
designers. It is possible that they have access to models which they shouldn’t
have. Only do this if you trust the people that work on your templates!Usageto be written …Playing aroundIf you just want to play around with the code without installing in your system
you can use the example project the code repository contains. Branch the code
from launchpad with a simplebzr branchdjango-templatequeryand cd todjango-templatequery/example. Here you have a pretty standard django project
with amanage.pyand asettings.py.Start codingIn the case you want to contribute to the code I recommend the following steps:get a copy of the development repository from launchpad withbzr branchlp:django-templatequerycd into the branch directoryrunpython bootstrap.pyandpython bin/buildout(this will setup
the development environtment using buildout)check if the testsuite is passing:bin/testdive into the code belowsrc/and start hacking.
Package: django-template-repl
django-template-repl is a readline shell for the Django template language.It is similar to a CPython shell but it interprets template code instead ofPython. It can be invoked either as a management command or with a templatetag.To install, add 'template_repl' to your settings.INSTALLED_APPS.The management command gives you quick access to the shell:python manage.py templateshellYou can pass a url to the management command to assume the context of a specific location:python manage.py templateshell -u /admin/foo/bar/You can also provide context directly with a command line option. Here isan example of an interactive session:$ python manage.py templateshell -c "{'foo': 'FOO', 'bar': True}">>> {% if bar %}... {{ foo }}... {% endif %}FOO>>>The templateshell management command also has a --pdb option to allow you to loadthe context into a namespace and start a PDB debugger shell. This works in conjunctionwith the -u (--url) and -c (--context) commands. It also provides a "vars" list thatshows the names of the context variables:$ python manage.py templateshell -u /admin/ --pdb...ipdb> varsOut[0]:['app_path','error_message','root_path','title','MEDIA_URL','LANGUAGES','LANGUAGE_BIDI','LANGUAGE_CODE','perms','messages','user']ipdb> print userAnonymousUserIn addition, you can use the repl templatetag which creates a REPL that assumes thecontext of the caller template. This is basically "PDB for templates":{% load repl %}{% repl %}You can also start a real PDB shell using the same tag by giving it a second argumentof "pdb". This loads the contex into the PDB namespace:{% load repl %}{% repl pdb %}
Package: django-templatesadmin
Templates Admin is a tiny, nifty application for yourDjangoproject to edit
your templates, that are stored on your disk, via an admin interface.Originally this app was inspired bydbtemplates.Installation:Puttemplatesadmininto your INSTALLED_APPS setting.Add this line to your urlconf butbeforeyour admin include:(r'^admin/templatesadmin/', include('templatesadmin.urls')),Create a groupTemplateAdminsand put all users in there, who should been
able to edit templates. You don’t need to grant any permissions to that group.
Just call itTemplateAdmins.Keep in mind that also Superusers (is_adminflag) must belong to this group, if
they should been able to edit templates. The group name is case-sensitive!Point your webbrowser tohttp://localhost/admin/templatesadmin/and start
editing.Optional Settings:There are some settings that you can override in yoursettings.py:TEMPLATESADMIN_GROUP: The name of your group of your TemplatesAdmin
Users.Default:TemplateAdminsTEMPLATESADMIN_VALID_FILE_EXTENSIONS: A tuple of file-extensions (without
the leading dot) that are editable by TemplatesAdmin.Default:TEMPLATESADMIN_VALID_FILE_EXTENSIONS = (
    'html',
    'htm',
    'txt',
    'css',
    'backup'
)TEMPLATESADMIN_TEMPLATE_DIRS: A tuple of directories you want your users
to edit, instead of all templates.Default: All user-defined and application template-dirs.TEMPLATESADMIN_HIDE_READONLY: A boolean to wether enable or disable
displaying of read-only templates.Default:FalseTEMPLATESADMIN_EDITHOOKS: A tuple of callables edithooks. Edithooks are
a way to interact with changes made on a template. Think of a plugin system.There are two builtin edithooks:dotbackupfiles.DotBackupFilesHook: Creates a copy of the original file
before overwriting, naming it<oldname>.backup.gitcommit.GitCommitHook: Commits your templates after saving via git
version control.hgcommit.HgCommitHook: Creates amercurialcommit after saving.You can define your own edithooks, see above hooks as example.Default:TEMPLATESADMIN_EDITHOOKS = (
    'templatesadmin.edithooks.dotbackupfiles.DotBackupFilesHook',
)LICENSE:This application is licensed under theBeerware License.
SeeLICENSEfor details.Changelog:v0.7 (2012-11-20)Added missing permission check for an Admin view.v0.6 (2009-09-08)Published under a proper BSD license.The templates now inherits from the Django templates to provide a better
look and feel.A lot of overall improvements from typo fixing to better permission handling.
Thanks to peritus and rlaager.v0.5.5 (2009-02-13)Documented that there is a edithook for mercurial repositories.Bugfix in GitCommitHook: Allow non-ascii characters.v0.5.4 (2009-02-13)Fixed missing templatetags in pypi release.v0.5.3 (2009-02-03)Edit-Views now have an optional argument “base_form” to overwrite the default form.Removed shorten-path functions. They didn’t work under some conditions.List of templates in the admin overview are shorter.v0.5.2 (2008-12-12)Added a edithook for dealing with mercurial repositories. Thank you v.oostveen! (Issue3)Fixed handling of newline characters at the end of the file, which causes to
delete the last character. (Issue4)
Package: django-template-server
Runs a server that renders Django templates.This is intended for frontend developers and designers to be able to work with
Django templates before a backend developer/sysadmin sets up the Django project
properly.Installationsudo pip installdjango-template-serverUsagemaketemplateserver./runserver.py 8000Openhttp://127.0.0.1:8000maketemplateserverCreates a runserver executableAvailable options:-t/--templatedir: Folder with your templates, defaults to./templates-m/--mediadir: Folder with your media (css/js) files, defaults to./media-s/--staticdir: Folder with your static (css/js) files, defaults to./static-d/--django: Django version to use, defaults to 1.3-r/--runserverpath: Location where to put the runserver executable, defaults to./runserver.pyrunserver.pyRuns a server that serves templatesAvailable options:-l/--local: Make the server only listen locally.A port number can be given as positional argument, defaults to the lowest open port number above 8000.
Package: django-template-shortcodes
# django-template-shortcodesTHIS IS EXPERIMENTAL STUFF. Don’t use it. Probably.This package provides some [WordPress
shortcode](http://en.support.wordpress.com/shortcodes/) support for Django
templates. It is heavily based on [AGoodId’s version of django-shortcodes](https://github.com/AGoodId/django-shortcodes) (in turn based onhttps://code.google.com/p/django-shortcodes/), as well as [WP Export Parser](https://github.com/RealGeeks/wp_export_parser) for the regex parts, lifted from WordPress.## Supported shortcodes (sort of):[caption caption=”Foo bar”]<img src=”” alt=”” />[/caption][caption]<img src=”” alt=”” /> Foo bar[/caption][youtube=https://www.youtube.com/watch?v=dQw4w9WgXcQ][youtube url=”https://www.youtube.com/watch?v=dQw4w9WgXcQ”][gmaps url=”https://www.youtube.com/watch?v=dQw4w9WgXcQ”][vimeo url=”https://www.vimeo.com/watch?v=dQw4w9WgXcQ”][iframe url=”https://www.vimeo.com/watch?v=dQw4w9WgXcQ”]## InstallationInstall via pip:pip install django-template-shortcodesOr clone the [Git repository](https://github.com/emilbjorklund/django-shortcodes).## UsageParse shortcodes:{% load shortcodes_filters %}
{{ text|shortcodes|safe }}Remove shortcodes (completely, including contents inside):{% load shortcodes_filters %}
{{ text|removeshortcodes|safe }}
Package: django-template-shortcuts
django-template-shorcutsRemove boilerplate code when including JS and CSS files hosted by popular CDNs.RequirementsCorePython 2.7+ or Python 3.3+Django 1.7 through Django 1.9Installationpipinstalldjango-template-shorcutsAdd to your installed apps in settingsINSTALLED_APPS=(...'template_shortcuts',...)TEMPLATE_CDN_PROVIDER="template_shortcuts.providers.google.Google"There is support for multiple CDN backends and multiple JS libraries.
Currently only the Google CDN is supported with some support for Cloudfare’s CDNJS.Usage{%loadshortcuts%}{%jquery"1.7.2"%}Will yeild:<scripttype="text/javascript"src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>ContributingFound an issue or just want to add some functionality? Open an issue in the issue tracker on github, fork the project, hack away, and make a pull request when you’re done.
Package: django-templates-i18n
App provides ability to store templates in database and localize it using django-modeltranslation app.
It is useful if you need to change template content too often and you don’t want to recompile all ugettext messages
all the times. It is also suitable for email templates.Tested on Django 1.4.5.RequirementsDjangodjango-modeltranslationInstallationInstall python library using pip: pip install django-templates-i18nAddtemplates_i18ntoINSTALLED_APPSin your Django settings fileSync and migrate your databaseSpecify desired languages in your Django settings file:from django.utils.translation import gettext

LANGUAGE_CODE = 'en'
LANGUAGES = (
    ('en', gettext('English')),
    ('de', gettext('German')),
)Runsync_translation_fieldsandupdate_translation_fieldscommands (frommodeltranslationapp)UsageAjax call is made whenever the parent field is changed. You must set up the ajax URL to return json list of lists:from django.http import HttpResponse
from django.template import Template, Context
from django.views.generic import View

from templates_i18n.models import Template_i18n


class MyView(View):
    def dispatch(self, request, *args, **kwargs):
        template_i18n = Template_i18n.objects.get(machine_name='my-template')
        template = Template(template_i18n.content)
        context = Context({'user': request.user})
        return HttpResponse(template.render(context))or:from django.core.mail import send_mail
from django.template import Template, Context
from templates_i18n.models import Template_i18n


def dispatch(self, request, *args, **kwargs):
    template_i18n = Template_i18n.objects.get(machine_name='my-template')
    template = Template(template_i18n.content)
    context = Context({'user': request.user})
    message = template.render(context)
    send_mail('Subject here', message, 'from@example.com', ['to@example.com'], fail_silently=False)AuthorsLibrary is byErik TelepovskyfromPragmatic Mates. Seeour other libraries.
Package: django-templates-macros
django-templates-macrosAdd macros to your django templatesOriginThe original code of this app is taken fromhttps://djangosnippets.org/snippets/2892/by MattP.This snippets cites:Based on snippet by
    Michal Ludvig <michal@logix.cz> http://www.logix.cz/michal
    http://djangosnippets.org/snippets/363/

Extended for args and kwargs into templatetags/kwacro.py by
    Skylar Saveland <michal@logix.cz> http://skyl.org
    https://gist.github.com/skyl/1715202

Modified to support rendering into context by matt@peloquin.comWhereYou can find this package here:Github repository:https://github.com/twidi/django-templates-macrosPypi package:https://pypi.python.org/pypi/django-templates-macrosUsageAdd this app “macros” to your INSTALLED_APPSIn your template load the library:{% load macros %}Define a new macro called ‘my_macro’ that takes args and/or kwargs
All will be optional:{% macro my_macro arg1 arg2 baz="Default baz" %}
    {% firstof arg1 "default_arg1" %}
    {% if arg2 %}{{ arg2 }}{% else %}default_arg2{% endif %}
    {{ baz }}
{% endmacro %}Use the macro with string parameters or context variables:{% usemacro my_macro "foo" "bar" baz="KW" %}
<br>
{% usemacro my_macro num_pages "bar" %}Renders like:foo bar KW
77 bar Default bazAlternatively save your macros in a separate file, e.g. “mymacro.html” and load it to the current template with:{% loadmacros "mymacros.html" %}

Then use these loaded macros in as described above.Bear in mind that defined and loaded macros are local to each template
file and are not inherited through{% extends … %}tags.When recursive macros are needed, use the ‘recurse_macro’ template tag:{% macro MENU entries %}
<ul>
    {% for entry in entries %}
    <li>
        <a href="{{ entry.link }}"> {{ entry.label }} </a>
        {% if entry.children %}
            {% recurse_macro MENU entry.children %}
        {% endif %}
    </li>
    {% endfor %}
</ul>
{% endmacro %}
{% usemacro MENU menu.children %}