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
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.username %}
{% include "seminar/profil/prihlaska_field.html" with field=form.username %}
</table>
<hr>
@ -31,12 +31,12 @@
Osobní údaje
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.jmeno %}
{% include "seminar/prihlaska_field.html" with field=form.prijmeni %}
{% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%}
{% include "seminar/prihlaska_field.html" with field=form.email %}
{% include "seminar/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.jmeno %}
{% include "seminar/profil/prihlaska_field.html" with field=form.prijmeni %}
{% include "seminar/profil/prihlaska_field.html" with field=form.pohlavi_muz%}
{% include "seminar/profil/prihlaska_field.html" with field=form.email %}
{% include "seminar/profil/prihlaska_field.html" with field=form.telefon %}
{% include "seminar/profil/prihlaska_field.html" with field=form.datum_narozeni %}
</table>
<hr>
@ -45,11 +45,11 @@
Bydliště
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.ulice %}
{% include "seminar/prihlaska_field.html" with field=form.mesto %}
{% include "seminar/prihlaska_field.html" with field=form.psc %}
{% include "seminar/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.ulice %}
{% include "seminar/profil/prihlaska_field.html" with field=form.mesto %}
{% include "seminar/profil/prihlaska_field.html" with field=form.psc %}
{% include "seminar/profil/prihlaska_field.html" with field=form.stat %}
{% include "seminar/profil/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%}
</table>
<hr>
@ -58,12 +58,12 @@
Škola
</h4>
<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 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/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.skola_nazev id="id_li_skola_nazev" %}
{% include "seminar/profil/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %}
{% include "seminar/profil/prihlaska_field.html" with field=form.rok_maturity %}
</table>
<hr>
@ -72,7 +72,7 @@
Pošta
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.zasilat %}
{% include "seminar/profil/prihlaska_field.html" with field=form.zasilat %}
</table>
<hr>
@ -81,7 +81,7 @@
Zasílání propagačních materiálů
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.spam %}
{% include "seminar/profil/prihlaska_field.html" with field=form.spam %}
</table>
<hr>

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

@ -24,9 +24,9 @@
Přihlašovací údaje
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.username %}
{% include "seminar/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.username %}
{% include "seminar/profil/prihlaska_field.html" with field=form.password %}
{% include "seminar/profil/prihlaska_field.html" with field=form.password_check %}
</table>
<hr>
@ -35,12 +35,12 @@
Osobní údaje
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.jmeno %}
{% include "seminar/prihlaska_field.html" with field=form.prijmeni %}
{% include "seminar/prihlaska_field.html" with field=form.pohlavi_muz%}
{% include "seminar/prihlaska_field.html" with field=form.email %}
{% include "seminar/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.jmeno %}
{% include "seminar/profil/prihlaska_field.html" with field=form.prijmeni %}
{% include "seminar/profil/prihlaska_field.html" with field=form.pohlavi_muz%}
{% include "seminar/profil/prihlaska_field.html" with field=form.email %}
{% include "seminar/profil/prihlaska_field.html" with field=form.telefon %}
{% include "seminar/profil/prihlaska_field.html" with field=form.datum_narozeni %}
</table>
<hr>
@ -49,11 +49,11 @@
Bydliště
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.ulice %}
{% include "seminar/prihlaska_field.html" with field=form.mesto %}
{% include "seminar/prihlaska_field.html" with field=form.psc %}
{% include "seminar/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.ulice %}
{% include "seminar/profil/prihlaska_field.html" with field=form.mesto %}
{% include "seminar/profil/prihlaska_field.html" with field=form.psc %}
{% include "seminar/profil/prihlaska_field.html" with field=form.stat %}
{% include "seminar/profil/prihlaska_field.html" with field=form.stat_text id="id_li_stat_text"%}
</table>
<hr>
@ -62,12 +62,12 @@
Škola
</h4>
<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 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/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.skola_nazev id="id_li_skola_nazev" %}
{% include "seminar/profil/prihlaska_field.html" with field=form.skola_adresa id="id_li_skola_adresa" %}
{% include "seminar/profil/prihlaska_field.html" with field=form.rok_maturity %}
</table>
<hr>
@ -76,16 +76,16 @@
Pošta
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.zasilat %}
{% include "seminar/profil/prihlaska_field.html" with field=form.zasilat %}
</table>
<hr>
<h4>
GDPR
</h4>
{% include "seminar/gdpr.html" %}
{% include "seminar/profil/gdpr.html" %}
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.gdpr %}
{% include "seminar/profil/prihlaska_field.html" with field=form.gdpr %}
</table>
<hr>
@ -94,7 +94,7 @@
Zasílání propagačních materiálů
</h4>
<table class="form">
{% include "seminar/prihlaska_field.html" with field=form.spam %}
{% include "seminar/profil/prihlaska_field.html" with field=form.spam %}
</table>

20
seminar/views/views_all.py

@ -987,7 +987,7 @@ def StavDatabazeView(request):
class ResitelView(LoginRequiredMixin,generic.DetailView):
model = Resitel
template_name = 'seminar/resitel.html'
template_name = 'seminar/profil/resitel.html'
def get_object(self, queryset=None):
print(self.request.user)
@ -1002,7 +1002,7 @@ class AddSolutionView(LoginRequiredMixin, FormView):
class NahrajReseniView(LoginRequiredMixin, CreateView):
model = s.Reseni
template_name = 'seminar/nahraj_reseni.html'
template_name = 'seminar/profil/nahraj_reseni.html'
form_class = f.NahrajReseniForm
success_url = '/'
@ -1049,19 +1049,19 @@ def loginView(request):
return HttpResponseRedirect('/')
else:
return render(request,
'seminar/login.html',
'seminar/profil/login.html',
{'form': form, 'login_error': 'Neplatné jméno nebo heslo'})
else:
form = LoginForm()
return render(request, 'seminar/login.html', {'form': form})
return render(request, 'seminar/profil/login.html', {'form': form})
def logoutView(request):
form = LoginForm()
if request.user.is_authenticated:
logout(request)
return render(request, 'seminar/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, 'login_error': 'Byli jste úspěšně odhlášeni'})
return render(request, 'seminar/profil/login.html', {'form': form})
def prihlaska_log_gdpr_safe(logger, gdpr_logger, msg, form_data):
@ -1121,7 +1121,7 @@ def resitelEditView(request):
return HttpResponseRedirect('/thanks/')
else:
## 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):
generic_logger = logging.getLogger('seminar.prihlaska')
@ -1192,12 +1192,12 @@ def prihlaskaView(request):
else:
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'
class LoginView(auth_views.LoginView):
# 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:
def get_context_data(self, **kwargs):
@ -1207,7 +1207,7 @@ class LoginView(auth_views.LoginView):
class LogoutView(auth_views.LogoutView):
# 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é.
next_page = reverse_lazy('titulni_strana')

Loading…
Cancel
Save