Projet

Général

Profil

0001-general-remove-unused-DateWidget-27971.patch

Frédéric Péters, 13 novembre 2018 21:44

Télécharger (2,23 ko)

Voir les différences:

Subject: [PATCH 1/2] general: remove unused DateWidget (#27971)

 chrono/manager/widgets.py | 24 +-----------------------
 tests/test_misc.py        |  3 +--
 2 files changed, 2 insertions(+), 25 deletions(-)
chrono/manager/widgets.py
11 11
import re
12 12
import uuid
13 13

  
14
from django.forms.widgets import DateTimeInput, DateInput, TimeInput, SelectMultiple
14
from django.forms.widgets import DateTimeInput, TimeInput, SelectMultiple
15 15
from django.utils.formats import get_language
16 16
from django.utils.safestring import mark_safe
17 17

  
......
130 130
        super(DateTimeWidget, self).__init__(attrs, options, usel10n)
131 131

  
132 132

  
133
class DateWidget(PickerWidgetMixin, DateInput):
134
    """
135
    DateWidget is the corresponding widget for Date field, it renders only the date section of
136
    datetime picker.
137
    """
138

  
139
    format_name = 'DATE_INPUT_FORMATS'
140
    glyphicon = 'glyphicon-calendar'
141

  
142
    def __init__(self, attrs=None, options=None, usel10n=None):
143

  
144
        if options is None:
145
            options = {}
146

  
147
        # Set the default options to show only the datepicker object
148
        options['startView'] = options.get('startView', 2)
149
        options['minView'] = options.get('minView', 2)
150
        options['format'] = options.get('format', 'dd/mm/yyyy')
151

  
152
        super(DateWidget, self).__init__(attrs, options, usel10n)
153

  
154

  
155 133
class TimeWidget(PickerWidgetMixin, TimeInput):
156 134
    """
157 135
    TimeWidget is the corresponding widget for Time field, it renders only the time section of
tests/test_misc.py
1
from chrono.manager.widgets import DateTimeWidget, DateWidget, TimeWidget
1
from chrono.manager.widgets import DateTimeWidget, TimeWidget
2 2

  
3 3
def test_widgets_init():
4 4
    DateTimeWidget()
5
    DateWidget()
6 5
    TimeWidget()
7
-