pridano ucastnici
This commit is contained in:
parent
4912349577
commit
c780e7e35f
2 changed files with 17 additions and 4 deletions
|
@ -11,6 +11,7 @@
|
|||
<option value="2">Řešitelé ročníku</option>
|
||||
<option value="3">Všichni řešitelé, kteří ještě neodmaturovali</option>
|
||||
<option value="4">Organizátoři soustředění</option>
|
||||
<option value="5">Účastníci soustředění</option>
|
||||
</select>
|
||||
|
||||
<select name="select-two" id="select-two">
|
||||
|
|
|
@ -147,7 +147,9 @@ class OrgoRozcestnikView(TemplateView):
|
|||
class PrvniTypExportu(Enum):
|
||||
CISLA = 1
|
||||
ROCNIKU = 2
|
||||
SOUSTREDENI = 4
|
||||
SOUSTREDENI_ORG = 4
|
||||
SOUSTREDENI_UCASTNICI = 5
|
||||
|
||||
|
||||
class ExportLidiView(TemplateView):
|
||||
template_name = 'personalni/profil/export_lidi.html'
|
||||
|
@ -163,7 +165,9 @@ def get_export_options(request, type):
|
|||
data = [{"id": c.id, "display": str(c)} for c in Cislo.objects.all()]
|
||||
if type == PrvniTypExportu.ROCNIKU.value:
|
||||
data = [{"id": r.id, "display": str(r)} for r in Rocnik.objects.all()]
|
||||
if type == PrvniTypExportu.SOUSTREDENI.value:
|
||||
if type == PrvniTypExportu.SOUSTREDENI_ORG.value:
|
||||
data = [{"id": s.id, "display": str(s)} for s in Soustredeni.objects.all()]
|
||||
if type == PrvniTypExportu.SOUSTREDENI_UCASTNICI.value:
|
||||
data = [{"id": s.id, "display": str(s)} for s in Soustredeni.objects.all()]
|
||||
return HttpResponse(json.dumps(data), content_type='application/json')
|
||||
|
||||
|
@ -184,14 +188,22 @@ def download_export_csv(request, type, id):
|
|||
name = str(Rocnik.objects.get(id=id)).replace(" ", "_") + "_resitele_rocniku.csv"
|
||||
response['Content-Disposition'] = 'attachment; filename="' + name + '"'
|
||||
return response
|
||||
if type == PrvniTypExportu.SOUSTREDENI.value:
|
||||
if type == PrvniTypExportu.SOUSTREDENI_ORG.value:
|
||||
soustredeni = Soustredeni.objects.get(id=id)
|
||||
organizatori = soustredeni.organizatori.all()
|
||||
organizatoriOsoby = Osoba.objects.filter(org__in=organizatori)
|
||||
response = dataOsobCsvResponse(organizatoriOsoby, columns=("jmeno", "prijmeni", "email", "telefon",))
|
||||
response = dataOsobCsvResponse(organizatoriOsoby, columns=("jmeno", "prijmeni", "email", "telefon", "ulice", "mesto", "psc",))
|
||||
name = str(soustredeni).replace(" ", "_") + "_organizatori_soustredeni.csv"
|
||||
response['Content-Disposition'] = 'attachment; filename="' + name + '"'
|
||||
return response
|
||||
if type == PrvniTypExportu.SOUSTREDENI_UCASTNICI.value:
|
||||
soustredeni = Soustredeni.objects.get(id=id)
|
||||
ucastnici = soustredeni.ucastnici.all()
|
||||
usaciOsoby = Osoba.objects.filter(resitel__in=ucastnici)
|
||||
response = dataOsobCsvResponse(usaciOsoby, columns=("jmeno", "prijmeni", "email", "telefon", "ulice", "mesto", "psc",))
|
||||
name = str(soustredeni).replace(" ", "_") + "_ucastnici_soustredeni.csv"
|
||||
response['Content-Disposition'] = 'attachment; filename="' + name + '"'
|
||||
return response
|
||||
|
||||
class ResitelView(LoginRequiredMixin,generic.DetailView):
|
||||
model = m.Resitel
|
||||
|
|
Loading…
Reference in a new issue