Commit 973477f1 authored by Flavio TARSETTI's avatar Flavio TARSETTI

[ui][views] refactor supervisor new supervisee request

parent b8faad32
......@@ -48,7 +48,7 @@ from rest_framework.authtoken.models import Token
from .. import __version__
from ..accounts.models import Profile
from ..accounts.models import SupervisionTrack
from ..accounts.models import TemporaryUrl
from ..accounts.views import inform_supervisor_new_supervisee_request
from ..common.models import Shareable
from ..utils import mail
from .registration.forms import BlockedUserRevalidationForm
......@@ -150,31 +150,8 @@ def blocked_user_reactivation(request):
supervisee.save()
# Inform by email the supervisor that he has a new supervisee request
temp_url = TemporaryUrl.objects.create_temporary_url(
TemporaryUrl.VALIDATION, supervisiontrack
)
supervisor_validation_url = request.build_absolute_uri(
reverse(
"accounts:temp_url_validation",
kwargs={"hash_url": temp_url.url_hash},
)
)
contact_url = request.build_absolute_uri(
reverse("contact")
)
context = {
"supervisor": supervisor,
"supervisee": supervisee,
"supervisor_validation_url": supervisor_validation_url,
"contact_url": contact_url,
}
mail.send_email(
"registration/mail.supervisor_validation.subject.txt",
"registration/mail.supervisor_validation_supervisee_add_request.message.txt",
context,
[supervisor.email],
context = inform_supervisor_new_supervisee_request(
request, supervisiontrack, supervisor, supervisee
)
# inform the supervisee of his request
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment