From ec21fdf6037b716e54f46caaac1d266bef782ac1 Mon Sep 17 00:00:00 2001 From: Victor Fabre Date: Tue, 21 Aug 2018 13:04:21 -0300 Subject: [PATCH] Fix #2101 (#2147) --- sapl/audiencia/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sapl/audiencia/views.py b/sapl/audiencia/views.py index bdfc6993c..c999cf4ff 100644 --- a/sapl/audiencia/views.py +++ b/sapl/audiencia/views.py @@ -34,9 +34,10 @@ class AudienciaCrud(Crud): def get_initial(self): initial = super(UpdateView, self).get_initial() - initial['tipo_materia'] = self.object.materia.tipo.id - initial['numero_materia'] = self.object.materia.numero - initial['ano_materia'] = self.object.materia.ano + if self.object.materia: + initial['tipo_materia'] = self.object.materia.tipo.id + initial['numero_materia'] = self.object.materia.numero + initial['ano_materia'] = self.object.materia.ano return initial class DeleteView(Crud.DeleteView):