Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [Linter] [Django] Wrong indentation if the custom template tag name starts with "for" #686

Closed
fab10m opened this issue Jun 5, 2023 · 5 comments
Labels
🔍 linter 🦠 bug Something isn't working released

Comments

@fab10m
Copy link

fab10m commented Jun 5, 2023

I have this block of code

{% for i in items %}
    <div>{% formfield i %}</div>
{% endfor %} 

and djlint put the {% endfor %} immediately after formfield tag.

{% for i in items %}
    <div>{% formfield i %}</div>{% endfor %} 

Thanks,
Fabio

System Info

  • OS: MacOS Ventura 13.3.1
  • Python Version 3.9.4
  • djLint Version 1.29.0
  • template language: django
@fab10m fab10m added 🔍 linter 🦠 bug Something isn't working labels Jun 5, 2023
@welcome
Copy link

welcome bot commented Jun 5, 2023

Thanks for opening your first issue here!

christopherpickering pushed a commit that referenced this issue Jun 12, 2023
# [1.31.0](v1.30.2...v1.31.0) (2023-06-12)

### Bug Fixes

* **formatter:** fixed `line_break_after_multiline_tag` to force break in all cases ([3b37ec8](3b37ec8)), closes [#680](#680)
* **formatter:** fixed isolated quotes being deleted from attributes ([19425f9](19425f9)), closes [#652](#652)
* **formatter:** fixed wild match on template tags ([d288b78](d288b78)), closes [#686](#686)
* **linter:** fixed false positive on t001 ([1caf4c4](1caf4c4)), closes [#606](#606)

### Features

* **formatter:** added `max-blank-lines` flag to consolidate blank lines ([4a7897f](4a7897f)), closes [#675](#675)
* **formatter:** added support for symphony forms ([e716ddc](e716ddc)), closes [#476](#476)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.31.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@fab10m
Copy link
Author

fab10m commented Jun 13, 2023

HI Christopher,

I just upgraded djlint to last realease but I still have the issue.

Before djlint formatting

<div class="form-inputs plans-form">
    <div class="trans-wrapper pos-comparator-flex">
        {% for field in POSOptimizer %}
            <div>
                <label>{{ field.label }}</label>
                {% formfield field show_label=False %}
            </div>
        {% endfor %}
        <div>
            <label>&nbsp</label>
            <button type="submit">{% trans "Calcola" %}</button>
        </div>
    </div>
</div>

After djlint fromatting

<div class="form-inputs plans-form">
    <div class="trans-wrapper pos-comparator-flex">
        {% for field in POSOptimizer %}
            <div>
                <label>{{ field.label }}</label>
                {% formfield field show_label=False %}</div>{% endfor %}
        <div>
            <label>&nbsp</label>
            <button type="submit">{% trans "Calcola" %}</button>
        </div>
    </div>
</div>

@christopherpickering
Copy link
Contributor

@fab10m thanks for the example, I will check it out!

christopherpickering pushed a commit that referenced this issue Jun 26, 2023
## [1.31.1](v1.31.0...v1.31.1) (2023-06-26)

### Bug Fixes

* **formatter:** fixed formatter formatting ignored code ([5c75d87](5c75d87)), closes [#655](#655)
* **formatter:** fixed function formatting with nested quoted parenthesis ([6d63a6a](6d63a6a)), closes [#698](#698)
* **formatter:** fixed overgrabbing on template tag condensing ([75c3134](75c3134)), closes [#686](#686)
* **formatter:** function index was not formatted correctly ([a197200](a197200)), closes [#693](#693)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.31.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔍 linter 🦠 bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

2 participants