startinblox-startinoff/server/views.py

18 lines
693 B
Python

from django.http.response import HttpResponse
from django.views.decorators.http import require_GET
from django.http.response import JsonResponse, HttpResponse
from django.views.decorators.http import require_GET, require_POST
from django.shortcuts import render, get_object_or_404
from webpush import send_user_notification
from django.conf import settings
from djangoldp_webpushnotification import models
import json
@require_GET
def home(request):
webpush_settings = getattr(settings, 'WEBPUSH_SETTINGS', {})
vapid_key = models.VAPIDKeyset.objects.first().public_key.decode("utf-8")
user = request.user
return render(request, 'home.html', {user: user, 'vapid_key': vapid_key})