That sounds like a sensible feature. Do you want to open a ticket and maybe implement it?
On 17 Mar 2021, at 12:35, Josh Smeaton <josh.s...@gmail.com> wrote:
Is there a better API we can think of for customising widgets from the field constructor that could then be passed through? As a rough example:
my_step_field = forms.FloatField(widget_attributes={"step": 0.5})
Thoughts?
We set maxlength/minlength on widgets for CharFields because they map from an already existing kwarg.For the case of `step` on a FloatField we’d need to add a kwarg — but that’s only there to set a single attribute on the widget.
On 17 Mar 2021, at 15:34, Jacob Rief <jacob...@gmail.com> wrote:But FloatField also offers a min_value and max_value. When rendered as a widget, they are used as attributes min and max in their inputfield. In addition to that, the field value is validated against a value in that range. To be consistent, the same should apply to the step value.This would furthermore allow the field to validate against a multiple of that step value. Such a feature currently has to be implemented on the project level.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/8A007E70-C106-4705-B33C-ED8269161546%40gmail.com.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/11953496-ad4c-49cd-857d-e8723692197bn%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-developers/oVWKJUXTb1o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAL13Cg9kom4X57gaUp%2Bq8%3DqdEF_33hTEZ9AMi8bucXjaKXsX8Q%40mail.gmail.com.