Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.web
Commits
680b9a38
Commit
680b9a38
authored
May 13, 2020
by
Flavio TARSETTI
Browse files
[accounts][api] notify supervisor of supervisee yearly revalidation
parent
ac029442
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/web/accounts/api.py
View file @
680b9a38
...
...
@@ -47,7 +47,9 @@ from ..common.utils import validate_restructuredtext
from
..ui.templatetags.markup
import
restructuredtext
from
.models
import
SupervisionTrack
,
Profile
from
.models
import
Profile
from
.models
import
SupervisionTrack
from
.models
import
TemporaryUrl
from
..common.models
import
Shareable
from
..common.exceptions
import
ShareError
from
..common.mixins
import
CommonContextMixin
...
...
@@ -490,10 +492,12 @@ class SuperviseeAddSupervisorView(BaseCreateSupervisionTrackViewSupervisee):
supervisee
.
save
()
#Inform by email the supervisor that he has a new supervisee request
temp_url
=
TemporaryUrl
.
objects
.
create_temporary_url
(
TemporaryUrl
.
VALIDATION
,
supervisiontrack
)
context
=
{
'supervisor'
:
supervisor
,
'supervisee'
:
supervisee
,
'prefix'
:
server_address
,
"temp_url"
:
temp_url
.
url_hash
,
}
mail
.
send_email
(
'registration/mail.supervisor_validation.subject.txt'
,
...
...
@@ -559,6 +563,27 @@ class SuperviseeReValidationView(BaseUpdateSupervisionTrackFromSuperviseeView):
supervisiontrack
.
save
()
supervisee
.
profile
.
save
()
supervisee
.
save
()
# Inform supervisor about supervisee revalidation
# Possible supervisor rejection available
parsed_url
=
urlparse
(
settings
.
URL_PREFIX
)
server_address
=
'%s://%s'
%
(
parsed_url
.
scheme
,
parsed_url
.
hostname
)
temp_url_rejection
=
TemporaryUrl
.
objects
.
create_temporary_url
(
TemporaryUrl
.
REJECTION
,
supervisiontrack
)
context
=
{
"supervisor"
:
supervisiontrack
.
supervisor
,
"supervisee"
:
supervisee
,
"prefix"
:
server_address
,
"temp_url"
:
temp_url_rejection
.
url_hash
,
}
mail
.
send_email
(
"registration/mail.account_revalidation_supervisor.subject.txt"
,
"registration/mail.supervisor_possible_supervisee_rejection.message.txt"
,
context
,
[
supervisiontrack
.
supervisor
.
email
],
)
else
:
#Track already valid
reason
=
"You don't need to revalidate at the moment, your supervision is still valid"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment