Пример #1
0
def impala_breadcrumbs(context, items=list(), add_default=True, crumb_size=40):
    """
    show a list of breadcrumbs. If url is None, it won't be a link.
    Accepts: [(url, label)]
    """
    if add_default:
        base_title = page_name(context['request'].APP)
        crumbs = [(urlresolvers.reverse('home'), base_title)]
    else:
        crumbs = []

    # add user-defined breadcrumbs
    if items:
        try:
            crumbs += items
        except TypeError:
            crumbs.append(items)

    crumbs = [(url, truncate(label, crumb_size)) for (url, label) in crumbs]
    c = {'breadcrumbs': crumbs, 'has_home': add_default}
    t = get_env().get_template('amo/impala/breadcrumbs.html').render(c)
    return jinja2.Markup(t)
Пример #2
0
def impala_breadcrumbs(context, items=list(), add_default=True, crumb_size=40):
    """
    show a list of breadcrumbs. If url is None, it won't be a link.
    Accepts: [(url, label)]
    """
    if add_default:
        base_title = page_name(context['request'].APP)
        crumbs = [(urlresolvers.reverse('home'), base_title)]
    else:
        crumbs = []

    # add user-defined breadcrumbs
    if items:
        try:
            crumbs += items
        except TypeError:
            crumbs.append(items)

    crumbs = [(url, truncate(label, crumb_size)) for (url, label) in crumbs]
    c = {'breadcrumbs': crumbs, 'has_home': add_default}
    t = get_env().get_template('amo/impala/breadcrumbs.html').render(c)
    return jinja2.Markup(t)
Пример #3
0
 def clean_description(self):
     return truncate(self.cleaned_data.get('description', ''), 250)
Пример #4
0
 def __unicode__(self):
     if self.title:
         return unicode(self.title)
     return truncate(unicode(self.body), 10)
Пример #5
0
 def __unicode__(self):
     if self.title:
         return unicode(self.title)
     return truncate(unicode(self.body), 10)
Пример #6
0
 def truncate_response(obj):
     return truncate(obj.response, 50)
Пример #7
0
 def truncate_response(obj):
     return truncate(obj.response, 50)