make global stats optional
This commit is contained in:
Родитель
a63ee43de4
Коммит
79bb14e579
|
@ -6,6 +6,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block site_stats %}
|
||||
{% if downloads and pings %}
|
||||
<ul class="stats">
|
||||
<li>
|
||||
<a href="{{ url('statistics.dashboard') }}">
|
||||
|
@ -26,6 +27,7 @@
|
|||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% set view_all = {
|
||||
|
|
|
@ -64,9 +64,12 @@ class HomepageFilter(object):
|
|||
|
||||
|
||||
def home(request):
|
||||
gs = GlobalStat.objects
|
||||
downloads = gs.filter(name='addon_total_downloads').latest()
|
||||
pings = gs.filter(name='addon_total_updatepings').latest()
|
||||
try:
|
||||
gs = GlobalStat.objects
|
||||
downloads = gs.filter(name='addon_total_downloads').latest()
|
||||
pings = gs.filter(name='addon_total_updatepings').latest()
|
||||
except GlobalStat.DoesNotExist:
|
||||
downloads = pings = None
|
||||
|
||||
q = Collection.objects.filter(listed=True, application=request.APP.id)
|
||||
collections = q.order_by('-weekly_subscribers')[:3]
|
||||
|
|
Загрузка…
Ссылка в новой задаче