Show More
@@ -1,36 +1,37 b'' | |||
|
1 | 1 | {% extends "boards/base.html" %} |
|
2 | 2 | |
|
3 | 3 | {% load i18n %} |
|
4 | 4 | {% load static %} |
|
5 | 5 | {% load board %} |
|
6 | 6 | |
|
7 | 7 | {% block head %} |
|
8 | 8 | <title>{{ site_name|safe }}</title> |
|
9 | 9 | {% endblock %} |
|
10 | 10 | |
|
11 | 11 | {% block content %} |
|
12 | 12 | {% autoescape off %} |
|
13 | 13 | <div id="posts-table"> |
|
14 | 14 | <div class="landing-tags"> |
|
15 | 15 | {{ section_str }} |
|
16 | 16 | </div> |
|
17 | 17 | <br /> |
|
18 | 18 | {% if latest_threads %} |
|
19 | 19 | <div class="landing-threads"> |
|
20 | 20 | {% for op in latest_threads %} |
|
21 | 21 | <div class="thread-short gallery_image"> |
|
22 | 22 | {{ op.attachments.first.get_view|safe }} |
|
23 | 23 | {% with title=op.get_title_or_text %} |
|
24 | 24 | {% if title %} |
|
25 | 25 | <div class="title">{{ title }}</div> |
|
26 | 26 | {% endif %} |
|
27 | 27 | {% endwith %} |
|
28 | 28 | <div>{{ op.thread.get_sections_str }}</div> |
|
29 |
<div>{{ op.get_link_view }} |
|
|
29 | <div>{{ op.get_link_view }}</div> | |
|
30 | <div>{{ op.thread.last_edit_time }}</div> | |
|
30 | 31 | </div> |
|
31 | 32 | {% endfor %} |
|
32 | 33 | </div> |
|
33 | 34 | {% endif %} |
|
34 | 35 | </div> |
|
35 | 36 | {% endautoescape %} |
|
36 | 37 | {% endblock %} |
@@ -1,41 +1,41 b'' | |||
|
1 | 1 | from datetime import datetime |
|
2 | 2 | from datetime import timedelta |
|
3 | 3 | |
|
4 | 4 | from django.db.models import Count, Q |
|
5 | 5 | from django.shortcuts import render |
|
6 | 6 | from django.utils.decorators import method_decorator |
|
7 | 7 | from django.views.decorators.csrf import csrf_protect |
|
8 | 8 | |
|
9 | 9 | from boards import settings |
|
10 | 10 | from boards.models import Post, Tag, Attachment, STATUS_ACTIVE, TagAlias |
|
11 | 11 | from boards.models.tag import DEFAULT_LOCALE |
|
12 | 12 | from boards.views.base import BaseBoardView |
|
13 | 13 | |
|
14 | 14 | PARAM_SECTION_STR = 'section_str' |
|
15 | 15 | PARAM_LATEST_THREADS = 'latest_threads' |
|
16 | 16 | |
|
17 | 17 | TEMPLATE = 'boards/landing.html' |
|
18 | 18 | |
|
19 | 19 | |
|
20 | 20 | class LandingView(BaseBoardView): |
|
21 | 21 | @method_decorator(csrf_protect) |
|
22 | 22 | def get(self, request): |
|
23 | 23 | params = dict() |
|
24 | 24 | |
|
25 | 25 | params[PARAM_SECTION_STR] = Tag.objects.get_tag_url_list( |
|
26 | 26 | Tag.objects.filter(Q(aliases__in=TagAlias.objects.filter_localized()) & Q(required=True)) |
|
27 | 27 | .order_by('aliases__name')) |
|
28 | 28 | |
|
29 | 29 | today = datetime.now() - timedelta(1) |
|
30 | 30 | ops = Post.objects.filter(thread__replies__pub_time__gt=today, opening=True, thread__status=STATUS_ACTIVE)\ |
|
31 | 31 | .annotate(today_post_count=Count('thread__replies'))\ |
|
32 | 32 | .order_by('-pub_time') |
|
33 | 33 | |
|
34 |
max_landing_threads = settings.get_int('View', 'Max |
|
|
34 | max_landing_threads = settings.get_int('View', 'MaxLandingThreads') | |
|
35 | 35 | if max_landing_threads > 0: |
|
36 | 36 | ops = ops[:max_landing_threads] |
|
37 | 37 | |
|
38 | 38 | params[PARAM_LATEST_THREADS] = ops |
|
39 | 39 | |
|
40 | 40 | return render(request, TEMPLATE, params) |
|
41 | 41 |
General Comments 0
You need to be logged in to leave comments.
Login now