ordynacje/ordynacja/views.py
2018-06-06 17:52:09 +02:00

18 lines
503 B
Python

from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from .models import Glos
def index(request):
return HttpResponse("This is main page. Here will be the map")
def okreg(request, okreg_id):
g = Glos.objects.filter(okreg__o_id=okreg_id)
template = loader.get_template('ordynacja/index.html')
context = {
'okreg_list': g,
'okreg_name': g[0].okreg.name
}
return HttpResponse(template.render(context, request))