Browse Source

Lista somente as solicitações do usuário

pull/6/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
committed by Luciano Almeida
parent
commit
55d391d0b9
  1. 1
      requirements/dev-requirements.txt
  2. 8
      sigi/apps/solicitacoes/views.py
  3. 3
      sigi/apps/usuarios/views.py

1
requirements/dev-requirements.txt

@ -2,5 +2,6 @@
django-debug-toolbar==1.4 django-debug-toolbar==1.4
ipdb==0.10.0 ipdb==0.10.0
ipython==4.2.0 ipython==4.2.0
isort==4.2.5
model_mommy==1.2.6 model_mommy==1.2.6
pygraphviz==1.3.1 pygraphviz==1.3.1

8
sigi/apps/solicitacoes/views.py

@ -12,12 +12,20 @@ from sigi.apps.usuarios.models import Usuario
from .forms import SolicitacaoForm from .forms import SolicitacaoForm
from .models import Solicitacao from .models import Solicitacao
from sigi.context_processors import recupera_usuario
class SolicitacaoCrud(LoginRequiredMixin, Crud): class SolicitacaoCrud(LoginRequiredMixin, Crud):
model = Solicitacao model = Solicitacao
help_path = u'' help_path = u''
class ListView(LoginRequiredMixin, CrudListView):
def get_rows(self, object_list):
object_list = Solicitacao.objects.filter(
usuario=recupera_usuario(self.request))
return [self._as_row(obj) for obj in object_list]
class CreateView(LoginRequiredMixin, CrudCreateView): class CreateView(LoginRequiredMixin, CrudCreateView):
form_class = SolicitacaoForm form_class = SolicitacaoForm

3
sigi/apps/usuarios/views.py

@ -59,9 +59,6 @@ class UsuarioCrud(Crud):
fail_silently=False) fail_silently=False)
return reverse(u'index_atendimento') return reverse(u'index_atendimento')
class ListView(LoginRequiredMixin, CrudListView):
pass
class UpdateView(LoginRequiredMixin, CrudUpdateView): class UpdateView(LoginRequiredMixin, CrudUpdateView):
form_class = UsuarioEditForm form_class = UsuarioEditForm

Loading…
Cancel
Save