Browse Source

Fix špatné cesty k templatům profilu

middleware_test
Jonas Havelka 4 years ago
parent
commit
fb9da65c00
  1. 36
      seminar/templates/seminar/profil/edit.html
  2. 44
      seminar/templates/seminar/profil/prihlaska.html
  3. 20
      seminar/views/views_all.py

36
seminar/templates/seminar/profil/edit.html

@ -22,7 +22,7 @@
Přihlašovací údaje Přihlašovací údaje
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.username %} {% include "seminar/profil/prihlaska_field.html" with field=form.username %}
</table> </table>
<hr> <hr>
@ -31,12 +31,12 @@
Osobní údaje Osobní údaje
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.jmeno %} {% include "seminar/profil/prihlaska_field.html" with field=form.jmeno %}
{% include "seminar/prihlaska_field.html" with field=form.prijmeni %} {% include "seminar/profil/prihlaska_field.html" with field=form.prijmeni %}
{% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%} {% include "seminar/profil/prihlaska_field.html" with field=form.pohlavi_muz%}
{% include "seminar/prihlaska_field.html" with field=form.email %} {% include "seminar/profil/prihlaska_field.html" with field=form.email %}
{% include "seminar/prihlaska_field.html" with field=form.telefon %} {% include "seminar/profil/prihlaska_field.html" with field=form.telefon %}
{% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %} {% include "seminar/profil/prihlaska_field.html" with field=form.datum_narozeni %}
</table> </table>
<hr> <hr>
@ -45,11 +45,11 @@
Bydliště Bydliště
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.ulice %} {% include "seminar/profil/prihlaska_field.html" with field=form.ulice %}
{% include "seminar/prihlaska_field.html" with field=form.mesto %} {% include "seminar/profil/prihlaska_field.html" with field=form.mesto %}
{% include "seminar/prihlaska_field.html" with field=form.psc %} {% include "seminar/profil/prihlaska_field.html" with field=form.psc %}
{% include "seminar/prihlaska_field.html" with field=form.stat %} {% include "seminar/profil/prihlaska_field.html" with field=form.stat %}
{% include "seminar/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%} {% include "seminar/profil/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%}
</table> </table>
<hr> <hr>
@ -58,12 +58,12 @@
Škola Škola
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.skola %} {% include "seminar/profil/prihlaska_field.html" with field=form.skola %}
<tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr> <tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr>
<tr><td id="id_li_skola_vypln" colspan="2">Vyplň prosím celý název a adresu školy.</td></tr> <tr><td id="id_li_skola_vypln" colspan="2">Vyplň prosím celý název a adresu školy.</td></tr>
{% include "seminar/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %} {% include "seminar/profil/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %}
{% include "seminar/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %} {% include "seminar/profil/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %}
{% include "seminar/prihlaska_field.html" with field=form.rok_maturity %} {% include "seminar/profil/prihlaska_field.html" with field=form.rok_maturity %}
</table> </table>
<hr> <hr>
@ -72,7 +72,7 @@
Pošta Pošta
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.zasilat %} {% include "seminar/profil/prihlaska_field.html" with field=form.zasilat %}
</table> </table>
<hr> <hr>
@ -81,7 +81,7 @@
Zasílání propagačních materiálů Zasílání propagačních materiálů
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.spam %} {% include "seminar/profil/prihlaska_field.html" with field=form.spam %}
</table> </table>
<hr> <hr>

44
seminar/templates/seminar/profil/prihlaska.html

@ -24,9 +24,9 @@
Přihlašovací údaje Přihlašovací údaje
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.username %} {% include "seminar/profil/prihlaska_field.html" with field=form.username %}
{% include "seminar/prihlaska_field.html" with field=form.password %} {% include "seminar/profil/prihlaska_field.html" with field=form.password %}
{% include "seminar/prihlaska_field.html" with field=form.password_check %} {% include "seminar/profil/prihlaska_field.html" with field=form.password_check %}
</table> </table>
<hr> <hr>
@ -35,12 +35,12 @@
Osobní údaje Osobní údaje
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.jmeno %} {% include "seminar/profil/prihlaska_field.html" with field=form.jmeno %}
{% include "seminar/prihlaska_field.html" with field=form.prijmeni %} {% include "seminar/profil/prihlaska_field.html" with field=form.prijmeni %}
{% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%} {% include "seminar/profil/prihlaska_field.html" with field=form.pohlavi_muz%}
{% include "seminar/prihlaska_field.html" with field=form.email %} {% include "seminar/profil/prihlaska_field.html" with field=form.email %}
{% include "seminar/prihlaska_field.html" with field=form.telefon %} {% include "seminar/profil/prihlaska_field.html" with field=form.telefon %}
{% include "seminar/prihlaska_field.html" with field=form.datum_narozeni %} {% include "seminar/profil/prihlaska_field.html" with field=form.datum_narozeni %}
</table> </table>
<hr> <hr>
@ -49,11 +49,11 @@
Bydliště Bydliště
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.ulice %} {% include "seminar/profil/prihlaska_field.html" with field=form.ulice %}
{% include "seminar/prihlaska_field.html" with field=form.mesto %} {% include "seminar/profil/prihlaska_field.html" with field=form.mesto %}
{% include "seminar/prihlaska_field.html" with field=form.psc %} {% include "seminar/profil/prihlaska_field.html" with field=form.psc %}
{% include "seminar/prihlaska_field.html" with field=form.stat %} {% include "seminar/profil/prihlaska_field.html" with field=form.stat %}
{% include "seminar/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%} {% include "seminar/profil/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%}
</table> </table>
<hr> <hr>
@ -62,12 +62,12 @@
Škola Škola
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.skola %} {% include "seminar/profil/prihlaska_field.html" with field=form.skola %}
<tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr> <tr><td colspan="2" ><button id="id_skola_text_button" type="button">Škola není v seznamu</button></td></tr>
<tr><td id="id_li_skola_vypln" colspan="2">Vyplň prosím celý název a adresu školy.</td></tr> <tr><td id="id_li_skola_vypln" colspan="2">Vyplň prosím celý název a adresu školy.</td></tr>
{% include "seminar/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %} {% include "seminar/profil/prihlaska_field.html" with field=form.skola_nazev id="id_li_skola_nazev" %}
{% include "seminar/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %} {% include "seminar/profil/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %}
{% include "seminar/prihlaska_field.html" with field=form.rok_maturity %} {% include "seminar/profil/prihlaska_field.html" with field=form.rok_maturity %}
</table> </table>
<hr> <hr>
@ -76,16 +76,16 @@
Pošta Pošta
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.zasilat %} {% include "seminar/profil/prihlaska_field.html" with field=form.zasilat %}
</table> </table>
<hr> <hr>
<h4> <h4>
GDPR GDPR
</h4> </h4>
{% include "seminar/gdpr.html" %} {% include "seminar/profil/gdpr.html" %}
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.gdpr %} {% include "seminar/profil/prihlaska_field.html" with field=form.gdpr %}
</table> </table>
<hr> <hr>
@ -94,7 +94,7 @@
Zasílání propagačních materiálů Zasílání propagačních materiálů
</h4> </h4>
<table class="form"> <table class="form">
{% include "seminar/prihlaska_field.html" with field=form.spam %} {% include "seminar/profil/prihlaska_field.html" with field=form.spam %}
</table> </table>

20
seminar/views/views_all.py

@ -987,7 +987,7 @@ def StavDatabazeView(request):
class ResitelView(LoginRequiredMixin,generic.DetailView): class ResitelView(LoginRequiredMixin,generic.DetailView):
model = Resitel model = Resitel
template_name = 'seminar/resitel.html' template_name = 'seminar/profil/resitel.html'
def get_object(self, queryset=None): def get_object(self, queryset=None):
print(self.request.user) print(self.request.user)
@ -1002,7 +1002,7 @@ class AddSolutionView(LoginRequiredMixin, FormView):
class NahrajReseniView(LoginRequiredMixin, CreateView): class NahrajReseniView(LoginRequiredMixin, CreateView):
model = s.Reseni model = s.Reseni
template_name = 'seminar/nahraj_reseni.html' template_name = 'seminar/profil/nahraj_reseni.html'
form_class = f.NahrajReseniForm form_class = f.NahrajReseniForm
success_url = '/' success_url = '/'
@ -1049,19 +1049,19 @@ def loginView(request):
return HttpResponseRedirect('/') return HttpResponseRedirect('/')
else: else:
return render(request, return render(request,
'seminar/login.html', 'seminar/profil/login.html',
{'form': form, 'login_error': 'Neplatné jméno nebo heslo'}) {'form': form, 'login_error': 'Neplatné jméno nebo heslo'})
else: else:
form = LoginForm() form = LoginForm()
return render(request, 'seminar/login.html', {'form': form}) return render(request, 'seminar/profil/login.html', {'form': form})
def logoutView(request): def logoutView(request):
form = LoginForm() form = LoginForm()
if request.user.is_authenticated: if request.user.is_authenticated:
logout(request) logout(request)
return render(request, 'seminar/login.html', {'form': form, 'login_error': 'Byli jste úspěšně odhlášeni'}) return render(request, 'seminar/profil/login.html', {'form': form, 'login_error': 'Byli jste úspěšně odhlášeni'})
return render(request, 'seminar/login.html', {'form': form}) return render(request, 'seminar/profil/login.html', {'form': form})
def prihlaska_log_gdpr_safe(logger, gdpr_logger, msg, form_data): def prihlaska_log_gdpr_safe(logger, gdpr_logger, msg, form_data):
@ -1121,7 +1121,7 @@ def resitelEditView(request):
return HttpResponseRedirect('/thanks/') return HttpResponseRedirect('/thanks/')
else: else:
## Stránka před odeslaním formuláře = předvyplněný formulář ## Stránka před odeslaním formuláře = předvyplněný formulář
return render(request, 'seminar/edit.html', {'form': form}) return render(request, 'seminar/profil/edit.html', {'form': form})
def prihlaskaView(request): def prihlaskaView(request):
generic_logger = logging.getLogger('seminar.prihlaska') generic_logger = logging.getLogger('seminar.prihlaska')
@ -1192,12 +1192,12 @@ def prihlaskaView(request):
else: else:
form = PrihlaskaForm() form = PrihlaskaForm()
return render(request, 'seminar/prihlaska.html', {'form': form}) return render(request, 'seminar/profil/prihlaska.html', {'form': form})
# FIXME: Tohle asi vlastně vůbec nepatří do aplikace 'seminar' # FIXME: Tohle asi vlastně vůbec nepatří do aplikace 'seminar'
class LoginView(auth_views.LoginView): class LoginView(auth_views.LoginView):
# Jen vezmeme vestavěný a dáme mu vhodný template a přesměrovací URL # Jen vezmeme vestavěný a dáme mu vhodný template a přesměrovací URL
template_name = 'seminar/login.html' template_name = 'seminar/profil/login.html'
# Přesměrovací URL má být v kontextu: # Přesměrovací URL má být v kontextu:
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
@ -1207,7 +1207,7 @@ class LoginView(auth_views.LoginView):
class LogoutView(auth_views.LogoutView): class LogoutView(auth_views.LogoutView):
# Jen vezmeme vestavěný a dáme mu vhodný template a přesměrovací URL # Jen vezmeme vestavěný a dáme mu vhodný template a přesměrovací URL
template_name = 'seminar/logout.html' template_name = 'seminar/profil/logout.html'
# Pavel: Vůbec nevím, proč to s _lazy funguje, ale bez toho to bylo rozbité. # Pavel: Vůbec nevím, proč to s _lazy funguje, ale bez toho to bylo rozbité.
next_page = reverse_lazy('titulni_strana') next_page = reverse_lazy('titulni_strana')

Loading…
Cancel
Save