From 47e05b8dd8dfafdc047e8171dd84ac1bfcac9278 Mon Sep 17 00:00:00 2001 From: "Lucas F." Date: Wed, 7 Feb 2024 10:19:10 -0300 Subject: [PATCH] fix: editing causes new creation --- form_user/apps/contas/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/form_user/apps/contas/views.py b/form_user/apps/contas/views.py index 8dda1e5..3002006 100644 --- a/form_user/apps/contas/views.py +++ b/form_user/apps/contas/views.py @@ -22,7 +22,9 @@ class Index(Common, ListView): class NovoEditar(Common): def form_valid(self, form): - form_permissao = forms.PermissaoForm(self.request.POST) + form_permissao = forms.PermissaoForm( + instance=form.instance.per_custom_user.first(), data=self.request.POST + ) form_permissao.full_clean() if not form_permissao.is_valid():