|
@ -12,14 +12,14 @@ def open_osticket(solicitacao): |
|
|
headers = {'X-API-KEY': OSTICKET_API_KEY, |
|
|
headers = {'X-API-KEY': OSTICKET_API_KEY, |
|
|
'Content-Type': 'application/json'} |
|
|
'Content-Type': 'application/json'} |
|
|
|
|
|
|
|
|
usuario = solicitacao.usuario |
|
|
|
|
|
data = {"alert": True, |
|
|
data = {"alert": True, |
|
|
"autorespond": True, |
|
|
"autorespond": True, |
|
|
"source": "API", |
|
|
"source": "API", |
|
|
"name": usuario.username, |
|
|
"name": solicitacao.usuario.username, |
|
|
"email": usuario.email, |
|
|
"email": solicitacao.usuario.email, |
|
|
"phone": '-'.join((usuario.primeiro_telefone.ddd, |
|
|
"phone": ' - '.join( |
|
|
usuario.primeiro_telefone.numero)), |
|
|
(solicitacao.usuario.primeiro_telefone.ddd, |
|
|
|
|
|
solicitacao.usuario.primeiro_telefone.numero)), |
|
|
"subject": solicitacao.titulo, |
|
|
"subject": solicitacao.titulo, |
|
|
"ip": "", |
|
|
"ip": "", |
|
|
"message": solicitacao.resumo} |
|
|
"message": solicitacao.resumo} |
|
@ -37,7 +37,7 @@ class SolicitacaoForm(ModelForm): |
|
|
max_length=500, |
|
|
max_length=500, |
|
|
widget=forms.Textarea) |
|
|
widget=forms.Textarea) |
|
|
|
|
|
|
|
|
class Meta(object): |
|
|
class Meta: |
|
|
model = Solicitacao |
|
|
model = Solicitacao |
|
|
fields = [u'codigo', u'usuario', u'sistema', |
|
|
fields = [u'codigo', u'usuario', u'sistema', |
|
|
u'email_contato', u'telefone_contato', |
|
|
u'email_contato', u'telefone_contato', |
|
@ -45,9 +45,12 @@ class SolicitacaoForm(ModelForm): |
|
|
widgets = { |
|
|
widgets = { |
|
|
u'codigo': forms.HiddenInput(), |
|
|
u'codigo': forms.HiddenInput(), |
|
|
u'usuario': forms.HiddenInput(), |
|
|
u'usuario': forms.HiddenInput(), |
|
|
u'casa_legislativa': forms.TextInput(attrs={'readonly':'readonly'}), |
|
|
u'casa_legislativa': forms.TextInput( |
|
|
u'email_contato': forms.TextInput(attrs={'readonly':'readonly'}), |
|
|
attrs={'readonly': 'readonly'}), |
|
|
u'telefone_contato': forms.TextInput(attrs={'readonly':'readonly'}) |
|
|
u'email_contato': forms.TextInput( |
|
|
|
|
|
attrs={'readonly': 'readonly'}), |
|
|
|
|
|
u'telefone_contato': forms.TextInput( |
|
|
|
|
|
attrs={'readonly': 'readonly'}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@transaction.atomic |
|
|
@transaction.atomic |
|
@ -57,18 +60,3 @@ class SolicitacaoForm(ModelForm): |
|
|
solicitacao.osticket = os_ticket |
|
|
solicitacao.osticket = os_ticket |
|
|
solicitacao.save() |
|
|
solicitacao.save() |
|
|
return solicitacao |
|
|
return solicitacao |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SolicitacaoEditForm(ModelForm): |
|
|
|
|
|
|
|
|
|
|
|
resumo = forms.CharField( |
|
|
|
|
|
label=u'Resumo', |
|
|
|
|
|
max_length=500, |
|
|
|
|
|
widget=forms.Textarea) |
|
|
|
|
|
|
|
|
|
|
|
class Meta(object): |
|
|
|
|
|
model = Solicitacao |
|
|
|
|
|
fields = [u'codigo', u'usuario', u'sistema', |
|
|
|
|
|
u'casa_legislativa', u'titulo', u'resumo'] |
|
|
|
|
|
widgets = {u'codigo': forms.TextInput(attrs={u'readonly': u'readonly'}), |
|
|
|
|
|
u'usuario': forms.HiddenInput()} |
|
|
|
|
|