title: Create Date Range Slider in Django Form
body: <p>I am facing some implementation issue in Django. My app reads data from excel uploaded by the user. It extracts dates from it such as earliest date and recent date. I am able to show these two date extracts in html form and let users custom select the time range. (thru' django forms.py). To make a better user experience, I want to create a date range slider in the form that will allow the users. So far, I am able to find a Django package called django_range_slider. (<a href="https://github.com/shaklev/django_range_slider/tree/master/test_slider" rel="nofollow noreferrer">https://github.com/shaklev/django_range_slider/tree/master/test_slider</a>) I can also implement this packages features correctly as long as I have an integer values for the range. The moment I put date values on, it does not work very well. </p>
  
  <p>Here is <strong>forms.py</strong>:</p>
  
  <pre><code>from django import forms
  from .fields import RangeSliderField
  from .models import TestModel
  from django.forms.widgets import SelectDateWidget
  class TestFieldForm(forms.Form):
  
  class Meta:
      model = TestModel
      fields = ['range_field','name_range_field','label_range_field']
  
  def __init__(self, *args, **kwargs):
      super(TestFieldForm, self).__init__(*args, **kwargs)
      self.fields['name_range_field'] = RangeSliderField(minimum=30,maximum=300,name="TestName")
      self.fields['range_field'] = RangeSliderField(minimum=10,step=10,maximum=102)
      self.fields['label_range_field'] = RangeSliderField(label=True,minimum=1,maximum=100)
  
  class fcPForm(forms.Form):
  
  label_range_field = RangeSliderField(label="Date Range",minimum="",maximum="") # with label (no name)
  </code></pre>
  
  <p>Here is <strong>models.py</strong>:</p>
  
  <pre><code>from __future__ import unicode_literals
  
  from django.db import models
  class TestModel(models.Model):
      #range_field = models.CharField(max_length=200)
      #name_range_field = models.CharField(max_length=200)
      label_field = models.DateField()
  </code></pre>
  
  <p>Here is <strong>views.py</strong>:</p>
  
  <pre><code>from .models import actuals,forecast,TestModel
  
  def analyze(request):
      if request.method == 'POST':
      form = InputForm(request.POST,request.FILES)
      dataType = request.POST.get("DataType")
      request.session['dataType']=dataType
      if form.is_valid():
          sheet = request.FILES['FileLocation'].get_sheet()
          book = request.FILES['FileLocation'].get_book()
          #do calculation to find out eDate,lDate
          fcForm = fcPForm(initial = {'label_range_field':(eDate,lDate)})
  
          if fcForm.is_valid():
              cdFC = fcForm.cleaned_data
  
          return render(request,'abc.html',{'earliestDt':earliestDate,'latestDt':latestDate,'form':fcForm,context)
  </code></pre>
  
  <p>Here is fields.py:</p>
  
  <pre><code>from django import forms
  from .widgets import RangeSlider
  
  class RangeSliderField(forms.CharField):
      def __init__(self, *args, **kwargs):
          self.name = kwargs.pop('name', '')
          self.minimum = kwargs.pop('minimum',0)
          self.maximum = kwargs.pop('maximum',100)
          self.step = kwargs.pop('step',1)
          kwargs['widget'] = RangeSlider(self.minimum, self.maximum, self.step, self.name) 
          if 'label' not in kwargs.keys():
              kwargs['label'] = False
          super(RangeSliderField, self).__init__(*args, **kwargs)
  </code></pre>
  
  <p>Here is abc.html:</p>
  
  <pre><code>   &lt;form action="{% url 'DjangoApp:xyz'%}" method="post" enctype="multipart/form-data"&gt;{% csrf_token %}
                              &lt;table&gt;
                                  {{ form }}
                              &lt;/table&gt;
                              {% csrf_token %}
                              &lt;input type="submit" value="Submit Data"&gt;
                          &lt;/form&gt;         
  </code></pre>
  
  <p>If I pass regular integer values to the form, range slide shows up and I am able to interact with it. When date values are passed as it shows up in the text box, but the slider disappears. Open to other suggestions/different way of doing things.</p>