def deserialize_instance(model, data={}):
 ret = model()
 for (k, v) in data.items():
  if (v is not None):
   try:
    f = model._meta.get_field(k)
    if isinstance(f, DateTimeField):
     v = dateparse.parse_datetime(v)
    elif isinstance(f, TimeField):
     v = dateparse.parse_time(v)
    elif isinstance(f, DateField):
     v = dateparse.parse_date(v)
   except FieldDoesNotExist:
    pass
  setattr(ret, k, v)
 return ret

def deserialize_instance ( model , data = { } ) : ret = model ( ) for ( k , v ) in data . items ( ) : if ( v is not None ) : try : f = model . _meta . get_field ( k ) if isinstance ( f , DateTimeField ) : v = dateparse . parse_datetime ( v ) elif isinstance ( f , TimeField ) : v = dateparse . parse_time ( v ) elif isinstance ( f , DateField ) : v = dateparse . parse_date ( v ) except FieldDoesNotExist : pass setattr ( ret , k , v ) return ret
translate raw data into a model instance .