# Attributes | dj-assets | Modify the "href" or "src" attributes of elements with a path prefix and wrap them in a Django static command. | |----------------|----------------------------------------------------------------------------------------------------------------| | Syntax | `...` | | Example Input | `` | | Example Output | `` | | dj-attr | Dynamically assign attributes using Django template variables. | |----------------|---------------------------------------------------------------------------------------| | Syntax | `` | | Example Input | `
` | | Example Output | `
` | | dj-block | Replace the element with Django block tags. | |----------------|-----------------------------------------------------| | Syntax | `Content` | | Example Input | `
Content
` | | Example Output | `{% block content %}Content{% endblock %}` | | dj-command | Replace the element with a Django template command. | |----------------|-------------------------------------------------------------| | Syntax | `` | | Example Input | `
` | | Example Output | `{% url 'index' %}` | | dj-for | Replace the element with a Django template for loop. | |----------------|--------------------------------------------------------------| | Syntax | `Content` | | Example Input | `

Hello

` | | Example Output | `{% for item in list %}

Hello

{% endfor %}` | | dj-for-wrap | Wrap the element within a Django template for loop. | |----------------|-------------------------------------------------------------| | Syntax | `Content` | | Example Input | `
Content
` | | Example Output | `{% for item in list %}
Content
{% endfor %}` | | dj-if, dj-elif, dj-else | Replace the elements with a Django template if-elif-else structure. | |-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| | Syntax | `Content`
`Content`
`Content` | | Note | The `dj-elif` and `dj-else` attributes are optional. Multiple `dj-elif` attributes are allowed. | | Example Input | `
Test
Test2
Test3
` | | Example Output | `{% if condition1 %}Test{% elif condition2 %}Test2{% else %}Test3{% endif %}` | | dj-include | Replace the content of the element with a Django template include command. | |----------------|----------------------------------------------------------------------------| | Syntax | `` | | Example Input | `
` | | Example Output | `{% include "template_name.html" %}` | | dj-remove-default | Remove the Doctype, "head" element, and "script" element within the "body" element. It also unwraps the "body" and "html" elements, leaving only the remaining content of the "body" element. | |-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Syntax | `...` | | Note | This is meant to remove all the default html wrapper code most static html generators produce. | | Example Input | `...Content` | | Example Output | `Content` | | dj-remove | Remove the element. | |----------------|---------------------------------| | Syntax | `` | | Example Input | `

` | | Example Output | ` ` | | dj-static | Replace the value of the specified tag with a Django template static command, using the specified static file path. | |----------------|---------------------------------------------------------------------------------------------------------------------| | Syntax | `` | | Example Input | `` | | Example Output | `` | | dj-style | Modify the style attribute of a element with django variables. | |----------------|--------------------------------------------------------------------------------------------| | Syntax | `` | | Note | The `value_type` is optional. If not included still add the `;` after the value. | | Example Input | `
` | | Example Output | `
` | | dj-style-raw | Modify the style attribute of a element. The value will be inserted as is. | |----------------|----------------------------------------------------------------------------------| | Syntax | `` | | Example Input | `
` | | Example Output | `
` | | dj-unwrap | Remove the element's tags but keeps its content. | |----------------|--------------------------------------------------| | Syntax | `Content` | | Example Input | `

Hello, world!

` | | Example Output | `

Hello, world!

` | | dj-var | Replace the element's content with a Django template variable. | |----------------|----------------------------------------------------------------| | Syntax | `Content` | | Example Input | `

Hello, world!

` | | Example Output | `

{{ greeting }}

` |