pip install django-walrus- Add
walrusto your settings'sINSTALLED_APPS - That's it. Now you can go for a swim in ice-cold water, or maybe hunt a penguin.
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 %}As real as a two ton polar mammal.
You can activate some optimizations by setting WALRUS_OPTIMIZED=1 in your shell
environment.
