Compare commits

...

16 commits

Author SHA1 Message Date
bb0cf871ec Merge pull request 'Oddělení sousových věcí' (!56) from split_sous into master
Reviewed-on: #56
2024-10-22 22:15:14 +02:00
3db6231a77 Název id v url 2024-10-22 22:11:59 +02:00
d5d55d76a9 Lepší komentář 2024-10-22 21:57:01 +02:00
0423bce762 Merge branch 'master' into split_sous
# Conflicts:
#	seminar/testutils.py
#	soustredeni/urls.py
2024-10-22 21:49:15 +02:00
b41b912aa4 Merge branch 'refs/heads/master' into split_sous 2024-08-06 02:39:08 +02:00
4a3681b1a6 Drobnost 2024-08-02 20:32:07 +02:00
ccf3ec07f7 Generování konfer s konkrétními řešiteli 2024-08-02 20:17:31 +02:00
b44bdadb0a Odstraněn zakomentovaný zbytečně složitý kód 2024-08-02 20:15:02 +02:00
a6220e8d50 Typové anotace a další detaily v generování testdat k soustredeni 2024-08-02 20:13:45 +02:00
27beb34153 Oddělení generování testdat k sous věcem 2024-08-02 19:38:06 +02:00
62a65af40e Odstranění zbytečného importu 2024-08-02 19:29:13 +02:00
036af434c6 Oddělení urlpatterns konkrétního sousu 2024-08-02 19:25:25 +02:00
d1db1b952f Obsah modulu soustredeni 2024-08-02 19:17:49 +02:00
ddda7052ae Zbavení se zbytečného importu modelu Resitel 2024-08-02 19:17:11 +02:00
0fa2fb8e2b Úprava importů v soustredeni 2024-08-02 19:01:50 +02:00
b094347b7c Vytažení prefixu 'soustredeni/' do aplikace soustredeni 2024-08-02 18:34:05 +02:00
5 changed files with 55 additions and 45 deletions

View file

@ -1,5 +1,4 @@
from django import forms from django import forms
from seminar.models import Soustredeni
class KomentarForm(forms.Form): class KomentarForm(forms.Form):
komentar = forms.CharField(label = "Komentář:", max_length = 300, required=False) komentar = forms.CharField(label = "Komentář:", max_length = 300, required=False)

View file

@ -30,7 +30,7 @@ urlpatterns = [
path('', include('prednasky.urls')), path('', include('prednasky.urls')),
# Soustredkova aplikace (ma vlastni podadresare) # Soustredkova aplikace (ma vlastni podadresare)
path('', include('soustredeni.urls')), path('soustredeni/', include('soustredeni.urls')),
# Personalni aplikace (ma vlastni podadresare) # Personalni aplikace (ma vlastni podadresare)
# (profil, osobní údaje, ..., ne autentizace, viz dále) # (profil, osobní údaje, ..., ne autentizace, viz dále)

View file

@ -1,5 +1,4 @@
""" """
Obsahuje vše ( na přednášky) ohledně soustředění. Obsahuje vše ( na přednášky a galerie) ohledně soustředění,
tzn. převážně informace o účastech orgů a účastníků a o tom, kdo byl na které konfeře.
TODO stvrzenky? """
"""

View file

@ -2,44 +2,53 @@ from django.urls import path, include
from . import views from . import views
from personalni.utils import org_required from personalni.utils import org_required
# prefix = soustredeni/
urlpatterns = [ urlpatterns = [
path( path(
'soustredeni/probehlo/', 'probehlo/',
views.SoustredeniListView.as_view(), views.SoustredeniListView.as_view(),
name='seminar_seznam_soustredeni' name='seminar_seznam_soustredeni'
), ),
path( path(
'soustredeni/<int:soustredeni>/seznam_ucastniku', '<int:soustredeni>/',
org_required(views.SoustredeniUcastniciView.as_view()), include(
name='soustredeni_ucastnici' # prefix = 'soustredeni/<int:soustredeni>/'
), [
path( path(
'soustredeni/<int:soustredeni>/maily_ucastniku', 'seznam_ucastniku',
org_required(views.SoustredeniMailyUcastnikuView.as_view()), org_required(views.SoustredeniUcastniciView.as_view()),
name='maily_ucastniku' name='soustredeni_ucastnici'
), ),
path( path(
'soustredeni/<int:soustredeni>/export_ucastniku', 'maily_ucastniku',
org_required(views.soustredeniUcastniciExportView), org_required(views.SoustredeniMailyUcastnikuView.as_view()),
name='soustredeni_ucastnici_export' name='maily_ucastniku'
), ),
path( path(
'soustredeni/<int:soustredeni>/stvrzenky.pdf', 'export_ucastniku',
org_required(views.soustredeniStvrzenkyView), org_required(views.soustredeniUcastniciExportView),
name='soustredeni_ucastnici_stvrzenky' name='soustredeni_ucastnici_export'
), ),
path( path(
'soustredeni/<int:soustredeni>/obalky.pdf', 'stvrzenky.pdf',
org_required(views.soustredeniObalkyView), org_required(views.soustredeniStvrzenkyView),
name='seminar_soustredeni_obalky' name='soustredeni_ucastnici_stvrzenky'
), ),
path( path(
'soustredeni/<int:pk>/abstrakty', 'obalky.pdf',
org_required(views.SoustredeniAbstraktyView.as_view()), org_required(views.soustredeniObalkyView),
name='seminar_soustredeni_abstrakty' name='seminar_soustredeni_obalky'
), ),
path( path(
'soustredeni/<int:soustredeni>/fotogalerie/', 'abstrakty',
include('galerie.urls') org_required(views.SoustredeniAbstraktyView.as_view()),
), name='seminar_soustredeni_abstrakty'
),
path(
'fotogalerie/',
include('galerie.urls')
),
]
)
)
] ]

View file

@ -1,9 +1,8 @@
from django.shortcuts import get_object_or_404, render from django.shortcuts import get_object_or_404, render
from django.http import HttpResponse from django.http import HttpResponse
from django.views import generic from django.views import generic
from django.conf import settings
from django.contrib.staticfiles.finders import find from django.contrib.staticfiles.finders import find
from seminar.models import Soustredeni, Resitel, Soustredeni_Ucastnici, Nastaveni # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci
import csv import csv
import tempfile import tempfile
import shutil import shutil
@ -13,6 +12,9 @@ import http
import personalni.views import personalni.views
from .models import Soustredeni, Soustredeni_Ucastnici
from various.models import Nastaveni
class SoustredeniListView(generic.ListView): class SoustredeniListView(generic.ListView):
model = Soustredeni model = Soustredeni
@ -22,7 +24,7 @@ class SoustredeniListView(generic.ListView):
if not self.request.user.je_org: if not self.request.user.je_org:
return super().get_queryset() return super().get_queryset()
return ( return (
Soustredeni.objects super().get_queryset()
.prefetch_related( .prefetch_related(
"ucastnici", "ucastnici__osoba", "ucastnici", "ucastnici__osoba",
"organizatori", "organizatori__osoba", "organizatori", "organizatori__osoba",
@ -63,7 +65,7 @@ class SoustredeniUcastniciView(SoustredeniUcastniciBaseView):
def soustredeniUcastniciExportView(request, soustredeni): def soustredeniUcastniciExportView(request, soustredeni):
soustredeni = get_object_or_404(Soustredeni, id=soustredeni) soustredeni = get_object_or_404(Soustredeni, id=soustredeni)
ucastnici = Resitel.objects.filter(soustredeni=soustredeni) ucastnici = soustredeni.ucastnici.all()
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"'
@ -76,7 +78,7 @@ def soustredeniUcastniciExportView(request, soustredeni):
def soustredeniStvrzenkyView(request, soustredeni): def soustredeniStvrzenkyView(request, soustredeni):
soustredeni = get_object_or_404(Soustredeni, id=soustredeni) soustredeni = get_object_or_404(Soustredeni, id=soustredeni)
ucastnici = Resitel.objects.filter(soustredeni=soustredeni) ucastnici = soustredeni.ucastnici.all()
if ucastnici.count() == 0: if ucastnici.count() == 0:
return HttpResponse( return HttpResponse(
render(request, 'universal.html', { render(request, 'universal.html', {
@ -103,3 +105,4 @@ def soustredeniStvrzenkyView(request, soustredeni):
class SoustredeniAbstraktyView(generic.DetailView): class SoustredeniAbstraktyView(generic.DetailView):
model = Soustredeni model = Soustredeni
template_name = 'soustredeni/export_do_abstraktu.html' template_name = 'soustredeni/export_do_abstraktu.html'
pk_url_kwarg = 'soustredeni' # v url bude <int:soustredeni> místo defaultně požadovaného <int:pk>