gpp/port/views.py

20 lines
482 B
Python

from django.shortcuts import render
from django.http import HttpResponse
from .models import *
def index(request):
return HttpResponse("Hello, world.")
def ports_status(request):
"""
res = ''
ports = Port.objects.all()
li = lambda x: '<li>' + str(x)
res = ''.join(map(li, ports))
res = '<html><body><ul>' + res + '</ul></body></html>'
return HttpResponse(res)
"""
return render(request, 'port/ports_status.html', {'ports': Port.objects})