コード例 #1
0
ファイル: models.py プロジェクト: Madankapoor/quokka
def format_ul(self, request, obj, fieldname, *args, **kwars):
    field = getattr(obj, fieldname)
    column_formatters_args = getattr(self, 'column_formatters_args', {})
    _args = column_formatters_args.get('ul', {}).get(fieldname, {})
    ul = html.ul(style=_args.get('style', "min-width:200px;max-width:300px;"))
    placeholder = _args.get('placeholder', u"{i}")
    lis = [html.li(placeholder.format(item=item)) for item in field]
    return ul(*lis)
コード例 #2
0
def format_custom_vars(self, request, obj, fieldname, *args, **kwargs):
    ul = html.ul(style="min-width:200px;max-width:300px;")
    lis = [
        html.li(
            html.strong(f'{item["key"]}:'), f' {item["value"]}'
        ) for item in obj.get('custom_vars', [])
    ]
    return ul(*lis)
コード例 #3
0
ファイル: models.py プロジェクト: infrascloudy/flaskpress
def format_ul(self, request, obj, fieldname, *args, **kwars):
    field = getattr(obj, fieldname)
    column_formatters_args = getattr(self, 'column_formatters_args', {})
    _args = column_formatters_args.get('ul', {}).get(fieldname, {})
    ul = html.ul(style=_args.get('style', "min-width:200px;max-width:300px;"))
    placeholder = _args.get('placeholder', u"{i}")
    lis = [html.li(placeholder.format(item=item)) for item in field]
    return ul(*lis)