Show More
@@ -18,6 +18,7 b' class TagAdmin(admin.ModelAdmin):' | |||||
18 | class UserAdmin(admin.ModelAdmin): |
|
18 | class UserAdmin(admin.ModelAdmin): | |
19 |
|
19 | |||
20 | list_display = ('user_id', 'rank') |
|
20 | list_display = ('user_id', 'rank') | |
|
21 | search_fields = ('user_id',) | |||
21 |
|
22 | |||
22 | admin.site.register(Post, PostAdmin) |
|
23 | admin.site.register(Post, PostAdmin) | |
23 | admin.site.register(Tag, TagAdmin) |
|
24 | admin.site.register(Tag, TagAdmin) |
@@ -68,7 +68,7 b'' | |||||
68 | {% for thread in threads %} |
|
68 | {% for thread in threads %} | |
69 | {% cache 600 thread_short thread.thread.id thread.thread.last_edit_time moderator LANGUAGE_CODE %} |
|
69 | {% cache 600 thread_short thread.thread.id thread.thread.last_edit_time moderator LANGUAGE_CODE %} | |
70 | <div class="thread"> |
|
70 | <div class="thread"> | |
71 | {% post_view_truncated thread.op True %} |
|
71 | {% post_view_truncated thread.op True moderator %} | |
72 | {% if thread.last_replies.exists %} |
|
72 | {% if thread.last_replies.exists %} | |
73 | {% if thread.skipped_replies %} |
|
73 | {% if thread.skipped_replies %} | |
74 | <div class="skipped_replies"> |
|
74 | <div class="skipped_replies"> | |
@@ -79,7 +79,7 b'' | |||||
79 | {% endif %} |
|
79 | {% endif %} | |
80 | <div class="last-replies"> |
|
80 | <div class="last-replies"> | |
81 | {% for post in thread.last_replies %} |
|
81 | {% for post in thread.last_replies %} | |
82 | {% post_view_truncated post %} |
|
82 | {% post_view_truncated post moderator=moderator%} | |
83 | {% endfor %} |
|
83 | {% endfor %} | |
84 | </div> |
|
84 | </div> | |
85 | {% endif %} |
|
85 | {% endif %} |
@@ -31,7 +31,7 b'' | |||||
31 | {% endif %} |
|
31 | {% endif %} | |
32 | <div class="thread"> |
|
32 | <div class="thread"> | |
33 | {% for post in posts %} |
|
33 | {% for post in posts %} | |
34 | {% post_view post %} |
|
34 | {% post_view post moderator=moderator %} | |
35 | {% endfor %} |
|
35 | {% endfor %} | |
36 | </div> |
|
36 | </div> | |
37 | {% endcache %} |
|
37 | {% endcache %} |
@@ -50,31 +50,27 b' def image_actions(*args, **kwargs):' | |||||
50 |
|
50 | |||
51 |
|
51 | |||
52 | @register.inclusion_tag('boards/post.html', name='post_view') |
|
52 | @register.inclusion_tag('boards/post.html', name='post_view') | |
53 |
def post_view( |
|
53 | def post_view(post, moderator=False): | |
54 | """ |
|
54 | """ | |
55 | Get post |
|
55 | Get post | |
56 | """ |
|
56 | """ | |
57 |
|
57 | |||
58 | post = args[0] |
|
58 | return { | |
59 |
|
59 | 'post': post, | ||
60 | return { 'post': post } |
|
60 | 'moderator': moderator, | |
|
61 | } | |||
61 |
|
62 | |||
62 |
|
63 | |||
63 | @register.inclusion_tag('boards/post.html', name='post_view_truncated') |
|
64 | @register.inclusion_tag('boards/post.html', name='post_view_truncated') | |
64 |
def post_view_truncated( |
|
65 | def post_view_truncated(post, need_open_link=False, moderator=False): | |
65 | """ |
|
66 | """ | |
66 | Get post with truncated text. If the 'open' or 'reply' link is needed, pass |
|
67 | Get post with truncated text. If the 'open' or 'reply' link is needed, pass | |
67 | the second parameter as True. |
|
68 | the second parameter as True. | |
68 | """ |
|
69 | """ | |
69 |
|
70 | |||
70 | post = args[0] |
|
|||
71 | if len(args) > 1: |
|
|||
72 | need_open_link = args[1] |
|
|||
73 | else: |
|
|||
74 | need_open_link = False |
|
|||
75 |
|
||||
76 | return { |
|
71 | return { | |
77 | 'post': post, |
|
72 | 'post': post, | |
78 | 'truncated': True, |
|
73 | 'truncated': True, | |
79 | 'need_open_link': need_open_link |
|
74 | 'need_open_link': need_open_link, | |
|
75 | 'moderator': moderator, | |||
80 | } No newline at end of file |
|
76 | } |
General Comments 0
You need to be logged in to leave comments.
Login now