Add assignment expressions (walrus operator) to Django templates
Project description
django-walrus
Installation
-
pip install django-walrus
-
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.3.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for django_walrus-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 552ce18a55fdcde73528a5c938c9451305bc21dbefcbdbd39c7ab352741b8c0a |
|
MD5 | 7829836813f58a934dcd738d1de4a68f |
|
BLAKE2b-256 | 4adc409e4a057cc321614894ff331319300bafc370c46fdcf2e411cd3e4acd9c |