def django_orm_maxlength_truncate(backend, details, user=None, is_new=False, *args, **kwargs):
 if (user is None):
  return
 out = {}
 names = user._meta.get_all_field_names()
 for (name, value) in six.iteritems(details):
  if ((name in names) and (not _ignore_field(name, is_new))):
   max_length = user._meta.get_field(name).max_length
   try:
    if (max_length and (len(value) > max_length)):
     value = value[:max_length]
   except TypeError:
    pass
  out[name] = value
 return {'details': out}

def django_orm_maxlength_truncate ( backend , details , user = None , is_new = False , * args , ** kwargs ) : if ( user is None ) : return out = { } names = user . _meta . get_all_field_names ( ) for ( name , value ) in six . iteritems ( details ) : if ( ( name in names ) and ( not _ignore_field ( name , is_new ) ) ) : max_length = user . _meta . get_field ( name ) . max_length try : if ( max_length and ( len ( value ) > max_length ) ) : value = value [ : max_length ] except TypeError : pass out [ name ] = value return { 'details' : out }
truncate any value in details that corresponds with a field in the user model .