diff --git a/gw2raidar/settings.py b/gw2raidar/settings.py index a0fdfcc8..e9481edd 100644 --- a/gw2raidar/settings.py +++ b/gw2raidar/settings.py @@ -37,6 +37,8 @@ # (it can be set in `settings_local.py`) ALLOWED_HOSTS = [] +INTERNAL_IPS = ['127.0.0.1'] + # Application definition @@ -160,3 +162,8 @@ from .settings_local import * except ImportError: pass + +if DEBUG: + if importlib.util.find_spec("debug_toolbar"): + INSTALLED_APPS.append('debug_toolbar') + MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware') diff --git a/raidar/admin.py b/raidar/admin.py index 351416f9..72b8718f 100644 --- a/raidar/admin.py +++ b/raidar/admin.py @@ -81,6 +81,7 @@ def url_id_link(self, obj): search_fields = ('=url_id', '=filename', '^area__name', '=characters__name', '^characters__account__name', '=characters__account__user__username', '=tags__name', '=category__name') list_display = ('filename', 'url_id_link', 'area', 'success', 'category', 'started_at', 'duration', 'uploaded_at', 'uploaded_by') + list_select_related = ('category', 'uploaded_by', 'area') inlines = (ParticipationInline,) readonly_fields = ('url_id', 'started_at', 'duration', 'uploaded_at', 'uploaded_by', 'area', 'filename') diff --git a/raidar/urls.py b/raidar/urls.py index 9926ae41..d1f21fd6 100644 --- a/raidar/urls.py +++ b/raidar/urls.py @@ -1,6 +1,7 @@ from django.conf import settings -from django.conf.urls import url +from django.conf.urls import url, include from django.contrib.auth import views as auth_views +import importlib from . import views @@ -30,3 +31,9 @@ url(r'^$', views.index, name = "index"), url(r'^global_stats(?:/(?P[0-9]+))?(?:/area-(?P[0-9]+))?(?P\.json)?$', views.global_stats, name = "global_stats"), ] + +if settings.DEBUG and importlib.util.find_spec('debug_toolbar'): + import debug_toolbar + urlpatterns = [ + url(r'^__debug__/', include(debug_toolbar.urls)), + ] + urlpatterns diff --git a/raidar/views.py b/raidar/views.py index 0a7f62fc..bb22cb1e 100644 --- a/raidar/views.py +++ b/raidar/views.py @@ -532,7 +532,7 @@ def profile_graph(request): stat = request.POST['stat'] participations = Participation.objects.select_related('encounter').filter( - encounter__era_id=era_id, character__account__user=request.user) + encounter__era_id=era_id, character__account__user=request.user, encounter__success=True) try: if area_id.startswith('All'):