Chef instru peut maintenant changer les infos d'instru

This commit is contained in:
Maurice Debray 2022-02-21 00:47:03 +01:00
parent bc7430cb5d
commit f88ed9ece6

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)