Changeset 8150 for main/waeup.kofa/trunk/src/waeup/kofa/widgets
- Timestamp:
- 13 Apr 2012, 21:44:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/widgets/datewidget.py
r8147 r8150 92 92 self.date_format = getattr(context, 'date_format', self.date_format) 93 93 self.show_year = getattr(context, 'show_year', self.show_year) 94 self.cssClass = FORMATS_BY_VALUE.get(( 95 self.date_format, self.show_year), self.cssClass) 94 # add css class determined by date_format and show_year 95 css_cls = FORMATS_BY_VALUE.get((self.date_format, self.show_year), '') 96 self.cssClass = ' '.join([self.cssClass, css_cls]).strip() 96 97 return super(FormattedDateWidget, self).__init__( 97 98 context, request, *args, **kw) … … 122 123 return value 123 124 125 124 126 class FormattedDateDisplayWidget(DateDisplayWidget): 125 127 """A date widget that supports different (and _explicit_) date formats. … … 128 130 """ 129 131 date_format = '%Y-%m-%d' 132 show_year = False 133 130 134 implements(IDisplayWidget) 135 136 def __init__(self, context, request, *args, **kw): 137 # try to grab date_format and show_year from bound schema field. 138 self.date_format = getattr(context, 'date_format', self.date_format) 139 self.show_year = getattr(context, 'show_year', self.show_year) 140 return super(FormattedDateDisplayWidget, self).__init__( 141 context, request, *args, **kw) 131 142 132 143 def __call__(self):
Note: See TracChangeset for help on using the changeset viewer.