move code to use generic views

This commit is contained in:
2017-04-27 08:04:44 +02:00
parent b04e642daa
commit dc09be5a43
4 changed files with 83 additions and 9 deletions

View File

@@ -10,6 +10,27 @@ from django.db.models import Min, Sum
from django.http import HttpResponse
class LocationListView(generic.ListView):
template_name = 'billard/location_list.html'
context_object_name = 'location_list'
def get_queryset(self):
"""Return the last five published questions."""
return Location.objects.filter(users__id=self.request.user.id).order_by('code')
class LocationDetailView(generic.ListView):
template_name = 'billard/location_list.html'
context_object_name = 'location_list'
def get_queryset(self):
"""Return the last five published questions."""
return Location.objects.filter(users__id=self.request.user.id).order_by('code')
# TODO OLD CODE, CLEAN UP
class LocationDataViewSet(viewsets.ModelViewSet):
queryset = LocationData.objects.all()
serializer_class = LocationDataSerializer
@@ -143,6 +164,18 @@ def index(request):
return resp
#@login_required
#@permission_required('billard.change_accounting')
class AccountingView(generic.ListView):
template_name = 'billard/accounting.html'
context_object_name = 'accounting'
def get_queryset(self):
return Accounting.objects.filter(billed=False).exclude(time_to__isnull=True)\
#.\
#filter(desk__client__location_id=loc).order_by('-time_from')
def process_locationdata(request):
process_location_data()
return HttpResponse('DONE')