Exemple #1
0
def shortcode_side(*args):
    link = slugify(args[0].split('#')[0].lower())
    segment = slugify(args[0].split('#')[-1].lower()) if '#' in args[0] else ''
    title = args[-1]
    try:
        Page.objects.get(slug=link)
        link_class = ''
    except Page.DoesNotExist:
        link_class = 'DoesNotExist'
    return render_to_string('shortcodes/link.html', {
        'link': link,
        'segment': segment,
        'title': title,
        'class': link_class,
    })
Exemple #2
0
    def save(self, *args, **kwargs):
        if not self.id:
            self.slug = slugify(self.slug)

        super(Page, self).save(*args, **kwargs)