Browse Source

Fix removed request.REQUEST in Django 1.9 and fix OSTICKET_URL

Signed-off-by: Luciano Almeida <lucianoalmeida@interlegis.leg.br>
pull/6/head
Luciano Almeida 9 years ago
committed by Luciano Almeida
parent
commit
30066bf831
  1. 4
      sigi/apps/diagnosticos/views.py
  2. 5
      sigi/apps/solicitacoes/forms.py

4
sigi/apps/diagnosticos/views.py

@ -272,7 +272,7 @@ def diagnostico_pdf(request, id_diagnostico):
def graficos(request): def graficos(request):
categorias = Categoria.objects.all() categorias = Categoria.objects.all()
sel_categoria = int(request.REQUEST.get("categoria", "3")) sel_categoria = int(request.GET.get("categoria", "3"))
perguntas = Pergunta.objects.filter(categoria=sel_categoria).all() perguntas = Pergunta.objects.filter(categoria=sel_categoria).all()
context = RequestContext(request, { context = RequestContext(request, {
@ -315,7 +315,7 @@ def grafico_api(request):
'#BB9098', '#BB9098',
'#BDF1ED', ]) '#BDF1ED', ])
pergunta_slug = request.REQUEST.get('id', None) pergunta_slug = request.GET.get('id', None)
pergunta = get_object_or_404(Pergunta, name=pergunta_slug) pergunta = get_object_or_404(Pergunta, name=pergunta_slug)
if pergunta.datatype == 'one': if pergunta.datatype == 'one':

5
sigi/apps/solicitacoes/forms.py

@ -7,7 +7,7 @@ from django import forms
from django.db import transaction from django.db import transaction
from django.forms import ModelForm from django.forms import ModelForm
from sigi.settings.prod import OSTICKET_API_KEY, OSTICKET_URL from sigi.settings.prod import OSTICKET_API_KEY, OSTICKET_ATENDIMENTO_URL
from .models import Solicitacao from .models import Solicitacao
@ -27,7 +27,8 @@ def open_osticket(solicitacao):
"subject": solicitacao.titulo, "subject": solicitacao.titulo,
"ip": "", "ip": "",
"message": solicitacao.resumo} "message": solicitacao.resumo}
response = requests.post(OSTICKET_URL, headers=headers, json=data) response = requests.post(OSTICKET_ATENDIMENTO_URL,
headers=headers, json=data)
if response.status_code == requests.codes.created: if response.status_code == requests.codes.created:
return response.text return response.text
else: else:

Loading…
Cancel
Save