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, 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()}

18
sigi/apps/solicitacoes/layouts.yaml

@ -13,21 +13,3 @@ Solicitacao:
- email_contato telefone_contato - email_contato telefone_contato
- titulo - titulo
- resumo - 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.crud.base import Crud, CrudCreateView, CrudListView, CrudCreateView, CrudUpdateView, CrudBaseMixin
from sigi.apps.usuarios.models import Usuario from sigi.apps.usuarios.models import Usuario
from .forms import SolicitacaoEditForm, SolicitacaoForm from .forms import SolicitacaoForm
from .models import Solicitacao from .models import Solicitacao
@ -34,18 +34,6 @@ class SolicitacaoCrud(LoginRequiredMixin, Crud):
def get_success_url(self): def get_success_url(self):
return reverse(u'solicitacoes:solicitacao_list') 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): class BaseMixin(CrudBaseMixin):
list_field_names = [u'osticket', u'sistema', list_field_names = [u'osticket', u'sistema',
u'titulo', u'data_criacao'] u'titulo', u'data_criacao']

Loading…
Cancel
Save