##// END OF EJS Templates
Show only active (by status) threads on the landing page
neko259 -
r1745:49bdf576 default
parent child Browse files
Show More
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -553,4 +553,11 b' msgid "Messages per day/week/month:"'
553 msgstr "Сообщений за день/неделю/месяц:"
553 msgstr "Сообщений за день/неделю/месяц:"
554
554
555 msgid "Subscribe to thread"
555 msgid "Subscribe to thread"
556 msgstr "Подписаться на тему" No newline at end of file
556 msgstr "Подписаться на тему"
557
558 msgid "Active threads:"
559 msgstr "Активные темы:"
560
561 msgid "No active threads today."
562 msgstr "Сегодня нет активных тем."
563
@@ -25,9 +25,14 b''
25 </div>
25 </div>
26 <br />
26 <br />
27 <div class="landing-threads">
27 <div class="landing-threads">
28 {% if latest_threads %}
29 {% trans "Active threads:" %}<br />
28 {% for op in latest_threads %}
30 {% for op in latest_threads %}
29 {{ op.get_link_view|safe }} {{ op.get_title_or_text }} ({{ op.thread.get_sections_str|safe }}) +{{ op.today_post_count }}<br />
31 {{ op.get_link_view|safe }} {{ op.get_title_or_text }} ({{ op.thread.get_sections_str|safe }}) +{{ op.today_post_count }}<br />
30 {% endfor %}
32 {% endfor %}
33 {% else %}
34 {% trans "No active threads today." %}
35 {% endif %}
31 </div>
36 </div>
32 </div>
37 </div>
33 {% endblock %}
38 {% endblock %}
@@ -8,7 +8,7 b' from django.views.decorators.csrf import'
8
8
9 from boards import settings
9 from boards import settings
10 from boards.models import Post
10 from boards.models import Post
11 from boards.models import Tag, Attachment
11 from boards.models import Tag, Attachment, STATUS_ACTIVE
12 from boards.views.base import BaseBoardView
12 from boards.views.base import BaseBoardView
13
13
14 PARAM_SECTION_STR = 'section_str'
14 PARAM_SECTION_STR = 'section_str'
@@ -30,7 +30,7 b' class LandingView(BaseBoardView):'
30
30
31 today = datetime.now() - timedelta(1)
31 today = datetime.now() - timedelta(1)
32 max_landing_threads = settings.get_int('View', 'MaxFavoriteThreads')
32 max_landing_threads = settings.get_int('View', 'MaxFavoriteThreads')
33 ops = Post.objects.filter(thread__replies__pub_time__gt=today, opening=True)\
33 ops = Post.objects.filter(thread__replies__pub_time__gt=today, opening=True, thread__status=STATUS_ACTIVE)\
34 .annotate(today_post_count=Count('thread__replies'))\
34 .annotate(today_post_count=Count('thread__replies'))\
35 .order_by('-pub_time')[:max_landing_threads]
35 .order_by('-pub_time')[:max_landing_threads]
36 params[PARAM_LATEST_THREADS] = ops
36 params[PARAM_LATEST_THREADS] = ops
General Comments 0
You need to be logged in to leave comments. Login now