diff --git a/requirements/dev-requirements.txt b/requirements/dev-requirements.txt index 4377121..bac1a75 100644 --- a/requirements/dev-requirements.txt +++ b/requirements/dev-requirements.txt @@ -2,5 +2,6 @@ django-debug-toolbar==1.4 ipdb==0.10.0 ipython==4.2.0 +isort==4.2.5 model_mommy==1.2.6 pygraphviz==1.3.1 diff --git a/sigi/apps/solicitacoes/views.py b/sigi/apps/solicitacoes/views.py index dffe63b..afebd16 100644 --- a/sigi/apps/solicitacoes/views.py +++ b/sigi/apps/solicitacoes/views.py @@ -12,12 +12,20 @@ from sigi.apps.usuarios.models import Usuario from .forms import SolicitacaoForm from .models import Solicitacao +from sigi.context_processors import recupera_usuario class SolicitacaoCrud(LoginRequiredMixin, Crud): model = Solicitacao 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): form_class = SolicitacaoForm diff --git a/sigi/apps/usuarios/views.py b/sigi/apps/usuarios/views.py index 49bfde9..321627a 100644 --- a/sigi/apps/usuarios/views.py +++ b/sigi/apps/usuarios/views.py @@ -59,9 +59,6 @@ class UsuarioCrud(Crud): fail_silently=False) return reverse(u'index_atendimento') - class ListView(LoginRequiredMixin, CrudListView): - pass - class UpdateView(LoginRequiredMixin, CrudUpdateView): form_class = UsuarioEditForm