##// END OF EJS Templates
Added python version to stats page
neko259 -
r1721:dbf70afe default
parent child Browse files
Show More
@@ -1,37 +1,38
1 {% extends "boards/base.html" %}
1 {% extends "boards/base.html" %}
2
2
3 {% load i18n %}
3 {% load i18n %}
4 {% load static %}
4 {% load static %}
5
5
6 {% block head %}
6 {% block head %}
7 <title>{% trans "Authors" %}</title>
7 <title>{% trans "Authors" %}</title>
8 {% endblock %}
8 {% endblock %}
9
9
10 {% block content %}
10 {% block content %}
11 <div class="post">
11 <div class="post">
12 <p><img src="{% static 'favicon.png' %}" width="200" /></p>
12 <p><img src="{% static 'favicon.png' %}" width="200" /></p>
13 <h2>{% trans 'Statistics' %}</h2>
13 <h2>{% trans 'Statistics' %}</h2>
14 <p>{% trans 'Size of media:' %} {{ media_size|filesizeformat }}.
14 <p>{% trans 'Size of media:' %} {{ media_size|filesizeformat }}.
15 <p>{% blocktrans count count=post_count %}{{ count }} message{% plural %}messages{% endblocktrans %}.</p>
15 <p>{% blocktrans count count=post_count %}{{ count }} message{% plural %}messages{% endblocktrans %}.</p>
16 <p>{% trans 'Messages per day/week/month:' %} {{ post_per_day }}/{{ post_per_week }}/{{ post_per_month }}</p>
16 <p>{% trans 'Messages per day/week/month:' %} {{ post_per_day }}/{{ post_per_week }}/{{ post_per_month }}</p>
17 <p>{{ platform }}</p>
17 <p>{{ platform }}</p>
18 <p>Python {{ python }}</p>
18 <h2>{% trans 'Authors' %}</h2>
19 <h2>{% trans 'Authors' %}</h2>
19 {% for nick, values in authors.items %}
20 {% for nick, values in authors.items %}
20 <p>
21 <p>
21 <b>{{ nick }}</b> ({{ values.name }}):
22 <b>{{ nick }}</b> ({{ values.name }}):
22 {% for value in values.contacts %}
23 {% for value in values.contacts %}
23 <a href="mailto:{{ value }}">{{ value }}</a>
24 <a href="mailto:{{ value }}">{{ value }}</a>
24 {% endfor %} -
25 {% endfor %} -
25 {{ values.roles|join:', ' }}
26 {{ values.roles|join:', ' }}
26 </p>
27 </p>
27 {% endfor %}
28 {% endfor %}
28 <br />
29 <br />
29 <p>{% trans "Distributed under the" %}
30 <p>{% trans "Distributed under the" %}
30 <a href="http://www.gnu.org/licenses/gpl.html" >GNU GPLv3</a>
31 <a href="http://www.gnu.org/licenses/gpl.html" >GNU GPLv3</a>
31 {% trans "license" %}</p>
32 {% trans "license" %}</p>
32 <p><a href="https://bitbucket.org/neko259/neboard">
33 <p><a href="https://bitbucket.org/neko259/neboard">
33 {% trans "Repository" %}</a></p>
34 {% trans "Repository" %}</a></p>
34
35
35 <p>Bitcoin: <b>1A4dePg6CGfYcJ7SH1tbaVdjjj1VLv8X1H</b></p>
36 <p>Bitcoin: <b>1A4dePg6CGfYcJ7SH1tbaVdjjj1VLv8X1H</b></p>
36 </div>
37 </div>
37 {% endblock %}
38 {% endblock %}
@@ -1,47 +1,52
1 import os
1 import os
2 import platform
2 import platform
3 import sys
3
4
4 from django.shortcuts import render
5 from django.shortcuts import render
5 from django.utils.decorators import method_decorator
6 from django.utils.decorators import method_decorator
6 from django.views.decorators.csrf import csrf_protect
7 from django.views.decorators.csrf import csrf_protect
7
8
8 import neboard
9 import neboard
9 from boards.authors import authors
10 from boards.authors import authors
10 from boards.utils import cached_result
11 from boards.utils import cached_result
11 from boards.views.base import BaseBoardView
12 from boards.views.base import BaseBoardView
12 from boards.models import Post
13 from boards.models import Post
13
14
14
15
15 PARAM_AUTHORS = 'authors'
16 PARAM_AUTHORS = 'authors'
16 PARAM_MEDIA_SIZE = 'media_size'
17 PARAM_MEDIA_SIZE = 'media_size'
17 PARAM_POST_COUNT = 'post_count'
18 PARAM_POST_COUNT = 'post_count'
18 PARAM_POST_PER_DAY = 'post_per_day'
19 PARAM_POST_PER_DAY = 'post_per_day'
19 PARAM_POST_PER_WEEK = 'post_per_week'
20 PARAM_POST_PER_WEEK = 'post_per_week'
20 PARAM_POST_PER_MONTH = 'post_per_month'
21 PARAM_POST_PER_MONTH = 'post_per_month'
21 PARAM_PLATFORM = 'platform'
22 PARAM_PLATFORM = 'platform'
23 PARAM_PYTHON = 'python'
22
24
23
25
24 class AuthorsView(BaseBoardView):
26 class AuthorsView(BaseBoardView):
25 @method_decorator(csrf_protect)
27 @method_decorator(csrf_protect)
26 def get(self, request):
28 def get(self, request):
27 params = dict()
29 params = dict()
28 params[PARAM_AUTHORS] = authors
30 params[PARAM_AUTHORS] = authors
29 params[PARAM_MEDIA_SIZE] = self._get_directory_size(neboard.settings.MEDIA_ROOT)
31 params[PARAM_MEDIA_SIZE] = self._get_directory_size(neboard.settings.MEDIA_ROOT)
30 params[PARAM_POST_COUNT] = Post.objects.count()
32 params[PARAM_POST_COUNT] = Post.objects.count()
31
33
32 params[PARAM_PLATFORM] = platform.platform()
34 params[PARAM_PLATFORM] = platform.platform()
35 python_version = sys.version_info
36 params[PARAM_PYTHON] = '{}.{}.{}'.format(python_version.major,
37 python_version.minor, python_version.micro)
33
38
34 params[PARAM_POST_PER_DAY] = Post.objects.get_post_per_days(1)
39 params[PARAM_POST_PER_DAY] = Post.objects.get_post_per_days(1)
35 params[PARAM_POST_PER_WEEK] = Post.objects.get_post_per_days(7)
40 params[PARAM_POST_PER_WEEK] = Post.objects.get_post_per_days(7)
36 params[PARAM_POST_PER_MONTH] = Post.objects.get_post_per_days(30)
41 params[PARAM_POST_PER_MONTH] = Post.objects.get_post_per_days(30)
37
42
38 return render(request, 'boards/authors.html', params)
43 return render(request, 'boards/authors.html', params)
39
44
40 @cached_result()
45 @cached_result()
41 def _get_directory_size(self, directory):
46 def _get_directory_size(self, directory):
42 total_size = 0
47 total_size = 0
43 for dirpath, dirnames, filenames in os.walk(directory):
48 for dirpath, dirnames, filenames in os.walk(directory):
44 for f in filenames:
49 for f in filenames:
45 fp = os.path.join(dirpath, f)
50 fp = os.path.join(dirpath, f)
46 total_size += os.path.getsize(fp)
51 total_size += os.path.getsize(fp)
47 return total_size
52 return total_size
General Comments 0
You need to be logged in to leave comments. Login now