X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/566ee7cbbf5ad86cc0fe154a4c592c522d97ead2..6c92937de5aaa2cae84e7e397657c3f44a6b62fb:/wtem/views.py?ds=sidebyside diff --git a/wtem/views.py b/wtem/views.py index baacf44..1d1074c 100644 --- a/wtem/views.py +++ b/wtem/views.py @@ -46,6 +46,8 @@ def form(request, submission_id, key): state = CompetitionState.get_state() if state == CompetitionState.DURING: state = 'single' + if request.META['REMOTE_ADDR'] in getattr(settings, 'WTEM_CONTEST_IP_ALLOW', []): + state = 'single' return globals()['form_' + state](request, submission_id, key) @@ -130,9 +132,11 @@ def form_single(request, submission_id, key): except ValueError as e: if e.message == 'wrong exercise id': messages.error(request, u'Próba wysłania odpowiedzi ponownie lub poza kolejnością') + elif e.message == 'no answer': + messages.error(request, u'Wybierz przynajmniej jedną odpowiedź') return HttpResponseRedirect(reverse('wtem_form', kwargs={'submission_id': submission_id, 'key': key})) else: - raise Exception + raise Exception(u'Błędna wartość w formularzu') @cache_until_start @@ -171,4 +175,11 @@ def teacher_confirmation(request, id, key): if not was_confirmed: conf.confirmed = True conf.save() - return render(request, 'wtem/teacher_confirmed.html', {'confirmation': conf, 'was_confirmed': was_confirmed}) + from contact.forms import contact_forms + form_class = contact_forms['olimpiada'] + if not form_class.is_disabled(): + pass + return render(request, 'wtem/teacher_confirmed.html', { + 'confirmation': conf, + 'was_confirmed': was_confirmed, + })