예제 #1
0
파일: apps.py 프로젝트: pombredanne/djpcms
 def render(self, request, layout='group',
            size='', exclude='', include='',
            for_instance=False, **kwargs):
     appmodel = request.view.appmodel
     if not appmodel:
         return
     exclude = None if not exclude else exclude.split(',')
     include = None if not include else include.split(',')
     instance = None if not for_instance else request.instance
     links = list(views.application_links(
                         views.application_views(request,
                                                 exclude=exclude,
                                                 include=include,
                                                 instance=instance),
                         asbuttons=True))
     if appmodel.mapper:
         name = appmodel.mapper.class_name(appmodel.model)
     else:
         name = None
     if links:
         links = [link[1].addClass(size) for link in links]
         if layout.startswith('group'):
             d = html.Widget('div', links, cn=classes.button_group)
             if layout == 'group right':
                 d.addClass(classes.float_right)
             return d
         else:
             return html.Widget('ul', (l[1] for l in links), cn = name)\
                        .addClass('model-links')\
                        .addClass(layout)\
                        .render(request)
예제 #2
0
파일: apps.py 프로젝트: pombredanne/djpcms
 def render(self,
            request,
            layout='group',
            size='',
            exclude='',
            include='',
            for_instance=False,
            **kwargs):
     appmodel = request.view.appmodel
     if not appmodel:
         return
     exclude = None if not exclude else exclude.split(',')
     include = None if not include else include.split(',')
     instance = None if not for_instance else request.instance
     links = list(
         views.application_links(views.application_views(request,
                                                         exclude=exclude,
                                                         include=include,
                                                         instance=instance),
                                 asbuttons=True))
     if appmodel.mapper:
         name = appmodel.mapper.class_name(appmodel.model)
     else:
         name = None
     if links:
         links = [link[1].addClass(size) for link in links]
         if layout.startswith('group'):
             d = html.Widget('div', links, cn=classes.button_group)
             if layout == 'group right':
                 d.addClass(classes.float_right)
             return d
         else:
             return html.Widget('ul', (l[1] for l in links), cn = name)\
                        .addClass('model-links')\
                        .addClass(layout)\
                        .render(request)
예제 #3
0
 def get_views(self, request):
     appmodel = request.view.appmodel
     for r in views.application_views(request, exclude=('delete',)):
         order = appmodel.views_ordering.get(r.view.name,100)
         yield order,r