|
@@ -1,13 +1,23 @@
|
|
|
from django.conf import settings
|
|
|
-from django.shortcuts import render, redirect
|
|
|
from django.http import JsonResponse
|
|
|
+from django.shortcuts import redirect, render
|
|
|
from django.views.decorators.csrf import csrf_exempt
|
|
|
+from django.views.generic import TemplateView
|
|
|
|
|
|
-from .models import RapportoRicezione, User, TipoRadio
|
|
|
+from .models import RapportoRicezione, TipoRadio, User
|
|
|
|
|
|
# Create your views here.
|
|
|
|
|
|
|
|
|
+class ViewMap(TemplateView):
|
|
|
+ template_name = "index.html"
|
|
|
+
|
|
|
+ def get_context_data(self, **kwargs):
|
|
|
+ ctx = super().get_context_data(**kwargs)
|
|
|
+ ctx["tipiradio"] = TipoRadio.objects.all()
|
|
|
+ return ctx
|
|
|
+
|
|
|
+
|
|
|
def add_page(request):
|
|
|
# TODO: replace with /api/tipiradio/get etc.
|
|
|
return render(
|
|
@@ -42,7 +52,7 @@ def rapporto_add(request):
|
|
|
lng=float(request.POST["lng"]),
|
|
|
comprensibile=int(request.POST["comprensibile"]),
|
|
|
stabilita=int(request.POST["stabilita"]),
|
|
|
- indirizzo=request.POST.get('indirizzo', ''),
|
|
|
+ indirizzo=request.POST.get("indirizzo", ""),
|
|
|
tipo_radio=TipoRadio.objects.get(pk=request.POST["tiporadio"]),
|
|
|
)
|
|
|
r.save()
|