dossier PJ
[auf_rh_dae.git] / project / rh / views.py
index a35b0f0..61af97e 100644 (file)
@@ -40,6 +40,12 @@ def piece(request, filename):
             return sendfile(request, piece.fichier.path)
         else:
             return redirect_interdiction(request)
+    if model == 'dossier':
+        piece = get_object_or_404(rh.DossierPiece, fichier=filename)
+        if rh.Dossier.objects.ma_region_ou_service(request.user).filter(id=piece.dossier_id).exists():
+            return sendfile(request, piece.fichier.path)
+        else:
+            return redirect_interdiction(request)
 
 # homes
 @login_required