Browse Source

alterações mínimas para executar manage check

pull/2446/head
Leandro Roberto 6 years ago
parent
commit
5596388326
  1. 2
      sapl/api/forms.py
  2. 3
      sapl/api/views.py
  3. 3
      sapl/settings.py
  4. 9
      sapl/utils.py

2
sapl/api/forms.py

@ -6,8 +6,8 @@ from django.forms.widgets import MultiWidget, TextInput
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django_filters.filters import CharFilter, ModelChoiceFilter, DateFilter from django_filters.filters import CharFilter, ModelChoiceFilter, DateFilter
from django_filters.rest_framework.filterset import FilterSet
from rest_framework import serializers from rest_framework import serializers
from rest_framework.filters import FilterSet
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.parlamentares.models import Legislatura from sapl.parlamentares.models import Legislatura

3
sapl/api/views.py

@ -1,9 +1,10 @@
import logging import logging
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.db.models import Q from django.db.models import Q
from django.http import Http404 from django.http import Http404
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from rest_framework.filters import DjangoFilterBackend from django_filters.rest_framework.backends import DjangoFilterBackend
from rest_framework.generics import ListAPIView from rest_framework.generics import ListAPIView
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin from rest_framework.mixins import ListModelMixin, RetrieveModelMixin
from rest_framework.permissions import (AllowAny, IsAuthenticated, from rest_framework.permissions import (AllowAny, IsAuthenticated,

3
sapl/settings.py

@ -90,6 +90,7 @@ INSTALLED_APPS = (
'haystack', 'haystack',
'sass_processor', 'sass_processor',
'rest_framework', 'rest_framework',
'django_filters',
'reversion', 'reversion',
'reversion_compare', 'reversion_compare',
'whoosh', 'whoosh',
@ -166,7 +167,7 @@ REST_FRAMEWORK = {
"DEFAULT_PAGINATION_CLASS": "sapl.api.pagination.StandardPagination", "DEFAULT_PAGINATION_CLASS": "sapl.api.pagination.StandardPagination",
"DEFAULT_FILTER_BACKENDS": ( "DEFAULT_FILTER_BACKENDS": (
"rest_framework.filters.SearchFilter", "rest_framework.filters.SearchFilter",
"rest_framework.filters.DjangoFilterBackend", 'django_filters.rest_framework.DjangoFilterBackend',
), ),
} }

9
sapl/utils.py

@ -21,7 +21,6 @@ from django.db.models import Q
from django.utils import six, timezone from django.utils import six, timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import django_filters import django_filters
from django_filters.filterset import STRICTNESS
from easy_thumbnails import source_generators from easy_thumbnails import source_generators
from floppyforms import ClearableFileInput from floppyforms import ClearableFileInput
import magic import magic
@ -685,9 +684,9 @@ def qs_override_django_filter(self):
valid = self.is_bound and self.form.is_valid() valid = self.is_bound and self.form.is_valid()
if self.is_bound and not valid: if self.is_bound and not valid:
if self.strict == STRICTNESS.RAISE_VALIDATION_ERROR: """if self.strict == STRICTNESS.RAISE_VALIDATION_ERROR:
raise forms.ValidationError(self.form.errors) raise forms.ValidationError(self.form.errors)
elif bool(self.strict) == STRICTNESS.RETURN_NO_RESULTS: elif bool(self.strict) == STRICTNESS.RETURN_NO_RESULTS:"""
self._qs = self.queryset.none() self._qs = self.queryset.none()
return self._qs return self._qs
# else STRICTNESS.IGNORE... ignoring # else STRICTNESS.IGNORE... ignoring
@ -703,9 +702,9 @@ def qs_override_django_filter(self):
try: try:
value = self.form.fields[name].clean(raw_value) value = self.form.fields[name].clean(raw_value)
except forms.ValidationError: except forms.ValidationError:
if self.strict == STRICTNESS.RAISE_VALIDATION_ERROR: """if self.strict == STRICTNESS.RAISE_VALIDATION_ERROR:
raise raise
elif bool(self.strict) == STRICTNESS.RETURN_NO_RESULTS: elif bool(self.strict) == STRICTNESS.RETURN_NO_RESULTS:"""
self._qs = self.queryset.none() self._qs = self.queryset.none()
return self._qs return self._qs
# else STRICTNESS.IGNORE... ignoring # else STRICTNESS.IGNORE... ignoring

Loading…
Cancel
Save