Example #1
0
def entry(request, year, month, day, slug, categories=(), paginate_by=10,
          template_name=None):
    try:
        year, month, day = int(year), int(month), int(day)
        date = datetime.date(year, month, day)
    except ValueError:
        raise Http404()

    try:
        queryset = _get_queryset(categories)
        range = (datetime.datetime.combine(date, datetime.time.min),
                 datetime.datetime.combine(date, datetime.time.max))
        item = queryset.get(pub_date__range=range, slug__exact=slug)
    except ObjectDoesNotExist:
        raise Http404()

    template = 'entry.html'
    if template_name is not None:
        template = '%s_%s' % (template_name, template)
    template = 'journal/%s' % template

    c = {
        'date': date,
        'entry': item,
        'entry_content': mark_safe(clean_html(item.content, full=False)),
        'latest': queryset[:5],
        'months': _sidebar(_get_queryset([]))
        }

    return render_to_response(template, c, context_instance=RequestContext(request)) 
Example #2
0
def entry(request,
          year,
          month,
          day,
          slug,
          categories=(),
          paginate_by=10,
          template_name=None):
    try:
        year, month, day = int(year), int(month), int(day)
        date = datetime.date(year, month, day)
    except ValueError:
        raise Http404()

    try:
        queryset = _get_queryset(categories)
        range = (datetime.datetime.combine(date, datetime.time.min),
                 datetime.datetime.combine(date, datetime.time.max))
        item = queryset.get(pub_date__range=range, slug__exact=slug)
    except ObjectDoesNotExist:
        raise Http404()

    template = 'entry.html'
    if template_name is not None:
        template = '%s_%s' % (template_name, template)
    template = 'journal/%s' % template
    return render_to_response(
        template, {
            'date': date,
            'entry': item,
            'entry_content': mark_safe(clean_html(item.content, full=False)),
            'latest': queryset[:5],
        },
        context_instance=RequestContext(request))
def customizations(request):
    site = Site.objects.get_current()
    settings = SiteSettings.get(site)

    return {
        'site_name': site.name,
        'site_logo': settings.logo.url if settings.logo else "",
        'site_footer': mark_safe(clean_html(settings.footer, full=False)) if settings.footer else None,
    }
def site_context():
    site = Site.objects.get_current()
    settings = SiteSettings.get(site)

    return {
        'site_name': site.name,
        'site_logo': settings.logo.url if settings.logo else "",
        'site_footer': mark_safe(clean_html(settings.footer, full=False)) if settings.footer else None,
        'show_cookie_warning': settings.show_cookie_warning,
    }
Example #5
0
def site_context():
    site = Site.objects.get_current()
    settings = SiteSettings.get(site)

    return {
        'site_name':
        site.name,
        'site_logo':
        settings.logo.url if settings.logo else "",
        'site_footer':
        mark_safe(clean_html(settings.footer, full=False))
        if settings.footer else None,
        'show_cookie_warning':
        settings.show_cookie_warning,
    }
Example #6
0
 def clean(self):
     self.body = clean_html(self.body, full=False)
 def clean(self):
     self.body = clean_html(self.body, full=False)