Changeset 6057


Ignore:
Timestamp:
12 May 2011, 01:46:03 (14 years ago)
Author:
uli
Message:

Add more docs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/widgets/datewidget.py

    r6056 r6057  
    7272
    7373#: A dictionary of supported date formats.
     74#:
     75#: The following formats are supported:
     76#:
     77#: ``iso``
     78#:    ISO format ``YYYY-MM-DD``
     79#: ``le``
     80#:    little endian with slashes: ``DD/MM/YYYY``
     81#: ``de``
     82#:    german date format: ``DD.MM.YYYY``
     83#: ``us``
     84#:    middle endian format common in the U.S.: ``MM/DD/YYYY``
     85#:
     86#: Furthermore we support for input widgets an additional year
     87#: marker. Input date widgets with this marker provide also a year
     88#: selector, handy for dates of birth etc.
     89#:
     90#: The year-supporting formats are similar to the basic versions above:
     91#:
     92#: ``iso-year``
     93#:    ISO format ``YYYY-MM-DD``
     94#: ``le-year``
     95#:    little endian with slashes: ``DD/MM/YYYY``
     96#: ``de-year``
     97#:    german date format: ``DD.MM.YYYY``
     98#: ``us-year``
     99#:    middle endian format common in the U.S.: ``MM/DD/YYYY``
     100#:   
     101#: For date display widgets there is naturally no difference between a
     102#: year and non-year setting (you can for instance use 'le' or 'le-year'
     103#: with the same output).
    74104DATE_FORMATS = {
    75     'iso': ('datepicker', '%Y-%m-%d'),
    76     'le':  ('datepicker-le', '%d/%m/%Y'),
    77     'de':  ('datepicker-de', '%d.%m.%Y'),
    78     'us':  ('datepicker-us', '%m/%d/%Y'),
    79     'iso-year': ('datepicker-year', '%Y-%m-%d'),
    80     'le-year':  ('datepicker-le-year', '%d/%m/%Y'),
    81     'de-year':  ('datepicker-de-year', '%d.%m.%Y'),
    82     'us-year':  ('datepicker-us-year', '%m/%d/%Y'),
     105    'iso': ('datepicker', '%y-%m-%d'),
     106    'le':  ('datepicker-le', '%d/%m/%y'),
     107    'de':  ('datepicker-de', '%d.%m.%y'),
     108    'us':  ('datepicker-us', '%m/%d/%y'),
     109    'iso-year': ('datepicker-year', '%y-%m-%d'),
     110    'le-year':  ('datepicker-le-year', '%d/%m/%y'),
     111    'de-year':  ('datepicker-de-year', '%d.%m.%y'),
     112    'us-year':  ('datepicker-us-year', '%m/%d/%y'),
    83113    }
    84114def FriendlyDateWidget(format):
    85115    """Get a friendly date input widget for `format`.
     116
     117    This widget is suitable for edit and add forms.
     118   
     119    Valid `format` values are the keys of :var:`DATE_FORMATS`
     120    dict. Default is ``le`` (little endian; DD/MM/YYYY).
     121
     122    Friendly date widgets are rendered with a specialized CSS tag for
     123    enabling JavaScript datepickers.
    86124    """
    87125    css_class, date_format = DATE_FORMATS.get(format, DATE_FORMATS['le'])
     
    93131def FriendlyDateDisplayWidget(format):
    94132    """Get a friendly date display widget for `format`.
     133
     134    This widget is suitable for display forms.
     135   
     136    Valid `format` values are the keys of :var:`DATE_FORMATS`
     137    dict. Default is ``le`` (little endian; DD/MM/YYYY).
     138
     139    Friendly date widgets are rendered with a specialized CSS tag for
     140    enabling JavaScript datepickers.
    95141    """
    96142    css_class, date_format = DATE_FORMATS.get(format, DATE_FORMATS['le'])
Note: See TracChangeset for help on using the changeset viewer.