# HG changeset patch # User neko259 # Date 2014-01-18 12:09:10 # Node ID e47cc30d0898e669b5bfe8d501496f2b2d0e815f # Parent 4841b16e185e0cd37ce708f45d5dfa8c5eda7a39 Fixed moderator panel diff --git a/boards/admin.py b/boards/admin.py --- a/boards/admin.py +++ b/boards/admin.py @@ -18,6 +18,7 @@ class TagAdmin(admin.ModelAdmin): class UserAdmin(admin.ModelAdmin): list_display = ('user_id', 'rank') + search_fields = ('user_id',) admin.site.register(Post, PostAdmin) admin.site.register(Tag, TagAdmin) diff --git a/boards/templates/boards/posting_general.html b/boards/templates/boards/posting_general.html --- a/boards/templates/boards/posting_general.html +++ b/boards/templates/boards/posting_general.html @@ -68,7 +68,7 @@ {% for thread in threads %} {% cache 600 thread_short thread.thread.id thread.thread.last_edit_time moderator LANGUAGE_CODE %}
- {% post_view_truncated thread.op True %} + {% post_view_truncated thread.op True moderator %} {% if thread.last_replies.exists %} {% if thread.skipped_replies %}
@@ -79,7 +79,7 @@ {% endif %}
{% for post in thread.last_replies %} - {% post_view_truncated post %} + {% post_view_truncated post moderator=moderator%} {% endfor %}
{% endif %} diff --git a/boards/templates/boards/thread.html b/boards/templates/boards/thread.html --- a/boards/templates/boards/thread.html +++ b/boards/templates/boards/thread.html @@ -31,7 +31,7 @@ {% endif %}
{% for post in posts %} - {% post_view post %} + {% post_view post moderator=moderator %} {% endfor %}
{% endcache %} diff --git a/boards/templatetags/board.py b/boards/templatetags/board.py --- a/boards/templatetags/board.py +++ b/boards/templatetags/board.py @@ -50,31 +50,27 @@ def image_actions(*args, **kwargs): @register.inclusion_tag('boards/post.html', name='post_view') -def post_view(*args, **kwargs): +def post_view(post, moderator=False): """ Get post """ - post = args[0] - - return { 'post': post } + return { + 'post': post, + 'moderator': moderator, + } @register.inclusion_tag('boards/post.html', name='post_view_truncated') -def post_view_truncated(*args, **kwargs): +def post_view_truncated(post, need_open_link=False, moderator=False): """ Get post with truncated text. If the 'open' or 'reply' link is needed, pass the second parameter as True. """ - post = args[0] - if len(args) > 1: - need_open_link = args[1] - else: - need_open_link = False - return { 'post': post, 'truncated': True, - 'need_open_link': need_open_link + 'need_open_link': need_open_link, + 'moderator': moderator, } \ No newline at end of file