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 of
Python. 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 templateshell
You 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 is
an 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 load
the context into a namespace and start a PDB debugger shell. This works in conjunction
with the -u (--url) and -c (--context) commands. It also provides a "vars" list that
shows the names of the context variables:
$ python manage.py templateshell -u /admin/ --pdb
...
ipdb> vars
Out[0]:
['app_path',
'error_message',
'root_path',
'title',
'MEDIA_URL',
'LANGUAGES',
'LANGUAGE_BIDI',
'LANGUAGE_CODE',
'perms',
'messages',
'user']
ipdb> print user
AnonymousUser
In addition, you can use the repl templatetag which creates a REPL that assumes the
context 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 argument
of "pdb". This loads the contex into the PDB namespace:
{% load repl %}{% repl pdb %}
It is similar to a CPython shell but it interprets template code instead of
Python. 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 templateshell
You 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 is
an 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 load
the context into a namespace and start a PDB debugger shell. This works in conjunction
with the -u (--url) and -c (--context) commands. It also provides a "vars" list that
shows the names of the context variables:
$ python manage.py templateshell -u /admin/ --pdb
...
ipdb> vars
Out[0]:
['app_path',
'error_message',
'root_path',
'title',
'MEDIA_URL',
'LANGUAGES',
'LANGUAGE_BIDI',
'LANGUAGE_CODE',
'perms',
'messages',
'user']
ipdb> print user
AnonymousUser
In addition, you can use the repl templatetag which creates a REPL that assumes the
context 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 argument
of "pdb". This loads the contex into the PDB namespace:
{% load repl %}{% repl pdb %}
Metadata
Release files for django-template-repl 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-template-repl-0.3.0.tar.gz | 7.5 kB | Without provenance | Details |
Release files / django-template-repl-0.3.0.tar.gz
| Download URL | django-template-repl-0.3.0.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07f4d8e9aa76a0890c27c0ff74145057812497301158bc48c995a3c6a5fbd04f
|
|
BLAKE2b-256 checksum How to use checksums |
96707a021b70657a545804cbd21c8ddeae3a86910912b9b46bbd4f9661fb9d44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-template-repl 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.