Project

General

Profile

Revision f743f760

IDf743f76079ef3c0495bcb34883826e98b36cf952
Parent 16397482
Child c56fed5a

Added by Vincent QUEMENER over 14 years ago

Ajout d'un attribut permettant de modifier la date affichée par défaut dans le formulaire de recherche.

git-svn-id: https://vigilo-dev.si.c-s.fr/svn@1598 b22e2e97-25c9-44ff-b637-2e5ceca36478

View differences:

vigiboard/widgets/search_form.py
7 7
from tw.api import WidgetsList
8 8
from tg import url
9 9

  
10
from datetime import datetime
11

  
10 12
__all__ = ('SearchForm', )
11 13

  
12 14
class SearchForm(TableForm):
......
28 30
        TextField('trouble_ticket', label_text=l_('Trouble Ticket'))
29 31
    ]
30 32
    
31
    def __init__(self,  id, lang, date_format, *args, **kwargs):
33
    def __init__(self,  id, lang, date_format='%Y-%m-%d %I:%M:%S %P', 
34
                 start_date=datetime.now().strftime('%Y-%m-%d %I:%M:%S %P'), 
35
                 end_date=datetime.now().strftime('%Y-%m-%d %I:%M:%S %P'), 
36
                 *args, **kwargs):
32 37
        super(SearchForm, self).__init__(id, *args, **kwargs)
33 38

  
34 39
        self.children.append(CalendarDateTimePicker('from_date', 
......
36 41
                                button_text = l_("Choose"),
37 42
                                date_format = date_format, 
38 43
                                not_empty = False,
44
                                attrs = {'value': start_date,},
39 45
                                calendar_lang=lang))
40 46
        
41 47
        self.children.append(CalendarDateTimePicker('to_date', 
42 48
                                label_text=l_('To:'),
43 49
                                button_text = l_("Choose"),
44 50
                                date_format = date_format, 
51
                                attrs = {'value': end_date,},
45 52
                                not_empty = False,
46 53
                                calendar_lang=lang))
47 54

  
48
        self.children.append(SubmitButton(value=l_('Search')))
55
        self.children.append(SubmitButton('search', value=l_('Search')))
49 56

  

Also available in: Unified diff