From b675cdc529838a4228198d8b03a2a5d38d41d003 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Thu, 23 Jun 2016 16:20:44 -0300 Subject: [PATCH] =?UTF-8?q?Ajeita=20c=C3=B3digo=20retornado=20do=20osticke?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prod.py | 1 + sigi/apps/solicitacoes/forms.py | 2 +- sigi/apps/solicitacoes/views.py | 9 +++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 120000 prod.py diff --git a/prod.py b/prod.py new file mode 120000 index 0000000..01f8fd6 --- /dev/null +++ b/prod.py @@ -0,0 +1 @@ +dev.py \ No newline at end of file diff --git a/sigi/apps/solicitacoes/forms.py b/sigi/apps/solicitacoes/forms.py index 6153e68..b2f1d0c 100644 --- a/sigi/apps/solicitacoes/forms.py +++ b/sigi/apps/solicitacoes/forms.py @@ -24,7 +24,7 @@ def open_osticket(solicitacao): "ip": "", "message": solicitacao.resumo} response = requests.post(OSTICKET_URL, headers=headers, json=data) - if response.status_code == requests.codes.ok: + if response.status_code == requests.codes.created: return response.text else: response.raise_for_status() diff --git a/sigi/apps/solicitacoes/views.py b/sigi/apps/solicitacoes/views.py index 3ca4f3b..5999cc2 100644 --- a/sigi/apps/solicitacoes/views.py +++ b/sigi/apps/solicitacoes/views.py @@ -2,6 +2,7 @@ from __future__ import absolute_import import random from django.contrib.auth.mixins import LoginRequiredMixin +from django.core.urlresolvers import reverse import sigi.apps.crud.base from sigi.apps.crud.base import Crud, CrudCreateView, CrudListView, CrudCreateView, CrudUpdateView, CrudBaseMixin @@ -27,7 +28,10 @@ class SolicitacaoCrud(LoginRequiredMixin, Crud): self.initial[u'telefone_contato'] = usuario.primeiro_telefone except Usuario.DoesNotExist: pass - return self.initial.copy() # TODO: por que? + return self.initial.copy() + + def get_success_url(self): + return reverse(u'solicitacoes:solicitacao_list') class UpdateView(LoginRequiredMixin, CrudUpdateView): form_class = SolicitacaoEditForm @@ -42,7 +46,8 @@ class SolicitacaoCrud(LoginRequiredMixin, Crud): return u'SolicitacaoList' class BaseMixin(CrudBaseMixin): - list_field_names = [u'codigo', u'sistema', u'titulo', u'data_criacao'] + list_field_names = [u'osticket', u'sistema', + u'titulo', u'data_criacao'] class SistemaCrud(Crud):