Skip to content

Commit

Permalink
fix: bug in teachers crud
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Nov 2, 2023
1 parent 43e2eca commit 6682c9c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crud/teachers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ def can_manage_teacher(user, teacher_code):

# se l'utente è il docente stesso
my_profile = Personale.objects.filter(cod_fis=user.taxpayer_id).first()
my_teacher_profile = ServiceDocente.getDocenteInfo(my_profile.matricola)
try:
my_teacher_profile = ServiceDocente.getDocenteInfo(my_profile.matricola)
except:
my_teacher_profile = None

if my_profile and teacher and my_teacher_profile[0]['matricola'] == teacher.matricola:
if my_profile and teacher and my_teacher_profile and my_teacher_profile[0]['matricola'] == teacher.matricola:
return True

# se l'utente ha l'abilitazione nel dipartimento di afferenza del docente
my_offices = OrganizationalStructureOfficeEmployee.objects.filter(employee=user,
office__name=OFFICE_TEACHERS,
Expand Down

0 comments on commit 6682c9c

Please sign in to comment.