update view, show location info
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user