(model_class)
return sorted(properties, key=lambda k: k['label'])
Show properties from a model
Show properties from a model
Show properties from a model
def get_properties_from_model(model_class):
    """ Show properties from a model """
    properties = []
    attr_names = [name for (name, value) in inspect.getmembers(model_class, isprop)]
    for attr_name in attr_names:
        if attr_name.endswith('pk'):
            attr_names.remove(attr_name)
        else:
            properties.append(dict(label=attr_name, name=attr_name.strip('_').replace('_', ' ')))
    return sorted(properties, key=lambda k: k['label'])
def get_properties_from_model ( model_class ) : properties = [ ] attr_names = [ name for ( name , value ) in inspect . getmembers ( model_class , isprop ) ] for attr_name in attr_names : if attr_name . endswith ( 'pk' ) : attr_names . remove ( attr_name ) else : properties . append ( dict ( label = attr_name , name = attr_name . strip ( '_' ) . replace ( '_' , ' ' ) ) ) return sorted ( properties , key = lambda k : k [ 'label' ] )