Compare commits

..

No commits in common. "f26ddd3a41d45ded985247676a55b955ee8414e5" and "f32546db31fb20170ad14d488ee57b36934ee80d" have entirely different histories.

2 changed files with 3 additions and 14 deletions

View File

@ -15,14 +15,9 @@ from markdownx.models import MarkdownxField
from markdownx.utils import markdownify
from sortedm2m.fields import SortedManyToManyField
import ox
import lxml.html
# Create your models here.
def sanitize_html(string):
return '\n'.join(lxml.html.tostring(x) for x in lxml.html.fragment_fromstring(string).iterchildren())
class Acrolike(models.Model):
title = models.CharField(max_length=255)
@ -125,8 +120,7 @@ class Content(models.Model):
if self.teaser:
value = markdownify(self.teaser)
elif self.header:
value = ox.decode_html(markdownify(self.header))
value = sanitize_html('<div>' + value + '</div>')
value = ox.sanitize_html(ox.decode_html(markdownify(self.header)))
else:
value = ''
return mark_safe(value)

View File

@ -95,12 +95,7 @@ def section_list(request, section):
q = request.GET.get('q')
content = limit_content(content, q)
year = request.GET.get('year', '')
if year or section not in ('Projects', 'Works'):
context = filter_by_years(content, year)
else:
context = {
'content': content
}
context = filter_by_years(content, year)
'''
page = request.GET.get('page', 1)
@ -275,7 +270,7 @@ def redirect_index(request):
return redirect(reverse('index'))
def redirect_event(request):
shortname = request.GET.get('this', '').replace(' ', '_').lower()
shortname = request.GET.get('this').replace(' ', '_').lower()
if shortname:
content = get_object_or_404(Content, shortname__iexact=shortname)
return redirect(content.get_absolute_url())