From 76593d10bb0422cfa32af78a813ba79f85b5abb3 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Fri, 11 Mar 2016 17:01:54 -0300 Subject: [PATCH] =?UTF-8?q?Caso=20esteja=20enviada,=20tira=20data,=20caso?= =?UTF-8?q?=20n=C3=A3o,=20exclui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- materia/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/materia/views.py b/materia/views.py index 7ea84ae23..2247796ea 100644 --- a/materia/views.py +++ b/materia/views.py @@ -1442,7 +1442,11 @@ class ProposicaoEditView(CreateView): proposicao = Proposicao.objects.get(id=kwargs['pk']) if form.is_valid(): if 'Excluir' in request.POST: - proposicao.delete() + if proposicao.data_envio: + proposicao.data_envio = None + proposicao.save() + else: + proposicao.delete() elif 'salvar' in request.POST: if 'texto_original' in request.FILES: proposicao.texto_original = request.FILES['texto_original']