drs
django_range_slider
pypi i django_range_slider
drs

django_range_slider

A range-slider field for django , using jquery-ui

by Alex

0.2.4 (see all)Categories:Django Range Slider
pypi i django_range_slider
Readme

DJANGO RANGE SLIDER

Build Status

A range-slider field that uses django's forms.CharField() and jquery-ui to stylize and create the field.

Installation

  • Install the package using pip (or easy_install if you really have to)
$ pip install django_range_slider

Usage

An example app is avilable at example app.

Since we use jquery and jquery-ui for the widget , you need to include them in your main template (or the template where the widget will be rendered)

# templates/base.html

# You should include jquery , jquery-ui.js & jquery-ui.css
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link href="http://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css" rel="stylesheet">
<script src="http://code.jquery.com/ui/1.12.0/jquery-ui.min.js" ></script>
</head>

Add the form field to your form , with or without the optional keyword-arguments.

  • label=False is set as default value for the input field
# forms.py
from django import forms
from django_range_slider.fields import RangeSliderField

class SliderForm(forms.Form):
     name_range_field = RangeSliderField(minimum=30,maximum=300,name="TestName") # with name inside the input field (no label)
     range_field = RangeSliderField(minimum=10,maximum=102) # without name or label
     label_range_field = RangeSliderField(label="TestLabel",minimum=1,maximum=10) # with label (no name)

Example fields

  • Range-slider field with name(as argument):
name_range_field = RangeSliderField(minimum=30,maximum=300,name="TestName") # with name inside the input field (no label)

field with name

  • Range-slider field without name or label , with step:
     range_field = RangeSliderField(minimum=10,maximum=102,step=2) # without name or label

field without name or label

  • Range-slider field with label:
     label_range_field = RangeSliderField(label="TestLabel",minimum=1,maximum=10) # with label (no name)

field with label

License

MIT License

Copyright (c) 2019 Aleksandar Shaklev

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

GitHub Stars

13

LAST COMMIT

3yrs ago

MAINTAINERS

1

CONTRIBUTORS

4

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
0.2.4
3yrs ago
0.1
6yrs ago
No tutorials found
Add a tutorial