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 details)
Built Distribution
File details
Details for the file django-walrus-0.0.3.tar.gz
.
File metadata
- Download URL: django-walrus-0.0.3.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24d573944cf3a4fe9f255dbeab36083e749becde68cee99673481408b5716f7b |
|
MD5 | c2ec798cf6dcd79f6bbb310d08a22f59 |
|
BLAKE2b-256 | 9a1c9086e357a23ced60a93098bf8d6cbe18b064db0471f6008122a1348801a0 |
File details
Details for the file django_walrus-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: django_walrus-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 552ce18a55fdcde73528a5c938c9451305bc21dbefcbdbd39c7ab352741b8c0a |
|
MD5 | 7829836813f58a934dcd738d1de4a68f |
|
BLAKE2b-256 | 4adc409e4a057cc321614894ff331319300bafc370c46fdcf2e411cd3e4acd9c |