Skip to main content

Add assignment expressions (walrus operator) to Django templates

Project description

django-walrus

Installation

  1. pip install django-walrus (PyPI support in progress)

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

Uploaded Source

Built Distribution

django_walrus-0.0.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file django-walrus-0.0.2.tar.gz.

File metadata

  • Download URL: django-walrus-0.0.2.tar.gz
  • Upload date:
  • Size: 3.6 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

Hashes for django-walrus-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2cb2a7252cd4391685513a7d8f549f9e41a7c2ec03c62c8b4c65bb3facbcc841
MD5 fa5cd278c607cd4cf2418ebab3c87f6e
BLAKE2b-256 4184fa1c288b7e7aa072fd8614b501ccdbb37947b41467aee7c656beddea2708

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_walrus-0.0.2-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

Hashes for django_walrus-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a1c83aab55eea7e54701d025e570fa925fa9fdfa1580aab950654f446f4da32a
MD5 88bd156433e3d18390a2889c67a6e579
BLAKE2b-256 5b67a3fc951b38c9a0ad4432a28e1803873dc8e132bf63bdadb7a18d03ee4935

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