Model NumberField with min/max validation as form field not showing

If one have a model, with a models.NumberField, and the field has min/max validation: e.g.:

foo = models.SmallIntegerField( "Foo'ness", validators=(MinValueValidator(0), MaxValueValidator(100)),)

Then if one creates a forms.ModelForm from that model, when the form is rendered, I noticed it does not have min/max attributes, e.g.

<input name="foo" type="number" min="0" max="100" required>

Is this by design or am I doing something wrong?

With regards to client side validation, required shows but not min / max.

I thought I would checked here before raising a bug.

There does appear to be an open ticket for this - #26834 (MinValueValidator/MaxValueValidator not forwarded to form field for ModelForm) – Django

You can work around this by specifying the desired attributes for the widget in the ModelForm Meta class.