|
@ -4,6 +4,7 @@ from django.shortcuts import get_object_or_404, render, redirect |
|
|
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, JsonResponse |
|
|
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, JsonResponse |
|
|
from django.urls import reverse,reverse_lazy |
|
|
from django.urls import reverse,reverse_lazy |
|
|
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist |
|
|
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist |
|
|
|
|
|
from django.core.mail import send_mail |
|
|
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,HttpResponseBadRequest,HttpResponseRedirect |
|
|
from django.http import Http404,HttpResponseBadRequest,HttpResponseRedirect |
|
@ -1057,6 +1058,21 @@ class NahrajReseniView(LoginRequiredMixin, CreateView): |
|
|
|
|
|
|
|
|
prilohy.instance = self.object |
|
|
prilohy.instance = self.object |
|
|
prilohy.save() |
|
|
prilohy.save() |
|
|
|
|
|
|
|
|
|
|
|
# Pošleme mail opravovatelům a garantovi |
|
|
|
|
|
# FIXME: Nechat spočítat databázi? Je to pár dotazů (pravděpodobně), takže to za to možná nestojí |
|
|
|
|
|
prijemci = set() |
|
|
|
|
|
for prob in form.cleaned_data['problem']: |
|
|
|
|
|
prijemci.update(prob.opravovatele.all()) |
|
|
|
|
|
prijemci.add(prob.garant) |
|
|
|
|
|
# FIXME: Možná poslat mail i relevantním orgům nadproblémů? |
|
|
|
|
|
# FIXME: Víc informativní obsah mailů, možná vč. příloh? |
|
|
|
|
|
send_mail( |
|
|
|
|
|
subject="Nové řešení k problému", |
|
|
|
|
|
message=f"Řešitel poslal řešení...", |
|
|
|
|
|
from_email="submitovatko@mam.mff.cuni.cz", # FIXME: Chceme to mít radši tady, nebo v nastavení? |
|
|
|
|
|
recipient_list=list(prijemci), |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
return HttpResponseRedirect(self.get_success_url()) |
|
|
return HttpResponseRedirect(self.get_success_url()) |
|
|
|
|
|
|
|
@ -1223,6 +1239,8 @@ class PasswordResetView(auth_views.PasswordResetView): |
|
|
# TODO: vlastní email_template_name a subject_template_name a html_email_template_name |
|
|
# TODO: vlastní email_template_name a subject_template_name a html_email_template_name |
|
|
success_url = reverse_lazy('reset_password_done') |
|
|
success_url = reverse_lazy('reset_password_done') |
|
|
from_email = 'login@mam.mff.cuni.cz' |
|
|
from_email = 'login@mam.mff.cuni.cz' |
|
|
|
|
|
email_template_name = 'seminar/registrace/password_reset_email.html' |
|
|
|
|
|
subject_template_name = 'seminar/registrace/password_reset_subject.txt' |
|
|
|
|
|
|
|
|
class PasswordResetDoneView(auth_views.PasswordResetDoneView): |
|
|
class PasswordResetDoneView(auth_views.PasswordResetDoneView): |
|
|
""" Poslali jsme e-mail (pokud bylo kam)). """ |
|
|
""" Poslali jsme e-mail (pokud bylo kam)). """ |
|
|