22 lines
692 B
Python
22 lines
692 B
Python
|
from django.shortcuts import render
|
||
|
from django.http import HttpResponse
|
||
|
from django.template import loader
|
||
|
from django.core import serializers
|
||
|
from .models import Glos,Komitet
|
||
|
|
||
|
|
||
|
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_id': okreg_id,
|
||
|
'okreg_list': g,
|
||
|
'okreg_name': g[0].okreg.name,
|
||
|
'glosy_json': serializers.serialize('json', g),
|
||
|
'komitety': serializers.serialize('json', Komitet.objects.all())
|
||
|
}
|
||
|
return HttpResponse(template.render(context, request))
|