Skip to main content

Add assignment expressions (walrus operator) to Django templates

Project description

django-walrus

Dr. Walruss K-M

Installation

  1. pip install django-walrus
  2. Add walrus to your settings's INSTALLED_APPS
  3. 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 walrus operator 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


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.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

django_walrus-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file django_walrus-0.1.0.tar.gz.

File metadata

  • Download URL: django_walrus-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for django_walrus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bcaf48f0ce24e8647bab3ddc8fb125d0493555a93a2b44db5e9cae17c82648c1
MD5 9d8ccf0e574ae3d0e570209c589b8963
BLAKE2b-256 3eea0d579084e93575800afe1cfab3e122af28543b55df4704f0acfeae777ac7

See more details on using hashes here.

File details

Details for the file django_walrus-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_walrus-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec7c2052cb1f83d3992ac6bbdf277e9ff2a4246b52b9ce94825f08b5f9b7b966
MD5 954166e6989937f1eb2f81e98fa2689a
BLAKE2b-256 722d7f0c74de22dd6365d90bb055b752bd5b4213b2916712168d9c9444867e52

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page