Browse Source

HOT-FIX: Adiciona Autor como PrimeiroAutor ao criar Materia Legislativa

pull/2847/head
Cesar Carvalho 6 years ago
parent
commit
28139f6a78
  1. 11
      sapl/materia/views.py

11
sapl/materia/views.py

@ -1619,14 +1619,13 @@ class MateriaLegislativaCrud(Crud):
form_class = MateriaLegislativaForm form_class = MateriaLegislativaForm
def form_valid(self, form): def get_initial(self):
self.object = form.instance initial = super(CreateView, self).get_initial()
self.object.user = self.request.user initial['user'] = self.request.user
self.object.ip = get_client_ip(self.request) initial['ip'] = get_client_ip(self.request)
self.object.save()
return super().form_valid(form) return initial
@property @property
def cancel_url(self): def cancel_url(self):

Loading…
Cancel
Save