Browse Source

Remove código não usado

pull/6/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
committed by Luciano Almeida
parent
commit
72f023a075
  1. 36
      sigi/apps/solicitacoes/forms.py
  2. 18
      sigi/apps/solicitacoes/layouts.yaml
  3. 14
      sigi/apps/solicitacoes/views.py

36
sigi/apps/solicitacoes/forms.py

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

18
sigi/apps/solicitacoes/layouts.yaml

@ -13,21 +13,3 @@ Solicitacao:
- email_contato telefone_contato
- titulo
- resumo
SolicitacaoEdit:
Solicitação:
- codigo
- usuario
- sistema
- titulo
- resumo
SolicitacaoList:
Solicitação:
- codigo
- usuario
- sistema
- casa_legislativa
- email_contato telefone_contato
- titulo
- data_criacao

14
sigi/apps/solicitacoes/views.py

@ -8,7 +8,7 @@ import sigi.apps.crud.base
from sigi.apps.crud.base import Crud, CrudCreateView, CrudListView, CrudCreateView, CrudUpdateView, CrudBaseMixin
from sigi.apps.usuarios.models import Usuario
from .forms import SolicitacaoEditForm, SolicitacaoForm
from .forms import SolicitacaoForm
from .models import Solicitacao
@ -34,18 +34,6 @@ class SolicitacaoCrud(LoginRequiredMixin, Crud):
def get_success_url(self):
return reverse(u'solicitacoes:solicitacao_list')
class UpdateView(LoginRequiredMixin, CrudUpdateView):
form_class = SolicitacaoEditForm
@property
def layout_key(self):
return u'SolicitacaoEdit'
class ListView(LoginRequiredMixin, CrudListView):
@property
def layout_key(self):
return u'SolicitacaoList'
class BaseMixin(CrudBaseMixin):
list_field_names = [u'osticket', u'sistema',
u'titulo', u'data_criacao']

Loading…
Cancel
Save