Show More
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -548,3 +548,6 b' msgstr "\xd0\xa3\xd0\xb4\xd0\xb0\xd0\xbb\xd0\xb8\xd1\x82\xd1\x8c \xd0\xbf\xd0\xbe\xd1\x81\xd1\x82"' | |||||
548 |
|
548 | |||
549 | msgid "Delete thread" |
|
549 | msgid "Delete thread" | |
550 | msgstr "Удалить тему" |
|
550 | msgstr "Удалить тему" | |
|
551 | ||||
|
552 | msgid "Messages per day/week/month:" | |||
|
553 | msgstr "Сообщений за день/неделю/месяц:" |
@@ -122,6 +122,20 b' class PostManager(models.Manager):' | |||||
122 |
|
122 | |||
123 | return ppd |
|
123 | return ppd | |
124 |
|
124 | |||
|
125 | def get_post_per_days(self, days) -> int: | |||
|
126 | day_end = date.today() + timedelta(1) | |||
|
127 | day_start = day_end - timedelta(days) | |||
|
128 | ||||
|
129 | day_time_start = timezone.make_aware(datetime.combine( | |||
|
130 | day_start, dtime()), timezone.get_current_timezone()) | |||
|
131 | day_time_end = timezone.make_aware(datetime.combine( | |||
|
132 | day_end, dtime()), timezone.get_current_timezone()) | |||
|
133 | ||||
|
134 | return self.filter( | |||
|
135 | pub_time__lte=day_time_end, | |||
|
136 | pub_time__gte=day_time_start).count() | |||
|
137 | ||||
|
138 | ||||
125 | @transaction.atomic |
|
139 | @transaction.atomic | |
126 | def import_post(self, title: str, text: str, pub_time: str, global_id, |
|
140 | def import_post(self, title: str, text: str, pub_time: str, global_id, | |
127 | opening_post=None, tags=list(), files=list(), |
|
141 | opening_post=None, tags=list(), files=list(), |
@@ -12,6 +12,7 b'' | |||||
12 | <h2>{% trans 'Statistics' %}</h2> |
|
12 | <h2>{% trans 'Statistics' %}</h2> | |
13 | <p>{% trans 'Size of media:' %} {{ media_size|filesizeformat }}. |
|
13 | <p>{% trans 'Size of media:' %} {{ media_size|filesizeformat }}. | |
14 | <p>{% blocktrans count count=post_count %}{{ count }} message{% plural %}messages{% endblocktrans %}.</p> |
|
14 | <p>{% blocktrans count count=post_count %}{{ count }} message{% plural %}messages{% endblocktrans %}.</p> | |
|
15 | <p>{% trans 'Messages per day/week/month:' %} {{ post_per_day }}/{{ post_per_week }}/{{ post_per_month }}</p> | |||
15 | <h2>{% trans 'Authors' %}</h2> |
|
16 | <h2>{% trans 'Authors' %}</h2> | |
16 | {% for nick, values in authors.items %} |
|
17 | {% for nick, values in authors.items %} | |
17 | <p> |
|
18 | <p> |
@@ -12,6 +12,9 b' from boards.models import Post' | |||||
12 | PARAM_AUTHORS = 'authors' |
|
12 | PARAM_AUTHORS = 'authors' | |
13 | PARAM_MEDIA_SIZE = 'media_size' |
|
13 | PARAM_MEDIA_SIZE = 'media_size' | |
14 | PARAM_POST_COUNT = 'post_count' |
|
14 | PARAM_POST_COUNT = 'post_count' | |
|
15 | PARAM_POST_PER_DAY = 'post_per_day' | |||
|
16 | PARAM_POST_PER_WEEK = 'post_per_week' | |||
|
17 | PARAM_POST_PER_MONTH = 'post_per_month' | |||
15 |
|
18 | |||
16 |
|
19 | |||
17 | class AuthorsView(BaseBoardView): |
|
20 | class AuthorsView(BaseBoardView): | |
@@ -22,6 +25,10 b' class AuthorsView(BaseBoardView):' | |||||
22 | params[PARAM_MEDIA_SIZE] = self._get_directory_size(neboard.settings.MEDIA_ROOT) |
|
25 | params[PARAM_MEDIA_SIZE] = self._get_directory_size(neboard.settings.MEDIA_ROOT) | |
23 | params[PARAM_POST_COUNT] = Post.objects.count() |
|
26 | params[PARAM_POST_COUNT] = Post.objects.count() | |
24 |
|
27 | |||
|
28 | params[PARAM_POST_PER_DAY] = Post.objects.get_post_per_days(1) | |||
|
29 | params[PARAM_POST_PER_WEEK] = Post.objects.get_post_per_days(7) | |||
|
30 | params[PARAM_POST_PER_MONTH] = Post.objects.get_post_per_days(30) | |||
|
31 | ||||
25 | return render(request, 'boards/authors.html', params) |
|
32 | return render(request, 'boards/authors.html', params) | |
26 |
|
33 | |||
27 | @cached_result() |
|
34 | @cached_result() |
General Comments 0
You need to be logged in to leave comments.
Login now