JavaScript Slider in Django Form

603 views
Skip to first unread message

oboedude

unread,
Jan 23, 2009, 3:43:00 PM1/23/09
to Django users
I'm new to Django, so please be patient and bear with me. I am looking
to create a form in Django with several text inputs and an analog
slider. I know how to make the text inputs, but I'm having trouble
with the slider. I have some JavaScript code that creates analog
sliders and I'd like to make a custom widget that I can incorporate in
my form. I know Django has some admin widgets but I'm not sure how to
create a custom widget of my own.

How do I create a custom widget and what do I have to do to use my
custom widget in a form?

mail....@gmail.com

unread,
Jan 23, 2009, 4:57:39 PM1/23/09
to Django users
> How do I create a custom widget and what do I have to do to use my
> custom widget in a form?

It's possible I don't understand what you're trying to do, but I think
you just need to call the hook into the id of the textfield. If
multiple, set a class attribute in your form setup and hook onto that.

Brian Neal

unread,
Jan 23, 2009, 5:10:03 PM1/23/09
to Django users
On Jan 23, 2:43 pm, oboedude <oboed...@frontiernet.net> wrote:
[...]
> How do I create a custom widget and what do I have to do to use my
> custom widget in a form?

Read the documentation on forms, then checkout the section on form
media:

http://docs.djangoproject.com/en/dev/topics/forms/media/#topics-forms-media

I've integrated several jQuery plugins using both Widget and Form
media hooks that Django provides.

Best,
BN

oboedude

unread,
Jan 27, 2009, 1:48:47 PM1/27/09
to Django users
I had been looking through that documentation already, but it's
certainly possible I missed something. I'll give it another look.
Thanks for the help guys :)

On Jan 23, 5:10 pm, Brian Neal <bgn...@gmail.com> wrote:
> On Jan 23, 2:43 pm,oboedude<oboed...@frontiernet.net> wrote:
> [...]
>
> > How do I create a custom widget and what do I have to do to use my
> > custom widget in a form?
>
> Read the documentation on forms, then checkout the section on form
> media:
>
> http://docs.djangoproject.com/en/dev/topics/forms/media/#topics-forms...
Reply all
Reply to author
Forward
0 new messages