Closed berycz closed 1 year ago
I started a branch with a first attempt with reproducing this as a test case, but so far no luck :(
aha, found it... I have the customized iommi.Table
as specified here: https://docs.iommi.rocks/en/latest/production_use.html
and I have:
class Table(iommi.Table):
class Meta:
member_class = Column
form_class = Form
query_class = Query
page_class = Page
action_class = Action
# "Search" has cz translate "Hledat" and I need "Hledané slovo"
query__form__fields__freetext_search__display_name = _("Search term") # cz: "Hledané slovo"
and the query__form__fields__freetext_search__display_name
somehow does it
btw same thing happens when I put it in style instead
foo = Style(
Field={
"label__attrs__class__required": lambda field, **_: bool(field.required),
...
},
Table={
# "Search" has cz translate "Hledat" and I need "Hledané slovo"
"query__form__fields__freetext_search__display_name": _("Search term"), # cz: "Hledané slovo"
},
...
)
Interesting! I'll take another stab at trying to reproduce.
Thanks, it works! I even tried (just to be sure)
query__form__fields__freetext_search__input__attrs = {"data-foo": "FOO"}
query__form__fields__freetext_search__label__attrs = {"data-bar": "BAR"}
^ related issue #404 got fixed by this but it's unclear why
In my custom style I have
and then the
table__query__form__fields__freetext_search__label
gets rendered with classrequired
, even though the rendered html input doesn't haverequired
attribute.This happens to me on all models so far (I use
Table.auto__model
)For example model
and table
I also tried using freetext on a different model for only one model field which was
blank=True
, yet the label still got classrequired
.For now I "fixed" it with: