djlint / djLint

✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang
https://djLint.com
GNU General Public License v3.0
686 stars 84 forks source link

[BUG] [Formatter] object variable gets turned into repr of object type #756

Closed rafales closed 1 year ago

rafales commented 1 year ago

System Info

Issue

Well, I use variable "object" in my templates, similar to what django does ({% for object in object_list %}).

The following:

{{ do_something(object) }}

Gets turned into:

{{ do_something(<class 'object'>) }}
image

How To Reproduce

  1. Use above snippet as template example.
  2. Run djlint --reformat example.html.

Additional info

Config used (pyproject.toml):

[tool.djlint]
profile = "jinja"
indent = 2
ignore = "H021,H006,H013"
welcome[bot] commented 1 year ago

Thanks for opening your first issue here!

christopherpickering commented 1 year ago

:tada: This issue has been resolved in version 1.33.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

rafales commented 1 year ago

🎉 🔥 Thank you!

rob101 commented 11 months ago

This issue still persist if you use the object inside a tag, e.g. {% set my_var = object %}. See https://github.com/Riverside-Healthcare/djLint/issues/784