|
@ -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,12 +684,12 @@ 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 |
|
|
|
|
|
|
|
|
# start with all the results and filter from there |
|
|
# start with all the results and filter from there |
|
|
qs = self.queryset.all() |
|
|
qs = self.queryset.all() |
|
@ -703,12 +702,12 @@ 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 |
|
|
|
|
|
|
|
|
if value is not None: # valid & clean data |
|
|
if value is not None: # valid & clean data |
|
|
qs = qs._next_is_sticky() |
|
|
qs = qs._next_is_sticky() |
|
|