add an index view

This commit is contained in:
Andreas Zweili 2017-12-25 00:37:52 +01:00
parent 6d0231f9f6
commit d4a20bd57d
2 changed files with 20 additions and 0 deletions

View File

@ -376,6 +376,16 @@ admin.site.register(CronJob)
from django.shortcuts import get_object_or_404, render
def index(request):
device_list = Device.objects.all()
computer_list = Computer.objects.all()
return render(request,
'inventory/index.html',
{'device_list': category_list,
'computer_list': computer_list})
#+END_SRC
* Templates
Templates define the look of the application and where things get

View File

@ -1,2 +1,12 @@
#!/usr/bin/python3
from django.shortcuts import get_object_or_404, render
def index(request):
device_list = Device.objects.all()
computer_list = Computer.objects.all()
return render(request,
'inventory/index.html',
{'device_list': category_list,
'computer_list': computer_list})