You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a render the widget with Django i get the attrs:
(...)
<input type="checkbox" name="ventas" value="95" id="id_ventas_0" data-total="5220">
<input type="checkbox" name="ventas" value="94" id="id_ventas_1" data-total="6000">
(...)
BUT If I render with django-bootstrap5 I dont get the attrs. (data-total) on the checkbox.
The text was updated successfully, but these errors were encountered:
Following the Django Docs I Have this: (Docs: https://docs.djangoproject.com/en/4.0/ref/forms/fields/#iterating-relationship-choices)
class CheckboxSelectMultipleWithAttrs(CheckboxSelectMultiple):
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
option = super().create_option(name, value, label, selected, index, subindex, attrs)
if value:
option['attrs']['data-total'] = value.instance.total
return option
If a render the widget with Django i get the attrs:
(...)
<input type="checkbox" name="ventas" value="95" id="id_ventas_0" data-total="5220">
<input type="checkbox" name="ventas" value="94" id="id_ventas_1" data-total="6000">
(...)
BUT If I render with django-bootstrap5 I dont get the attrs. (data-total) on the checkbox.
The text was updated successfully, but these errors were encountered: