Browse Source

Ajeita código retornado do osticket

pull/6/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
committed by Luciano Almeida
parent
commit
b675cdc529
  1. 1
      prod.py
  2. 2
      sigi/apps/solicitacoes/forms.py
  3. 9
      sigi/apps/solicitacoes/views.py

1
prod.py

@ -0,0 +1 @@
dev.py

2
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()

9
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):

Loading…
Cancel
Save