Opened 14 months ago
Closed 14 months ago
#34826 closed New feature (wontfix)
Bounded Integer Range Field For Forms
Reported by: | Atufa Shireen | Owned by: | Atufa Shireen |
---|---|---|---|
Component: | Forms | Version: | 4.2 |
Severity: | Normal | Keywords: | Forms, IntegerField, BoundedField, RangeField |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Overview:
There are fields in Django like integer range where lower bound is included but the upper bound is excluded. Therefore, the goal of this ticket is to introduce a new form field, BoundedRangeField, that extends Django's IntegerField to allow the creation of custom integer range fields in forms. This field will be particularly useful when you need to specify a specific range of integers for input in your forms.
Usage:
To use the BoundedRangeField, developers will be able to specify the minimum and maximum values for the integer range when defining form fields. For example:
my_field = BoundedRangeField(min_val=0, max_val=100)
This will create a form field that accepts integers between 0 and 100.
Additional Notes:
The proposed BoundedRangeField is designed to align with Django's form field conventions and maintain compatibility with database-related functionality.
Testing and documentation updates will be necessary to ensure proper integration and usage of this new field.
Please feel free to review and provide feedback on this proposal. Once the proposal is accepted, I will proceed with implementing the feature and submitting a pull request.
H Atufa,
Thanks for your suggestion though there are a couple of important points here: