Limite autorisation de commentaire aux pers. autorisées
This commit is contained in:
parent
6dfc3c6e42
commit
f11d20c2f9
6 changed files with 66 additions and 4 deletions
|
|
@ -154,6 +154,13 @@ class StudentCommentView(UpdateView):
|
|||
model = Student
|
||||
form_class = StudentCommentForm
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
# Only authorized teachers can comment on the student.
|
||||
if not self.object.can_comment(self.request.user):
|
||||
del context['form']
|
||||
return context
|
||||
|
||||
def get_success_url(self):
|
||||
messages.success(
|
||||
self.request, "L'enregistrement des commentaires pour %s a réussi." % self.object
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue