@@ -39,7 +39,7 @@ Prerequisites
3939
4040Installing
4141^^^^^^^^^^
42- Install the widget via pip
42+ Install the PyPI package via pip
4343
4444::
4545
@@ -55,51 +55,46 @@ Add ``bootstrap_datepicker_plus`` to the list of ``INSTALLED_APPS`` in your ``se
5555 ]
5656
5757 This installation instruction assumes you have ``jQuery `` and Bootstrap JS/CSS files present in your template
58- and you are using ``form.media `` in your django template. If not you should checkout our
59- `configuration instructions <https://monim67.github.io/django-bootstrap-datepicker-plus/configure/ >`__
60- which covers almost everything you need to get the widget running.
58+ and you are using ``form.media `` in your django template. If not you have to configure your template.
59+
60+
61+ Next
62+ ^^^^^^^^^^
63+ - `Template configuration <https://monim67.github.io/django-bootstrap-datepicker-plus/configure/ >`__
64+ - `Documentation on ReadTheDocs <https://django-bootstrap-datepicker-plus.readthedocs.io/en/latest/ >`__
65+ - `Quick Walkthrough Tutorial <https://django-bootstrap-datepicker-plus.readthedocs.io/en/latest/Walkthrough.html >`__
66+ - `I am having errors <https://django-bootstrap-datepicker-plus.readthedocs.io/en/latest/Troubleshooting.html >`__
6167
6268
6369
6470Usage
6571-----
6672
6773
68- Custom Form usage
69- ^^^^^^^^^^^^^^^^^
74+ Usage in Generic View
75+ ^^^^^^^^^^^^^^^^^^^^^^
7076
7177.. code :: python
7278
73- # File: forms.py
74- from bootstrap_datepicker_plus import DatePickerInput
75- from django import forms
79+ # File: views.py
80+ from bootstrap_datepicker_plus import DateTimePickerInput
81+ from django.views import generic
82+ from .models import Question
7683
77- class ToDoForm ( forms . Form ):
78- todo = forms.CharField(
79- widget = forms.TextInput( attrs = { " class " : " form-control " })
80- )
81- date = forms.DateField(
82- widget = DatePickerInput( format = ' %m/ %d /%Y ' )
83- )
84+ class CreateView ( generic . edit . CreateView ):
85+ model = Question
86+ fields = [ ' question_text ' , ' pub_date ' ]
87+ def get_form ( self ):
88+ form = super ().get_form()
89+ form.fields[ ' pub_date ' ]. widget = DateTimePickerInput( )
90+ return form
8491
8592
86- Model Form usage
87- ^^^^^^^^^^^^^^^^
88-
89- .. code :: python
90-
91- # File: forms.py
92- from bootstrap_datepicker_plus import DatePickerInput
93- from django import forms
93+ Advanced Usage
94+ ^^^^^^^^^^^^^^^^^
9495
95- class EventForm (forms .ModelForm ):
96- class Meta :
97- model = Event
98- fields = [' name' , ' start_date' , ' end_date' ]
99- widgets = {
100- ' start_date' : DatePickerInput(), # default date-format %m/%d/%Y will be used
101- ' end_date' : DatePickerInput(format = ' %Y-%m-%d ' ), # specify date-frmat
102- }
96+ - `Usage in Custom Form <https://django-bootstrap-datepicker-plus.readthedocs.io/en/latest/Usage.html#custom-form-usage >`__
97+ - `Usage in Model Form <https://django-bootstrap-datepicker-plus.readthedocs.io/en/latest/Usage.html#model-form-usage >`__
10398
10499
105100Types of DatePickers
@@ -149,41 +144,11 @@ DatePickers can be linked to select a date-range or time-range.
149144 }
150145
151146
152- Customize the Options
153- ^^^^^^^^^^^^^^^^^^^^^
154-
155- The DatePicker can be customised by passing options to it.
156- The ``options `` will be passed to the JavaScript datepicker instance, and are documented and demonstrated in
157- `Bootstrap Datepicker Options Reference <http://eonasdan.github.io/bootstrap-datetimepicker/Options/ >`__.
158-
159- .. code :: python
160-
161- # File: forms.py
162- from bootstrap_datepicker_plus import DatePickerInput
163- from django import forms
164-
165- class EventForm (forms .ModelForm ):
166- class Meta :
167- model = Event
168- fields = [' name' , ' start_date' , ' end_date' ]
169- widgets = {
170- ' start_date' : DatePickerInput(format = ' %m/%d %Y' ), # python date-time format
171- ' end_date' : DatePickerInput(
172- options = {
173- " format" : " MM/DD/YYYY" , # moment date-time format
174- " showClose" : True ,
175- " showClear" : True ,
176- " showTodayButton" : True ,
177- }
178- ),
179- }
180-
181- **Note: ** You can specify the date-time format by passing a
182- `python date-time format <https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior >`__
183- as format parameter (see start_date in the example), or by passing a
184- `moment date-time format <http://momentjs.com/docs/#/displaying/format/ >`__
185- as an option (see end_date in the example).
186- If both are specified then the moment format in options will take precedence.
147+ Customization
148+ ^^^^^^^^^^^^^^
149+ - `Datepicker Options <https://django-bootstrap-datepicker-plus.readthedocs.io/en/latest/Usage.html#customize-datepicker-options >`__
150+ - `Input field HTML template <https://django-bootstrap-datepicker-plus.readthedocs.io/en/latest/Template_Customizing.html >`__
151+ - `Language <https://django-bootstrap-datepicker-plus.readthedocs.io/en/latest/Usage.html#customize-the-language >`__
187152
188153
189154Contributing
0 commit comments