update view, show location info

This commit is contained in:
2017-02-01 18:57:29 +01:00
parent 48a912f04b
commit 90974ea783
6 changed files with 86 additions and 10353 deletions

View File

@@ -1,6 +1,7 @@
from billard.serializers import *
from .models import LocationData
from rest_framework import viewsets
from django.shortcuts import render
from django.views import generic
from django.views.generic.detail import DetailView
@@ -31,3 +32,20 @@ class IndexView(generic.ListView):
class LocationDataDetailView(DetailView):
model = LocationData
def index(request):
loc = 1
if request.POST:
loc = request.POST['location-selector']
locations = Location.objects.order_by('code')
clients = Client.objects.filter(location_id=loc).order_by('id')
context = {
'range': range(1, 3),
'locations': locations,
'clients': clients,
'location_id': int(loc),
}
return render(request, 'billard/index.html', context=context)