Ejemplo n.º 1
0
def homepage():
    from mocrud.admin import admin
    return jinja2_template('admin/model_grup.html',
        panels=admin.get_panels(),
        model_grup = 'default',
        model_admins=admin.get_grup_admins('default'),
        **admin.template_helper.get_helper_context()
    )
Ejemplo n.º 2
0
def homepage():
    from mocrud.admin import admin
    return jinja2_template('admin/model_grup.html',
#            model_admins=self.get_model_admins(),
        panels=admin.get_panels(),
        model_grup = 'crud_example',
        model_admins=admin.get_grup_admins('crud_example'),
        **admin.template_helper.get_model_admins()
    )
Ejemplo n.º 3
0
def PageView(request, model):
    page = model(request)
    menu_group = page.app_menu
    PageName = page.__class__.__name__

    m_urlparams = dict(request.GET)
    m_params = []
    for e in m_urlparams.keys():
        m_value = m_urlparams[e]
        if type(m_value)==type([]):
            m_value = ','.join(m_value)
        m_params.append({"name":str(e),"value":str(m_value)})
        
    response_context = {
                        'app_label':menu_group,
                        'model_name':PageName,
                        'urlparams':m_params,
                        'select_fieldname':request.GET.get('fieldname',''),
                        'ids':request.GET.get('ids',''),
                        'page': page,
                        'verbose_name':page.verbose_name}

#    if not page.template.endswith('_window.html'):
#        page.template = page.template.replace(".html","_pure.html")

    if page.context:
        if callable(page.context):
            response_context.update(page.context())
        else:
            response_context.update(page.context)
            
    if 'mocrud' in sys.modules.keys():
        from mocrud.admin import admin
        response_context['model_grup'] = page.app_menu
        response_context["model_admins"] = admin.get_model_admins()
        response_context["panels"] = admin.get_panels()
        response_context.update( admin.template_helper.get_helper_context() )
            
    return JTemplate(page.template,**response_context)