This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import template | |
from django.utils.safestring import mark_safe | |
register = template.Library() | |
# Converts line breaks to paragraphs | |
@register.filter | |
def tohtml(manylinesstr): | |
return mark_safe(''.join("<p>%s</p>" % line | |
for line in manylinesstr.splitlines() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import template | |
import hashlib | |
register = template.Library() | |
# {{ "some identifier"|md5 }} -> g87g98ht02497hg349ugh3409h34 | |
@register.filter(name='md5') | |
def md5_string(value): | |
return hashlib.md5(value).hexdigest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def timeline(request): | |
index_list = User.objects.order_by('-id').select_related('userprofile').prefetch_related('comment_set')[:120] | |
paginator = Paginator(index_list, 24) | |
page = request.GET.get('page') | |
try: | |
index = paginator.page(page) | |
except PageNotAnInteger: | |
index = paginator.page(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body, .menu, .footer { background-color: #000; color: #eee; } | |
.main { background-color: #222; color: #eee; } | |
.menu li a { color: #eee; } | |
.entry a, .profile a, .footer a { color: #30c0c0; } | |
.page a, .dock a { background-color: #000; color: silver; } | |
.page a:hover, .dock a:hover { background-color: #333; } | |
.page a.selected { background-color: #30c0c0; } | |
.page sup { color: gray } | |
.list li { border-color: #444; } | |
.list .small a { color: #bbb; } |
NewerOlder