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. 5
      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.translation import ugettext_lazy as _
from django_filters.filters import CharFilter, ModelChoiceFilter, DateFilter
from django_filters.rest_framework.filterset import FilterSet
from rest_framework import serializers
from rest_framework.filters import FilterSet
from sapl.base.models import Autor, TipoAutor
from sapl.parlamentares.models import Legislatura

3
sapl/api/views.py

@ -1,9 +1,10 @@
import logging
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.http import Http404
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.mixins import ListModelMixin, RetrieveModelMixin
from rest_framework.permissions import (AllowAny, IsAuthenticated,

5
sapl/settings.py

@ -90,6 +90,7 @@ INSTALLED_APPS = (
'haystack',
'sass_processor',
'rest_framework',
'django_filters',
'reversion',
'reversion_compare',
'whoosh',
@ -110,7 +111,7 @@ SOLR_URL = config('SOLR_URL', cast=str, default='http://localhost:8983')
SOLR_COLLECTION = config('SOLR_COLLECTION', cast=str, default='sapl')
if USE_SOLR:
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' #enable auto-index
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' # enable auto-index
SEARCH_BACKEND = 'haystack.backends.solr_backend.SolrEngine'
SEARCH_URL = ('URL', '{}/solr/{}'.format(SOLR_URL, SOLR_COLLECTION))
@ -166,7 +167,7 @@ REST_FRAMEWORK = {
"DEFAULT_PAGINATION_CLASS": "sapl.api.pagination.StandardPagination",
"DEFAULT_FILTER_BACKENDS": (
"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.translation import ugettext_lazy as _
import django_filters
from django_filters.filterset import STRICTNESS
from easy_thumbnails import source_generators
from floppyforms import ClearableFileInput
import magic
@ -685,9 +684,9 @@ def qs_override_django_filter(self):
valid = self.is_bound and self.form.is_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)
elif bool(self.strict) == STRICTNESS.RETURN_NO_RESULTS:
elif bool(self.strict) == STRICTNESS.RETURN_NO_RESULTS:"""
self._qs = self.queryset.none()
return self._qs
# else STRICTNESS.IGNORE... ignoring
@ -703,9 +702,9 @@ def qs_override_django_filter(self):
try:
value = self.form.fields[name].clean(raw_value)
except forms.ValidationError:
if self.strict == STRICTNESS.RAISE_VALIDATION_ERROR:
"""if self.strict == STRICTNESS.RAISE_VALIDATION_ERROR:
raise
elif bool(self.strict) == STRICTNESS.RETURN_NO_RESULTS:
elif bool(self.strict) == STRICTNESS.RETURN_NO_RESULTS:"""
self._qs = self.queryset.none()
return self._qs
# else STRICTNESS.IGNORE... ignoring

Loading…
Cancel
Save