Merge branch 'mdebray/bugfix_respo_instru' into 'master'

Bugfix : Le chef instru peut maintenant changer les infos d'instru

See merge request klub-dev-ens/Ernesto!19
This commit is contained in:
Lucie Galland 2022-02-21 09:55:25 +01:00
commit 07d2e30b32

View file

@ -105,11 +105,12 @@ class FicheInstru(LoginRequiredMixin, TemplateView):
def post(self, request, *args, **kwargs):
instru = get_object_or_404(self.model, id=self.kwargs["pk"])
form = ChefEditInstrumentForm(request.POST, instance=instru)
if request.user.profile.is_chef:
if request.user.profile.is_chef or request.user.profile.is_chef_instru:
if form.is_valid():
form.save()
context = self.get_context_data()
context["form"] = form
print(instru.user)
return render(request, self.template_name, context)