Fix: Problém: jen orgové si mohou zobrazit návrh
This commit is contained in:
parent
dbc5b84ce8
commit
62e7f1dfbc
3 changed files with 9 additions and 10 deletions
|
@ -3,7 +3,7 @@
|
||||||
{% load comments %}
|
{% load comments %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div {% if not problem.verejne and user.is_staff %}class="mam-org-only"{% endif %}>
|
||||||
{% block problem %}
|
{% block problem %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,10 @@
|
||||||
</h2>
|
</h2>
|
||||||
{% if problem.cislo_zadani %}
|
{% if problem.cislo_zadani %}
|
||||||
<p>Zadáno v čísle <a href='{{ problem.cislo_zadani.verejne_url }}'>{{ problem.cislo_zadani.kod }}</a>.
|
<p>Zadáno v čísle <a href='{{ problem.cislo_zadani.verejne_url }}'>{{ problem.cislo_zadani.kod }}</a>.
|
||||||
{% if problem.cislo_reseni %}
|
|
||||||
<p>Řešeno v čísle <a href='{{ problem.cislo_reseni.verejne_url }}'>{{ problem.cislo_reseni.kod }}</a>.
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
{# TODO ? #}
|
|
||||||
<h2>Problém {{ problem.nazev }}</h2>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if problem.cislo_reseni %}
|
||||||
|
<p>Řešeno v čísle <a href='{{ problem.cislo_reseni.verejne_url }}'>{{ problem.cislo_reseni.kod }}</a>.
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h3>Zadání</h3>
|
<h3>Zadání</h3>
|
||||||
{{ problem.text_zadani |safe }}
|
{{ problem.text_zadani |safe }}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# coding:utf-8
|
# coding:utf-8
|
||||||
|
|
||||||
from django.shortcuts import get_object_or_404, render
|
from django.shortcuts import get_object_or_404, render
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.views import generic
|
from django.views import generic
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
|
@ -235,11 +235,14 @@ class ProblemView(generic.DetailView):
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(ProblemView, self).get_context_data(**kwargs)
|
context = super(ProblemView, self).get_context_data(**kwargs)
|
||||||
|
if not context['problem'].verejne() and not self.request.user.is_staff:
|
||||||
|
raise PermissionDenied()
|
||||||
if context['problem'].typ == Problem.TYP_RES_CLANEK:
|
if context['problem'].typ == Problem.TYP_RES_CLANEK:
|
||||||
context['reseni'] = Reseni.objects.filter(problem=context['problem']).select_related('resitel').order_by('resitel__prijmeni')
|
context['reseni'] = Reseni.objects.filter(problem=context['problem']).select_related('resitel').order_by('resitel__prijmeni')
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RadekVysledkovky(object):
|
class RadekVysledkovky(object):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue