[Django] #34826: Bounded Integer Range Field For Forms

9 views
Skip to first unread message

Django

unread,
Sep 9, 2023, 4:51:03 PM9/9/23
to django-...@googlegroups.com
#34826: Bounded Integer Range Field For Forms
-------------------------------------+-------------------------------------
Reporter: Atufa | Owner: Atufa Shireen
Shireen |
Type: New | Status: assigned
feature |
Component: Forms | Version: 4.2
Severity: Normal | Keywords: Forms,
| IntegerField, BoundedField,
Triage Stage: | RangeField
Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
**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.

--
Ticket URL: <https://code.djangoproject.com/ticket/34826>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 10, 2023, 4:16:29 AM9/10/23
to django-...@googlegroups.com
#34826: Bounded Integer Range Field For Forms
-------------------------------------+-------------------------------------
Reporter: Atufa Shireen | Owner: Atufa
| Shireen
Type: New feature | Status: closed
Component: Forms | Version: 4.2
Severity: Normal | Resolution: wontfix
Keywords: Forms, | Triage Stage:
IntegerField, BoundedField, | Unreviewed
RangeField |

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Sanders):

* status: assigned => closed
* resolution: => wontfix


Comment:

H Atufa,

Thanks for your suggestion though there are a couple of important points
here:

- Django already supplies range-based widgets for postgres which can be
used with forms (I'm assuming you're talking about pg here because that's
the only database backend that has range fields):
https://docs.djangoproject.com/en/4.2/ref/contrib/postgres/forms/#range-
fields
- All new feature requests (if this is separate from above) *must* be
discussed on the Django forum where it will reach more people that can
chime in on the conversation:
https://code.djangoproject.com/wiki/DevelopersMailingList

--
Ticket URL: <https://code.djangoproject.com/ticket/34826#comment:1>

Reply all
Reply to author
Forward
0 new messages