[Django] #20674: html5 Input Type: range

47 views
Skip to first unread message

Django

unread,
Jun 28, 2013, 3:38:22 AM6/28/13
to django-...@googlegroups.com
#20674: html5 Input Type: range
-----------------------------+---------------------------------------
Reporter: bps | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: master
Severity: Normal | Keywords: html5, range, field types
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------
Hello!
New html5 input types was added (NumberInput, EmailInput, URLInput etc.) -
it's beautiful. But what about the RangeInput?

Example:

{{{
<input type="range" name="points" min="1" max="10">
}}}


It has following attributes:


{{{
max - specifies the maximum value allowed
min - specifies the minimum value allowed
step - specifies the legal number intervals
value - Specifies the default value
}}}

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

Django

unread,
Jun 28, 2013, 4:51:11 AM6/28/13
to django-...@googlegroups.com
#20674: html5 Input Type: range
-------------------------------------+-------------------------------------
Reporter: bps | Owner: nobody
Type: New feature | Status: closed
Component: Forms | Version: master
Severity: Normal | Resolution: wontfix
Keywords: html5, range, field | Triage Stage:
types | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: new => closed
* needs_better_patch: => 0
* resolution: => wontfix
* needs_tests: => 0
* needs_docs: => 0


Comment:

I think the idea is that Django provides the most natural widget types for
each of its form fields, that's why we added the specialized new input
types (IntegerField -> NumberInput, EmailField -> EmailInput, URLField ->
URLInput).

Now we don't plan to cover the entire range of new input types as
individual widget classes, as it is so easy to create your own for your
needs. You can do that by either creating your own Input subclasses, or
even by specifying attributes in widget initialization:
{{{
count = forms.IntegerField(widget=NumberInput(attrs={'type':'range',
'step': '2'}))
}}}

See also https://docs.djangoproject.com/en/dev/ref/forms/widgets/#styling-
widget-instances

If you'd like to discuss that with a broader audience, feel free to bring
that topic on the django-developers mailing list.

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

Django

unread,
Jun 28, 2013, 6:43:10 AM6/28/13
to django-...@googlegroups.com
#20674: html5 Input Type: range
-------------------------------------+-------------------------------------
Reporter: bps | Owner: nobody
Type: New feature | Status: closed
Component: Forms | Version: master

Severity: Normal | Resolution: wontfix
Keywords: html5, range, field | Triage Stage:
types | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by bps):

Replying to [comment:1 claudep]:


> I think the idea is that Django provides the most natural widget types
for each of its form fields, that's why we added the specialized new input
types (IntegerField -> NumberInput, EmailField -> EmailInput, URLField ->
URLInput).
>
> Now we don't plan to cover the entire range of new input types as
individual widget classes, as it is so easy to create your own for your
needs. You can do that by either creating your own Input subclasses, or
even by specifying attributes in widget initialization:
> {{{
> count = forms.IntegerField(widget=NumberInput(attrs={'type':'range',
'step': '2'}))
> }}}
>
> See also https://docs.djangoproject.com/en/dev/ref/forms/widgets
/#styling-widget-instances
>
> If you'd like to discuss that with a broader audience, feel free to
bring that topic on the django-developers mailing list.

But RangeInput need validation on server side (max, min, step), like
NumberInput, EmailInput, URLInput. At the moment I must write custom
validators for range input ((.

--
Ticket URL: <https://code.djangoproject.com/ticket/20674#comment:2>

Django

unread,
Jun 28, 2013, 8:46:08 AM6/28/13
to django-...@googlegroups.com
#20674: html5 Input Type: range
-------------------------------------+-------------------------------------
Reporter: bps | Owner: nobody
Type: New feature | Status: closed
Component: Forms | Version: master

Severity: Normal | Resolution: wontfix
Keywords: html5, range, field | Triage Stage:
types | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by claudep):

Replying to [comment:2 bps]:


> But RangeInput need validation on server side (max, min, step), like
NumberInput, EmailInput, URLInput. At the moment I must write custom
validators for range input ((.

For max and min, you should be able to use the current validators
available for IntegerField. For any more specialized validation like
`step`, providing a custom validator at form field level is the way to go.
It's not common enough to warrant integration in core, in my opinion.

--
Ticket URL: <https://code.djangoproject.com/ticket/20674#comment:3>

Django

unread,
Jul 18, 2024, 4:10:45 PM7/18/24
to django-...@googlegroups.com
#20674: html5 Input Type: range
-------------------------------------+-------------------------------------
Reporter: bps | Owner: nobody
Type: New feature | Status: closed
Component: Forms | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: html5, range, field | Triage Stage:
types | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Natalia Bidart):

#35600 was a duplicate.
--
Ticket URL: <https://code.djangoproject.com/ticket/20674#comment:4>
Reply all
Reply to author
Forward
0 new messages