@safe_filter(error_output=False)
@register.filter
def is_portrait(file_):
 if sorl_settings.THUMBNAIL_DUMMY:
  return (sorl_settings.THUMBNAIL_DUMMY_RATIO < 1)
 if (not file_):
  return False
 image_file = default.kvstore.get_or_set(ImageFile(file_))
 return image_file.is_portrait()

@ safe_filter ( error_output = False ) @ register . filter def is_portrait ( file_ ) : if sorl_settings . THUMBNAIL_DUMMY : return ( sorl_settings . THUMBNAIL_DUMMY_RATIO < 1 ) if ( not file_ ) : return False image_file = default . kvstore . get_or_set ( ImageFile ( file_ ) ) return image_file . is_portrait ( )
a very handy filter to determine if an image is portrait or landscape .