Browse Source

Pridana stranka uzivatele a dummy views

Dummy views - reset hesla, změna údajů
Absolutni URL prevedeny na reverse lookup.
export_seznamu_prednasek
parent
commit
4091e25ee1
  1. 6
      seminar/templates/seminar/login.html
  2. 2
      seminar/templates/seminar/prihlaska.html
  3. 17
      seminar/templates/seminar/resitel.html
  4. 9
      seminar/urls.py
  5. 14
      seminar/views.py

6
seminar/templates/seminar/login.html

@ -11,7 +11,7 @@
{% if login_error %} {% if login_error %}
<span class="field_error">{{login_error}}<span> <span class="field_error">{{login_error}}<span>
{% endif %} {% endif %}
<form action="/login/" method="post"> <form action="{% url 'login' %}" method="post">
{% csrf_token %} {% csrf_token %}
{{form.non_field_errors}} {{form.non_field_errors}}
<ul class="form"> <ul class="form">
@ -25,8 +25,8 @@
<input type="submit" value="Přihlásit"> <input type="submit" value="Přihlásit">
</form> </form>
<a href="/reset_password">Zapomněl jsem heslo</a><br> <a href="{% url 'reset_password' %}">Zapomněl jsem heslo</a><br>
<a href="/prihlaska">Zaregistrovat</a><br> <a href="{% url 'seminar_prihlaska' %}">Zaregistrovat</a><br>
{% endblock %} {% endblock %}

2
seminar/templates/seminar/prihlaska.html

@ -15,7 +15,7 @@
</h1> </h1>
<form action="/prihlaska/" method="post"> <form action="{% url 'seminar_prihlaska' %}" method="post">
{% csrf_token %} {% csrf_token %}
{{form.non_field_errors}} {{form.non_field_errors}}
<ul class="form"> <ul class="form">

17
seminar/templates/seminar/resitel.html

@ -0,0 +1,17 @@
{% extends "seminar/zadani/base.html" %}
{% load staticfiles %}
{% block content %}
<h1>
{% block nadpis1a %}{% block nadpis1b %}
Stránka řešitele - {{ object.osoba.jmeno }} {{ object.osoba.prijmeni }}
{% endblock %}{% endblock %}
</h1>
<a href="{% url 'logout' %}">Odhlásit se</a><br>
<a href="{% url 'seminar_resitel_edit' %}">Upravit údaje</a><br>
{% endblock %}

9
seminar/urls.py

@ -98,10 +98,13 @@ urlpatterns = [
staff_member_required(views.texUploadView), staff_member_required(views.texUploadView),
name='seminar_tex_upload' name='seminar_tex_upload'
), ),
path('prihlaska/',views.prihlaskaView, name='seminar_prihlaska'), path('auth/prihlaska/',views.prihlaskaView, name='seminar_prihlaska'),
path('login/', views.loginView, name='login'), path('auth/login/', views.loginView, name='login'),
path('logout/', views.logoutView, name='logout'), path('auth/logout/', views.logoutView, name='logout'),
path('auth/resitel/', views.ResitelView.as_view(), name='seminar_resitel'),
path('autocomplete/skola/',views.SkolaAutocomplete.as_view(), name='autocomplete_skola'), path('autocomplete/skola/',views.SkolaAutocomplete.as_view(), name='autocomplete_skola'),
path('auth/reset_password', views.resetPasswordView, name='reset_password'),
path('auth/resitel_edit', views.resitelEditView, name='seminar_resitel_edit'),
path('', views.TitulniStranaView.as_view(), name='titulni_strana'), path('', views.TitulniStranaView.as_view(), name='titulni_strana'),
# Ceka na autocomplete v3 # Ceka na autocomplete v3

14
seminar/views.py

@ -10,6 +10,7 @@ from django.http import Http404,HttpResponseBadRequest,HttpResponseRedirect
from django.db.models import Q from django.db.models import Q
from django.views.decorators.csrf import ensure_csrf_cookie from django.views.decorators.csrf import ensure_csrf_cookie
from django.contrib.auth import authenticate, login, get_user_model, logout from django.contrib.auth import authenticate, login, get_user_model, logout
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db import transaction from django.db import transaction
from dal import autocomplete from dal import autocomplete
@ -951,7 +952,20 @@ def texDownloadView(request, rocnik, cislo):
cislo.save() cislo.save()
return JsonResponse(response) return JsonResponse(response)
class ResitelView(LoginRequiredMixin,generic.DetailView):
model = Resitel
template_name = 'seminar/resitel.html'
def get_object(self, queryset=None):
print(self.request.user)
return Resitel.objects.get(osoba__user=self.request.user)
## Formulare ## Formulare
def resitelEditView(request):
pass
def resetPasswordView(request):
pass
def loginView(request): def loginView(request):
if request.method == 'POST': if request.method == 'POST':
form = LoginForm(request.POST) form = LoginForm(request.POST)

Loading…
Cancel
Save