modlinltd / django-advanced-filters

Add advanced filtering abilities to Django admin
https://pypi.org/project/django-advanced-filters/
MIT License
771 stars 173 forks source link

Django 2.X support #72

Closed mrname closed 6 years ago

mrname commented 6 years ago

Just tried this out with a Django 2.X project and immediately hit this error during initial migration:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
    django.setup()
  File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
  File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/usr/local/lib/python3.6/site-packages/advanced_filters/models.py", line 16, in <module>
    class AdvancedFilter(models.Model):
  File "/usr/local/lib/python3.6/site-packages/advanced_filters/models.py", line 23, in AdvancedFilter
    related_name='created_advanced_filters', verbose_name=_('Created by'))
TypeError: __init__() missing 1 required positional argument: 'on_delete'

As we all know, this was a breaking change introduced by django 2.X. I would be happy to create a PR for this, but I assume there could be other issues regarding django 2.X compatibility. I was wondering if there is a current effort ongoing already for 2.X compatibility or if I should just start by submitting a PR for this particular issue.

mrname commented 6 years ago

Never mind, just found this PR!

https://github.com/modlinltd/django-advanced-filters/pull/63