Small fixes to admin & script
This commit is contained in:
parent
595d6cfd20
commit
ac0f4cee73
@ -44,6 +44,7 @@ class HitAdmin(admin.ModelAdmin):
|
|||||||
"heartbeats",
|
"heartbeats",
|
||||||
"tracker",
|
"tracker",
|
||||||
"load_time",
|
"load_time",
|
||||||
|
"location",
|
||||||
)
|
)
|
||||||
list_display_links = ("session",)
|
list_display_links = ("session",)
|
||||||
search_fields = ("initial", "tracker", "location", "referrer")
|
search_fields = ("initial", "tracker", "location", "referrer")
|
||||||
|
@ -7,8 +7,7 @@ window.onload = function () {
|
|||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open(
|
xhr.open(
|
||||||
"POST",
|
"POST",
|
||||||
self.location.protocol +
|
"{{protocol}}://{{request.site.domain|default:request.META.HTTP_HOST}}{{endpoint}}",
|
||||||
"//{{request.site.domain|default:request.META.HTTP_HOST}}{{endpoint}}",
|
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
xhr.setRequestHeader("Content-Type", "application/json");
|
xhr.setRequestHeader("Content-Type", "application/json");
|
||||||
|
@ -6,6 +6,7 @@ from django.shortcuts import render, reverse
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
from django.conf import settings
|
||||||
from django.views.generic import TemplateView, View
|
from django.views.generic import TemplateView, View
|
||||||
from ipware import get_client_ip
|
from ipware import get_client_ip
|
||||||
|
|
||||||
@ -64,6 +65,7 @@ class ScriptView(View):
|
|||||||
return resp
|
return resp
|
||||||
|
|
||||||
def get(self, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
|
protocol = "https" if settings.SCRIPT_USE_HTTPS else "http"
|
||||||
endpoint = (
|
endpoint = (
|
||||||
reverse(
|
reverse(
|
||||||
"ingress:endpoint_script",
|
"ingress:endpoint_script",
|
||||||
@ -81,7 +83,7 @@ class ScriptView(View):
|
|||||||
return render(
|
return render(
|
||||||
self.request,
|
self.request,
|
||||||
"analytics/scripts/page.js",
|
"analytics/scripts/page.js",
|
||||||
context={"endpoint": endpoint},
|
context={"endpoint": endpoint, "protocol": protocol},
|
||||||
content_type="application/javascript",
|
content_type="application/javascript",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ ACCOUNT_USERNAME_REQUIRED = False
|
|||||||
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
||||||
ACCOUNT_EMAIL_SUBJECT_PREFIX = ""
|
ACCOUNT_EMAIL_SUBJECT_PREFIX = ""
|
||||||
ACCOUNT_USER_DISPLAY = lambda k: k.email
|
ACCOUNT_USER_DISPLAY = lambda k: k.email
|
||||||
ACCOUNT_SIGNUPS_ENABLED = os.getenv("SIGNUPS_ENABLED", "False") == True
|
ACCOUNT_SIGNUPS_ENABLED = os.getenv("ACCOUNT_SIGNUPS_ENABLED", "False") == "True"
|
||||||
|
|
||||||
LOGIN_REDIRECT_URL = "/"
|
LOGIN_REDIRECT_URL = "/"
|
||||||
|
|
||||||
@ -247,8 +247,13 @@ else:
|
|||||||
|
|
||||||
# Shynet
|
# Shynet
|
||||||
|
|
||||||
ONLY_SUPERUSERS_CREATE = True
|
|
||||||
# Can everyone create services, or only superusers?
|
# Can everyone create services, or only superusers?
|
||||||
# Note that in the current version of Shynet, being able to edit a service allows
|
# Note that in the current version of Shynet, being able to edit a service allows
|
||||||
# you to see every registered user on the Shynet instance. This will be changed in
|
# you to see every registered user on the Shynet instance. This will be changed in
|
||||||
# a future version.
|
# a future version.
|
||||||
|
ONLY_SUPERUSERS_CREATE = os.getenv("ONLY_SUPERUSERS_CREATE", "True") == "True"
|
||||||
|
|
||||||
|
# Should the script use HTTPS to send the POST requests? The hostname is from
|
||||||
|
# the django SITE default. (Edit it using the admin panel.)
|
||||||
|
SCRIPT_USE_HTTPS = os.getenv("SCRIPT_USE_HTTPS", "True") == "True"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user