Pavel "LEdoian" Turinsky
3 years ago
3 changed files with 20 additions and 0 deletions
@ -0,0 +1,15 @@ |
|||
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) |
|||
|
Loading…
Reference in new issue