<s> """<STR_LIT>""" <EOL> try : <EOL> set <EOL> except NameError : <EOL> from sets import Set as set <EOL> import copy <EOL> from itertools import chain <EOL> from django . conf import settings <EOL> from django . utils . datastructures import MultiValueDict , MergeDict <EOL> from django . utils . html import escape , conditional_escape <EOL> from django . utils . translation import ugettext <EOL> from django . utils . encoding import StrAndUnicode , force_unicode <EOL> from django . utils . safestring import mark_safe <EOL> from django . utils import datetime_safe <EOL> from datetime import time <EOL> from util import flatatt <EOL> from urlparse import urljoin <EOL> __all__ = ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> MEDIA_TYPES = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> class Media ( StrAndUnicode ) : <EOL> def __init__ ( self , media = None , ** kwargs ) : <EOL> if media : <EOL> media_attrs = media . __dict__ <EOL> else : <EOL> media_attrs = kwargs <EOL> self . _css = { } <EOL> self . _js = [ ] <EOL> for name in MEDIA_TYPES : <EOL> getattr ( self , '<STR_LIT>' + name ) ( media_attrs . get ( name , None ) ) <EOL> def __unicode__ ( self ) : <EOL> return self . render ( ) <EOL> def render ( self ) : <EOL> return mark_safe ( u'<STR_LIT:\n>' . join ( chain ( * [ getattr ( self , '<STR_LIT>' + name ) ( ) for name in MEDIA_TYPES ] ) ) ) <EOL> def render_js ( self ) : <EOL> return [ u'<STR_LIT>' % self . absolute_path ( path ) for path in self . _js ] <EOL> def render_css ( self ) : <EOL> media = self . _css . keys ( ) <EOL> media . sort ( ) <EOL> return chain ( * [ <EOL> [ u'<STR_LIT>' % ( self . absolute_path ( path ) , medium ) <EOL> for path in self . _css [ medium ] ] <EOL> for medium in media ] ) <EOL> def absolute_path ( self , path ) : <EOL> if path . startswith ( u'<STR_LIT>' ) or path . startswith ( u'<STR_LIT>' ) or path . startswith ( u'<STR_LIT:/>' ) : <EOL> return path <EOL> return urljoin ( settings . MEDIA_URL , path ) <EOL> def __getitem__ ( self , name ) : <EOL> "<STR_LIT>" <EOL> if name in MEDIA_TYPES : <EOL> return Media ( ** { name : getattr ( self , '<STR_LIT:_>' + name ) } ) <EOL> raise KeyError ( '<STR_LIT>' % name ) <EOL> def add_js ( self , data ) : <EOL> if data : <EOL> self . _js . extend ( [ path for path in data if path not in self . _js ] ) <EOL> def add_css ( self , data ) : <EOL> if data : <EOL> for medium , paths in data . items ( ) : <EOL> self . _css . setdefault ( medium , [ ] ) . extend ( [ path for path in paths if path not in self . _css [ medium ] ] ) <EOL> def __add__ ( self , other ) : <EOL> combined = Media ( ) <EOL> for name in MEDIA_TYPES : <EOL> getattr ( combined , '<STR_LIT>' + name ) ( getattr ( self , '<STR_LIT:_>' + name , None ) ) <EOL> getattr ( combined , '<STR_LIT>' + name ) ( getattr ( other , '<STR_LIT:_>' + name , None ) ) <EOL> return combined <EOL> def media_property ( cls ) : <EOL> def _media ( self ) : <EOL> if hasattr ( super ( cls , self ) , '<STR_LIT>' ) : <EOL> base = super ( cls , self ) . media <EOL> else : <EOL> base = Media ( ) <EOL> definition = getattr ( cls , '<STR_LIT>' , None ) <EOL> if definition : <EOL> extend = getattr ( definition , '<STR_LIT>' , True ) <EOL> if extend : <EOL> if extend == True : <EOL> m = base <EOL> else : <EOL> m = Media ( ) <EOL> for medium in extend : <EOL> m = m + base [ medium ] <EOL> return m + Media ( definition ) <EOL> else : <EOL> return Media ( definition ) <EOL> else : <EOL> return base <EOL> return property ( _media ) <EOL> class MediaDefiningClass ( type ) : <EOL> "<STR_LIT>" <EOL> def __new__ ( cls , name , bases , attrs ) : <EOL> new_class = super ( MediaDefiningClass , cls ) . __new__ ( cls , name , bases , <EOL> attrs ) <EOL> if '<STR_LIT>' not in attrs : <EOL> new_class . media = media_property ( new_class ) <EOL> return new_class <EOL> class Widget ( object ) : <EOL> __metaclass__ = MediaDefiningClass <EOL> is_hidden = False <EOL> needs_multipart_form = False <EOL> def __init__ ( self , attrs = None ) : <EOL> if attrs is not None : <EOL> self . attrs = attrs . copy ( ) <EOL> else : <EOL> self . attrs = { } <EOL> def __deepcopy__ ( self , memo ) : <EOL> obj = copy . copy ( self ) <EOL> obj . attrs = self . attrs . copy ( ) <EOL> memo [ id ( self ) ] = obj <EOL> return obj <EOL> def render ( self , name , value , attrs = None ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError <EOL> def build_attrs ( self , extra_attrs = None , ** kwargs ) : <EOL> "<STR_LIT>" <EOL> attrs = dict ( self . attrs , ** kwargs ) <EOL> if extra_attrs : <EOL> attrs . update ( extra_attrs ) <EOL> return attrs <EOL> def value_from_datadict ( self , data , files , name ) : <EOL> """<STR_LIT>""" <EOL> return data . get ( name , None ) <EOL> def _has_changed ( self , initial , data ) : <EOL> """<STR_LIT>""" <EOL> if data is None : <EOL> data_value = u'<STR_LIT>' <EOL> else : <EOL> data_value = data <EOL> if initial is None : <EOL> initial_value = u'<STR_LIT>' <EOL> else : <EOL> initial_value = initial <EOL> if force_unicode ( initial_value ) != force_unicode ( data_value ) : <EOL> return True <EOL> return False <EOL> def id_for_label ( self , id_ ) : <EOL> """<STR_LIT>""" <EOL> return id_ <EOL> id_for_label = classmethod ( id_for_label ) <EOL> class Input ( Widget ) : <EOL> """<STR_LIT>""" <EOL> input_type = None <EOL> def render ( self , name , value , attrs = None ) : <EOL> if value is None : value = '<STR_LIT>' <EOL> final_attrs = self . build_attrs ( attrs , type = self . input_type , name = name ) <EOL> if value != '<STR_LIT>' : <EOL> final_attrs [ '<STR_LIT:value>' ] = force_unicode ( value ) <EOL> return mark_safe ( u'<STR_LIT>' % flatatt ( final_attrs ) ) <EOL> class TextInput ( Input ) : <EOL> input_type = '<STR_LIT:text>' <EOL> class PasswordInput ( Input ) : <EOL> input_type = '<STR_LIT:password>' <EOL> def __init__ ( self , attrs = None , render_value = True ) : <EOL> super ( PasswordInput , self ) . __init__ ( attrs ) <EOL> self . render_value = render_value <EOL> def render ( self , name , value , attrs = None ) : <EOL> if not self . render_value : value = None <EOL> return super ( PasswordInput , self ) . render ( name , value , attrs ) <EOL> class HiddenInput ( Input ) : <EOL> input_type = '<STR_LIT>' <EOL> is_hidden = True <EOL> class MultipleHiddenInput ( HiddenInput ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , attrs = None , choices = ( ) ) : <EOL> super ( MultipleHiddenInput , self ) . __init__ ( attrs ) <EOL> self . choices = choices <EOL> def render ( self , name , value , attrs = None , choices = ( ) ) : <EOL> if value is None : value = [ ] <EOL> final_attrs = self . build_attrs ( attrs , type = self . input_type , name = name ) <EOL> return mark_safe ( u'<STR_LIT:\n>' . join ( [ ( u'<STR_LIT>' % <EOL> flatatt ( dict ( value = force_unicode ( v ) , ** final_attrs ) ) ) <EOL> for v in value ] ) ) <EOL> def value_from_datadict ( self , data , files , name ) : <EOL> if isinstance ( data , ( MultiValueDict , MergeDict ) ) : <EOL> return data . getlist ( name ) <EOL> return data . get ( name , None ) <EOL> class FileInput ( Input ) : <EOL> input_type = '<STR_LIT:file>' <EOL> needs_multipart_form = True <EOL> def render ( self , name , value , attrs = None ) : <EOL> return super ( FileInput , self ) . render ( name , None , attrs = attrs ) <EOL> def value_from_datadict ( self , data , files , name ) : <EOL> "<STR_LIT>" <EOL> return files . get ( name , None ) <EOL> def _has_changed ( self , initial , data ) : <EOL> if data is None : <EOL> return False <EOL> return True <EOL> class Textarea ( Widget ) : <EOL> def __init__ ( self , attrs = None ) : <EOL> self . attrs = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> if attrs : <EOL> self . attrs . update ( attrs ) <EOL> def render ( self , name , value , attrs = None ) : <EOL> if value is None : value = '<STR_LIT>' <EOL> final_attrs = self . build_attrs ( attrs , name = name ) <EOL> return mark_safe ( u'<STR_LIT>' % ( flatatt ( final_attrs ) , <EOL> conditional_escape ( force_unicode ( value ) ) ) ) <EOL> class DateTimeInput ( Input ) : <EOL> input_type = '<STR_LIT:text>' <EOL> format = '<STR_LIT>' <EOL> def __init__ ( self , attrs = None , format = None ) : <EOL> super ( DateTimeInput , self ) . __init__ ( attrs ) <EOL> if format : <EOL> self . format = format <EOL> def render ( self , name , value , attrs = None ) : <EOL> if value is None : <EOL> value = '<STR_LIT>' <EOL> elif hasattr ( value , '<STR_LIT>' ) : <EOL> value = datetime_safe . new_datetime ( value ) <EOL> value = value . strftime ( self . format ) <EOL> return super ( DateTimeInput , self ) . render ( name , value , attrs ) <EOL> class TimeInput ( Input ) : <EOL> input_type = '<STR_LIT:text>' <EOL> def render ( self , name , value , attrs = None ) : <EOL> if value is None : <EOL> value = '<STR_LIT>' <EOL> elif isinstance ( value , time ) : <EOL> value = value . replace ( microsecond = <NUM_LIT:0> ) <EOL> return super ( TimeInput , self ) . render ( name , value , attrs ) <EOL> class CheckboxInput ( Widget ) : <EOL> def __init__ ( self , attrs = None , check_test = bool ) : <EOL> super ( CheckboxInput , self ) . __init__ ( attrs ) <EOL> self . check_test = check_test <EOL> def render ( self , name , value , attrs = None ) : <EOL> final_attrs = self . build_attrs ( attrs , type = '<STR_LIT>' , name = name ) <EOL> try : <EOL> result = self . check_test ( value ) <EOL> except : <EOL> result = False <EOL> if result : <EOL> final_attrs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if value not in ( '<STR_LIT>' , True , False , None ) : <EOL> final_attrs [ '<STR_LIT:value>' ] = force_unicode ( value ) <EOL> return mark_safe ( u'<STR_LIT>' % flatatt ( final_attrs ) ) <EOL> def value_from_datadict ( self , data , files , name ) : <EOL> if name not in data : <EOL> return False <EOL> return super ( CheckboxInput , self ) . value_from_datadict ( data , files , name ) <EOL> def _has_changed ( self , initial , data ) : <EOL> return bool ( initial ) != bool ( data ) <EOL> class Select ( Widget ) : <EOL> def __init__ ( self , attrs = None , choices = ( ) ) : <EOL> super ( Select , self ) . __init__ ( attrs ) <EOL> self . choices = list ( choices ) <EOL> def render ( self , name , value , attrs = None , choices = ( ) ) : <EOL> if value is None : value = '<STR_LIT>' <EOL> final_attrs = self . build_attrs ( attrs , name = name ) <EOL> output = [ u'<STR_LIT>' % flatatt ( final_attrs ) ] <EOL> options = self . render_options ( choices , [ value ] ) <EOL> if options : <EOL> output . append ( options ) <EOL> output . append ( '<STR_LIT>' ) <EOL> return mark_safe ( u'<STR_LIT:\n>' . join ( output ) ) <EOL> def render_options ( self , choices , selected_choices ) : <EOL> def render_option ( option_value , option_label ) : <EOL> option_value = force_unicode ( option_value ) <EOL> selected_html = ( option_value in selected_choices ) and u'<STR_LIT>' or '<STR_LIT>' <EOL> return u'<STR_LIT>' % ( <EOL> escape ( option_value ) , selected_html , <EOL> conditional_escape ( force_unicode ( option_label ) ) ) <EOL> selected_choices = set ( [ force_unicode ( v ) for v in selected_choices ] ) <EOL> output = [ ] <EOL> for option_value , option_label in chain ( self . choices , choices ) : <EOL> if isinstance ( option_label , ( list , tuple ) ) : <EOL> output . append ( u'<STR_LIT>' % escape ( force_unicode ( option_value ) ) ) <EOL> for option in option_label : <EOL> output . append ( render_option ( * option ) ) <EOL> output . append ( u'<STR_LIT>' ) <EOL> else : <EOL> output . append ( render_option ( option_value , option_label ) ) <EOL> return u'<STR_LIT:\n>' . join ( output ) <EOL> class NullBooleanSelect ( Select ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , attrs = None ) : <EOL> choices = ( ( u'<STR_LIT:1>' , ugettext ( '<STR_LIT>' ) ) , ( u'<STR_LIT:2>' , ugettext ( '<STR_LIT>' ) ) , ( u'<STR_LIT:3>' , ugettext ( '<STR_LIT>' ) ) ) <EOL> super ( NullBooleanSelect , self ) . __init__ ( attrs , choices ) <EOL> def render ( self , name , value , attrs = None , choices = ( ) ) : <EOL> try : <EOL> value = { True : u'<STR_LIT:2>' , False : u'<STR_LIT:3>' , u'<STR_LIT:2>' : u'<STR_LIT:2>' , u'<STR_LIT:3>' : u'<STR_LIT:3>' } [ value ] <EOL> except KeyError : <EOL> value = u'<STR_LIT:1>' <EOL> return super ( NullBooleanSelect , self ) . render ( name , value , attrs , choices ) <EOL> def value_from_datadict ( self , data , files , name ) : <EOL> value = data . get ( name , None ) <EOL> return { u'<STR_LIT:2>' : True , u'<STR_LIT:3>' : False , True : True , False : False } . get ( value , None ) <EOL> def _has_changed ( self , initial , data ) : <EOL> return bool ( initial ) != bool ( data ) <EOL> class SelectMultiple ( Select ) : <EOL> def render ( self , name , value , attrs = None , choices = ( ) ) : <EOL> if value is None : value = [ ] <EOL> final_attrs = self . build_attrs ( attrs , name = name ) <EOL> output = [ u'<STR_LIT>' % flatatt ( final_attrs ) ] <EOL> options = self . render_options ( choices , value ) <EOL> if options : <EOL> output . append ( options ) <EOL> output . append ( '<STR_LIT>' ) <EOL> return mark_safe ( u'<STR_LIT:\n>' . join ( output ) ) <EOL> def value_from_datadict ( self , data , files , name ) : <EOL> if isinstance ( data , ( MultiValueDict , MergeDict ) ) : <EOL> return data . getlist ( name ) <EOL> return data . get ( name , None ) <EOL> def _has_changed ( self , initial , data ) : <EOL> if initial is None : <EOL> initial = [ ] <EOL> if data is None : <EOL> data = [ ] <EOL> if len ( initial ) != len ( data ) : <EOL> return True <EOL> for value1 , value2 in zip ( initial , data ) : <EOL> if force_unicode ( value1 ) != force_unicode ( value2 ) : <EOL> return True <EOL> return False <EOL> class RadioInput ( StrAndUnicode ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , name , value , attrs , choice , index ) : <EOL> self . name , self . value = name , value <EOL> self . attrs = attrs <EOL> self . choice_value = force_unicode ( choice [ <NUM_LIT:0> ] ) <EOL> self . choice_label = force_unicode ( choice [ <NUM_LIT:1> ] ) <EOL> self . index = index <EOL> def __unicode__ ( self ) : <EOL> if '<STR_LIT:id>' in self . attrs : <EOL> label_for = '<STR_LIT>' % ( self . attrs [ '<STR_LIT:id>' ] , self . index ) <EOL> else : <EOL> label_for = '<STR_LIT>' <EOL> choice_label = conditional_escape ( force_unicode ( self . choice_label ) ) <EOL> return mark_safe ( u'<STR_LIT>' % ( label_for , self . tag ( ) , choice_label ) ) <EOL> def is_checked ( self ) : <EOL> return self . value == self . choice_value <EOL> def tag ( self ) : <EOL> if '<STR_LIT:id>' in self . attrs : <EOL> self . attrs [ '<STR_LIT:id>' ] = '<STR_LIT>' % ( self . attrs [ '<STR_LIT:id>' ] , self . index ) <EOL> final_attrs = dict ( self . attrs , type = '<STR_LIT>' , name = self . name , value = self . choice_value ) <EOL> if self . is_checked ( ) : <EOL> final_attrs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return mark_safe ( u'<STR_LIT>' % flatatt ( final_attrs ) ) <EOL> class RadioFieldRenderer ( StrAndUnicode ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , name , value , attrs , choices ) : <EOL> self . name , self . value , self . attrs = name , value , attrs <EOL> self . choices = choices <EOL> def __iter__ ( self ) : <EOL> for i , choice in enumerate ( self . choices ) : <EOL> yield RadioInput ( self . name , self . value , self . attrs . copy ( ) , choice , i ) <EOL> def __getitem__ ( self , idx ) : <EOL> choice = self . choices [ idx ] <EOL> return RadioInput ( self . name , self . value , self . attrs . copy ( ) , choice , idx ) <EOL> def __unicode__ ( self ) : <EOL> return self . render ( ) <EOL> def render ( self ) : <EOL> """<STR_LIT>""" <EOL> return mark_safe ( u'<STR_LIT>' % u'<STR_LIT:\n>' . join ( [ u'<STR_LIT>' <EOL> % force_unicode ( w ) for w in self ] ) ) <EOL> class RadioSelect ( Select ) : <EOL> renderer = RadioFieldRenderer <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> renderer = kwargs . pop ( '<STR_LIT>' , None ) <EOL> if renderer : <EOL> self . renderer = renderer <EOL> super ( RadioSelect , self ) . __init__ ( * args , ** kwargs ) <EOL> def get_renderer ( self , name , value , attrs = None , choices = ( ) ) : <EOL> """<STR_LIT>""" <EOL> if value is None : value = '<STR_LIT>' <EOL> str_value = force_unicode ( value ) <EOL> final_attrs = self . build_attrs ( attrs ) <EOL> choices = list ( chain ( self . choices , choices ) ) <EOL> return self . renderer ( name , str_value , final_attrs , choices ) <EOL> def render ( self , name , value , attrs = None , choices = ( ) ) : <EOL> return self . get_renderer ( name , value , attrs , choices ) . render ( ) <EOL> def id_for_label ( self , id_ ) : <EOL> if id_ : <EOL> id_ += '<STR_LIT>' <EOL> return id_ <EOL> id_for_label = classmethod ( id_for_label ) <EOL> class CheckboxSelectMultiple ( SelectMultiple ) : <EOL> def render ( self , name , value , attrs = None , choices = ( ) ) : <EOL> if value is None : value = [ ] <EOL> has_id = attrs and '<STR_LIT:id>' in attrs <EOL> final_attrs = self . build_attrs ( attrs , name = name ) <EOL> output = [ u'<STR_LIT>' ] <EOL> str_values = set ( [ force_unicode ( v ) for v in value ] ) <EOL> for i , ( option_value , option_label ) in enumerate ( chain ( self . choices , choices ) ) : <EOL> if has_id : <EOL> final_attrs = dict ( final_attrs , id = '<STR_LIT>' % ( attrs [ '<STR_LIT:id>' ] , i ) ) <EOL> label_for = u'<STR_LIT>' % final_attrs [ '<STR_LIT:id>' ] <EOL> else : <EOL> label_for = '<STR_LIT>' <EOL> cb = CheckboxInput ( final_attrs , check_test = lambda value : value in str_values ) <EOL> option_value = force_unicode ( option_value ) <EOL> rendered_cb = cb . render ( name , option_value ) <EOL> option_label = conditional_escape ( force_unicode ( option_label ) ) <EOL> output . append ( u'<STR_LIT>' % ( label_for , rendered_cb , option_label ) ) <EOL> output . append ( u'<STR_LIT>' ) <EOL> return mark_safe ( u'<STR_LIT:\n>' . join ( output ) ) <EOL> def id_for_label ( self , id_ ) : <EOL> if id_ : <EOL> id_ += '<STR_LIT>' <EOL> return id_ <EOL> id_for_label = classmethod ( id_for_label ) <EOL> class MultiWidget ( Widget ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , widgets , attrs = None ) : <EOL> self . widgets = [ isinstance ( w , type ) and w ( ) or w for w in widgets ] <EOL> super ( MultiWidget , self ) . __init__ ( attrs ) <EOL> def render ( self , name , value , attrs = None ) : <EOL> if not isinstance ( value , list ) : <EOL> value = self . decompress ( value ) <EOL> output = [ ] <EOL> final_attrs = self . build_attrs ( attrs ) <EOL> id_ = final_attrs . get ( '<STR_LIT:id>' , None ) <EOL> for i , widget in enumerate ( self . widgets ) : <EOL> try : <EOL> widget_value = value [ i ] <EOL> except IndexError : <EOL> widget_value = None <EOL> if id_ : <EOL> final_attrs = dict ( final_attrs , id = '<STR_LIT>' % ( id_ , i ) ) <EOL> output . append ( widget . render ( name + '<STR_LIT>' % i , widget_value , final_attrs ) ) <EOL> return mark_safe ( self . format_output ( output ) ) <EOL> def id_for_label ( self , id_ ) : <EOL> if id_ : <EOL> id_ += '<STR_LIT>' <EOL> return id_ <EOL> id_for_label = classmethod ( id_for_label ) <EOL> def value_from_datadict ( self , data , files , name ) : <EOL> return [ widget . value_from_datadict ( data , files , name + '<STR_LIT>' % i ) for i , widget in enumerate ( self . widgets ) ] <EOL> def _has_changed ( self , initial , data ) : <EOL> if initial is None : <EOL> initial = [ u'<STR_LIT>' for x in range ( <NUM_LIT:0> , len ( data ) ) ] <EOL> else : <EOL> if not isinstance ( initial , list ) : <EOL> initial = self . decompress ( initial ) <EOL> for widget , initial , data in zip ( self . widgets , initial , data ) : <EOL> if widget . _has_changed ( initial , data ) : <EOL> return True <EOL> return False <EOL> def format_output ( self , rendered_widgets ) : <EOL> """<STR_LIT>""" <EOL> return u'<STR_LIT>' . join ( rendered_widgets ) <EOL> def decompress ( self , value ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( '<STR_LIT>' ) <EOL> def _get_media ( self ) : <EOL> "<STR_LIT>" <EOL> media = Media ( ) <EOL> for w in self . widgets : <EOL> media = media + w . media <EOL> return media <EOL> media = property ( _get_media ) <EOL> class SplitDateTimeWidget ( MultiWidget ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , attrs = None ) : <EOL> widgets = ( TextInput ( attrs = attrs ) , TextInput ( attrs = attrs ) ) <EOL> super ( SplitDateTimeWidget , self ) . __init__ ( widgets , attrs ) <EOL> def decompress ( self , value ) : <EOL> if value : <EOL> return [ value . date ( ) , value . time ( ) . replace ( microsecond = <NUM_LIT:0> ) ] <EOL> return [ None , None ] <EOL> class SplitHiddenDateTimeWidget ( SplitDateTimeWidget ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , attrs = None ) : <EOL> widgets = ( HiddenInput ( attrs = attrs ) , HiddenInput ( attrs = attrs ) ) <EOL> super ( SplitDateTimeWidget , self ) . __init__ ( widgets , attrs ) </s>
