Browse Source

zmena CSV writeru

export_seznamu_prednasek
Martin Z. (Zimamazim) 5 years ago
parent
commit
7b4e7857b5
  1. 3
      seminar/views.py

3
seminar/views.py

@ -14,7 +14,6 @@ from django.contrib.auth import authenticate, login
from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici, Pohadka, Tema, Clanek from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici, Pohadka, Tema, Clanek
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva #from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
from . import utils from . import utils
from .unicodecsv import UnicodeWriter
from .forms import NameForm from .forms import NameForm
from datetime import timedelta, date, datetime from datetime import timedelta, date, datetime
@ -629,7 +628,7 @@ def soustredeniUcastniciExportView(request,soustredeni):
response = HttpResponse(content_type='text/csv') response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="ucastnici.csv"' response['Content-Disposition'] = 'attachment; filename="ucastnici.csv"'
writer = UnicodeWriter(response) writer = csv.writer(response)
writer.writerow(["jmeno", "prijmeni", "rok_maturity", "telefon", "email", "ulice", "mesto", "psc","stat"]) writer.writerow(["jmeno", "prijmeni", "rok_maturity", "telefon", "email", "ulice", "mesto", "psc","stat"])
for u in ucastnici: for u in ucastnici:
writer.writerow([u.jmeno, u.prijmeni, str(u.rok_maturity), u.telefon, u.email, u.ulice, u.mesto, u.psc, u.stat.name]) writer.writerow([u.jmeno, u.prijmeni, str(u.rok_maturity), u.telefon, u.email, u.ulice, u.mesto, u.psc, u.stat.name])

Loading…
Cancel
Save