##// END OF EJS Templates
Always save post URL
Always save post URL

File last commit:

r1650:8a0acd9f default
r1669:cd0ada52 default
Show More
board.py
51 lines | 1.2 KiB | text/x-python | PythonLexer
neko259
Truncate posts by lines
r1000 import re
neko259
Added a template tag to get post link instead of using jumper
r320 from django.shortcuts import get_object_or_404
from django import template
neko259
Truncate posts by lines
r1000
neko259
Refactoring
r1027 IMG_ACTION_URL = '[<a href="{}">{}</a>]'
neko259
Added tag search. Refactored search to show any model results in a list.
r692
neko259
Added a template tag to get post link instead of using jumper
r320 register = template.Library()
neko259
Added metadata to the gallery. Added links to search the image by the online search engines
r460 actions = [
{
'name': 'google',
'link': 'http://google.com/searchbyimage?image_url=%s',
},
{
'name': 'iqdb',
'link': 'http://iqdb.org/?url=%s',
},
]
neko259
Added a template tag to get post link instead of using jumper
r320
@register.simple_tag(name='post_url')
def post_url(*args, **kwargs):
post_id = args[0]
neko259
Added tag search. Refactored search to show any model results in a list.
r692 post = get_object_or_404('Post', id=post_id)
neko259
Added a template tag to get post link instead of using jumper
r320
neko259
Use get_absolute_url instead of get_url for post, tag and thread
r1160 return post.get_absolute_url()
neko259
Speed up thread loading
r614
neko259
Added metadata to the gallery. Added links to search the image by the online search engines
r460 @register.simple_tag(name='image_actions')
def image_actions(*args, **kwargs):
image_link = args[0]
if len(args) > 1:
neko259
Refactoring
r1027 image_link = 'http://' + args[1] + image_link # TODO https?
neko259
Added metadata to the gallery. Added links to search the image by the online search engines
r460
neko259
Refactoring
r1027 return ', '.join([IMG_ACTION_URL.format(
neko259
Added missing space
r1179 action['link'] % image_link, action['name']) for action in actions])
neko259
Added template tag to render post the same way in all places (threads list, thread view, post view)
r537
neko259
Use inclusion tag for post_view
r1648 @register.inclusion_tag('boards/post.html', name='post_view', takes_context=True)
neko259
Do not pass over perms variable manually to the post template. Fixed thread...
r1390 def post_view(context, post, *args, **kwargs):
kwargs['perms'] = context['perms']
neko259
Use inclusion tag for post_view
r1648 return post.get_view_params(*args, **kwargs)
neko259
Speed up thread loading
r614
neko259
Fixed issue with newly added posts appearance
r1650
neko259
Added ability to get page urls of paginators
r1377 @register.simple_tag(name='page_url')
def page_url(paginator, page_number, *args, **kwargs):
neko259
Added method to check if the paginator supports new-style page links
r1379 if paginator.supports_urls():
return paginator.get_page_url(page_number)