def view_on_site(self, request, obj, fieldname, *args, **kwargs): endpoint = kwargs.pop('endpoint', 'detail') return html.a( href=obj.get_absolute_url(endpoint), target='_blank', )(html.i(class_="icon icon-eye-open", style="margin-right: 5px;")(), _l('View on site'))
def adjust_priority(view, context, model, name): _href = '/admin/adjust-priority?url=%s&model=%s&id=%s' % ( view.url, model.__class__.__name__, model.id ) _i = lambda icon: html.i(class_="icon %s" % icon, style="margin-right: 5px;")() return html.div()( html.a(href=_href + '&delta=-1')(_i('icon-circle-arrow-up')), html.a(href=_href + '&delta=1')(_i('icon-circle-arrow-down')), )
def view_on_site(self, request, obj, fieldname, *args, **kwargs): available = obj.is_available endpoint = kwargs.pop( 'endpoint', 'quokka.core.detail' if available else 'quokka.core.preview' ) return html.a( href=obj.get_absolute_url(endpoint), target='_blank', )(html.i(class_="icon icon-eye-open", style="margin-right: 5px;")(), _l('View on site') if available else _l('Preview on site'))
def view_on_site(self, request, obj, fieldname, *args, **kwargs): return html.a( href=obj.get_absolute_url('detail'), target='_blank', )(html.i(class_="icon icon-eye-open", style="margin-right: 5px;")(), lazy_gettext('View on site'))
def format_link(self, request, obj, fieldname, *args, **kwars): value = getattr(obj, fieldname) return html.a(href=value, title=value, target='_blank')( html.i(class_="icon icon-resize-small", style="margin-right: 5px;")() )