Add assignment expressions (walrus operator) to Django templates
Project description
django-walrus
Installation
-
pip install django-walrus
(PyPI support in progress) -
Add
walrus
to your settings'sINSTALLED_APPS
-
That's it. Now you can go for a swim in ice-cold water, or maybe hunt a penguin.
Usage
Once django-walrus
is installed, you can use the power of the
in your template's {% if %}
statements:
{% if result := my_mode.some_expensive_method %}
Wow, check out this result: {{ result }}.
{% else %}
Nothing to see here.
{% endif %}
Is this real?
As real as a two ton polar mammal.
Optimized
You can activate some optimizations by setting WALRUS_OPTIMIZED=1
in your shell
environment.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-walrus-0.0.2.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for django_walrus-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1c83aab55eea7e54701d025e570fa925fa9fdfa1580aab950654f446f4da32a |
|
MD5 | 88bd156433e3d18390a2889c67a6e579 |
|
BLAKE2b-256 | 5b67a3fc951b38c9a0ad4432a28e1803873dc8e132bf63bdadb7a18d03ee4935 |