Skip to main content

toggly-django

Feature blocks

With toggly-django 0.4.0+, render enabled and disabled content using matching iffeature blocks. Set negate=True on the disabled block:

{% load toggly_tags %}
{% iffeature "new-navigation" %}
  <nav>New navigation</nav>
{% endiffeature %}
{% iffeature "new-navigation" negate=True %}
  <nav>Classic navigation</nav>
{% endiffeature %}

negate accepts Django template expressions such as negate=show_disabled or negate=options.reverse|default:False, resolved on each render. Use the boolean True rather than the nonempty string "False", which is truthy. The feature key keeps its existing literal interpretation, whether quoted or unquoted. Both blocks evaluate the same current request context; negation applies to the result. If no client is configured, the positive block is hidden and the negated block renders. Only the selected block renders its children; Django autoescaping is preserved. These presentation gates do not replace authorization.

The legacy {% else %} branch remains supported for compatibility. It renders when the final result, including any negation, is false. Prefer paired blocks in new templates. Programmatic boolean helpers and view decorators are unchanged.

Initial context for remote variants

Requires toggly 0.7.0 and toggly-django 0.3.0.

# settings.py: application-wide startup defaults, not incoming request values.
TOGGLY = {
    "APP_KEY": "your-app-key",
    "ENABLE_VARIANTS": True,
    "IDENTITY": "user-123",           # Stable variants identity.
    "VARIANT_GROUPS": ["beta"],        # Targeting membership.
    "VARIANT_CLAIMS": {"plan": "pro"}, # String rule attributes.
}
# Programmatic configure_toggly also accepts identity, variant_groups, variant_claims.

Startup context avoids an initial variants fetch with incomplete targeting followed by a second fetch. Use one variants client per fixed application-wide context; never change a shared server client's identity for each incoming request. These defaults do not replace request-local EvaluationContext for ordinary local boolean evaluation. Enabling remote variants retains the SDK's existing client-wide evaluated-flag behavior.

Groups are trimmed and sent as repeated parameters. Claims must be string-to-string mappings: empty names/values are omitted, whitespace is preserved, and the first 20 claim names in sorted order are sent. Omitted or empty collections send no targeting parameters. Caller collections are copied. Variants caches and conditional validators match the complete context; legacy unscoped variants caches require a fresh fetch. Global definition caches retain their existing behavior.

Metadata

Release files for toggly-django 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toggly-django 0.4.1
File Size Uploaded Provenance Actions
toggly_django-0.4.1.tar.gz 15.8 kB With provenance Details for toggly_django-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for toggly-django 0.4.1
File Interpreter ABI Platform Actions
toggly_django-0.4.1-py3-none-any.whl Python 3 none any Details for toggly_django-0.4.1-py3-none-any.whl

Total release size: 28.5 kB

Release files / toggly_django-0.4.1.tar.gz

Download URL toggly_django-0.4.1.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f4b5fb86d6bc634a380143eaab88be248f207824dc87bd08327a4cbca3643f9f
BLAKE2b-256 checksum
How to use checksums
abe0611e4c5d4943a61ac66b59c55374fe7f6cddaaaf908f06e2d99000173fcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / toggly_django-0.4.1-py3-none-any.whl

Download URL toggly_django-0.4.1-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4194a0ea74703b81a6b16efa27418cea5cd954b42b69dae293c41d425493919e
BLAKE2b-256 checksum
How to use checksums
820151ea384f743c789b4d05cf82b2c71485a31e1b9bc1d6d5eace6c39bf117f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Security for toggly-django 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for toggly_django-0.4.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page