zostera/django-bootstrap4

How to have max and min values

Closed this issue · 1 comments

I have a filed in the model as

    temp_correction_index = models.IntegerField(
                            ("Temperature Correction Index"),
                            validators=[MinValueValidator(-10),MaxValueValidator(10)],
                             help_text=("Should be between -10 to 10")
                            )

and its html is as follows:

<div class="form-group row">
    <label class="col-md-3 col-form-label" for="id_temp_correction_index">
        Temperature Correction Index
    </label>
    <div class="col-md-9">
        <input autocomplete="off" class="form-control" id="id_temp_correction_index" name="temp_correction_index" placeholder="Temperature Correction Index" required="" title="Should be between -10 to 10" type="number">
            <small class="form-text text-muted">
                Should be between -10 to 10
            </small>
        </input>
    </div>
</div>

Since I am using a validator max and min, how to add max and min here to input

dyve commented

Hi, it looks like you might need some help getting set up. The best place to ask for help is StackOverflow. You will receive answers from a community of programmers!

If you ask your question on StackOverflow and use the tag django-bootstrap4, we'll be happy to reply over there!