You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

15 lines
628 B

import seminar.models as m
from django.core import serializers as ser
from django.http import HttpResponse
def exportSkolView(request):
# Některé fieldy nechceme: Kontaktní osoby, AESOP ID, org poznámky.
fields = ('id', 'izo', 'nazev', 'kratky_nazev', 'ulice', 'mesto', 'psc', 'stat', 'je_zs', 'je_ss')
# TODO: Použít JSONL, aby protistrana mohla číst po řádkách a nesežralo to tunu paměti úplně hned
skoly_json = ser.serialize("json", m.Skola.objects.all(), fields=fields)
response = HttpResponse(
content = skoly_json,
content_type = 'text/json',
reason = 'Here you go', # :-)
)
return(response)