modlinltd/django-advanced-filters

Charfield nullable gives '<' not supported between instances of 'NoneType' and 'str'

maingoh opened this issue · 0 comments

When advanced filters is enabled for mymodel and mymodel contains a charfield that can be null (and have a null entry in the database), this raise the following exception since the new version:

Traceback:

File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py" in _get_response
  126.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py" in _get_response
  124.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python3.6/dist-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)

File "/usr/local/lib/python3.6/dist-packages/django/utils/decorators.py" in _wrapper
  45.         return bound_method(*args, **kwargs)

File "/usr/local/lib/python3.6/dist-packages/django/views/decorators/csrf.py" in wrapped_view
  54.         return view_func(*args, **kwargs)

File "/usr/local/lib/python3.6/dist-packages/braces/views/_forms.py" in dispatch
  24.         return super(CsrfExemptMixin, self).dispatch(*args, **kwargs)

File "/usr/local/lib/python3.6/dist-packages/braces/views/_access.py" in dispatch
  407.             request, *args, **kwargs)

File "/usr/local/lib/python3.6/dist-packages/django/views/generic/base.py" in dispatch
  88.         return handler(request, *args, **kwargs)

File "/usr/local/lib/python3.6/dist-packages/advanced_filters/views.py" in get
  75.                    choices, key=itemgetter(0))]

Exception Type: TypeError at /admin/advanced_filters/field_choices/api.mymodel/description
Exception Value: '<' not supported between instances of 'NoneType' and 'str'