示例#1
0
 def __mapper_args__(cls):
     name = cls.__name__
     if name == 'ConfigurableOption':
         return {
             'polymorphic_on': 'type_',
             'polymorphic_identity': 'configurable_option'
         }
     else:
         return {'polymorphic_identity': camel_case_to_name(name)}
示例#2
0
 def __mapper_args__(cls):
     name = cls.__name__
     if name == 'ConfigurableOption':
         return {
             'polymorphic_on': 'type_',
             'polymorphic_identity': 'configurable_option'
         }
     else:
         return {'polymorphic_identity': camel_case_to_name(name)}
示例#3
0
文件: tools.py 项目: lluc/autonomie
def get_model_admin_view(model, js_requirements=[], r_path="admin_userdatas"):
    """
    Return a view object and a route_name for administrating a sequence of
    models instances (like options)
    """
    infos = model.__colanderalchemy_config__
    view_title = infos.get('title', u'Titre inconnu')

    class MyView(AdminOption):
        title = view_title
        validation_msg = infos.get('validation_msg', u'')
        factory = model
        redirect_route_name = r_path
        js_resources = js_requirements

    return (
        MyView,
        u"admin_%s" % camel_case_to_name(model.__name__),
        '/admin/main.mako',
    )
示例#4
0
def get_model_admin_view(model, js_requirements=[], r_path="admin_userdatas"):
    """
    Return a view object and a route_name for administrating a sequence of
    models instances (like options)
    """
    infos = model.__colanderalchemy_config__
    view_title = infos.get('title', u'Titre inconnu')

    subroute_name = camel_case_to_name(model.__name__)
    view_route_name = os.path.join(r_path, subroute_name)

    class MyView(AdminOption):
        title = view_title
        description = infos.get('description', u'')
        route_name = view_route_name

        validation_msg = infos.get('validation_msg', u'')
        factory = model
        redirect_route_name = r_path
        js_resources = js_requirements

    return MyView
示例#5
0
def get_model_admin_view(model, js_requirements=[], r_path="admin_userdatas"):
    """
    Return a view object and a route_name for administrating a sequence of
    models instances (like options)
    """
    infos = model.__colanderalchemy_config__
    view_title = infos.get('title', u'Titre inconnu')

    subroute_name = camel_case_to_name(model.__name__)
    view_route_name = os.path.join(r_path, subroute_name)

    class MyView(AdminOption):
        title = view_title
        description = infos.get('description', u'')
        route_name = view_route_name

        validation_msg = infos.get('validation_msg', u'')
        factory = model
        redirect_route_name = r_path
        js_resources = js_requirements

    return MyView
示例#6
0
 def __tablename__(cls):
     return camel_case_to_name(cls.__name__)