Closed fanckush closed 6 years ago
This should be a pretty easy fix. You simply have to add on_delete=models.CASCADE
in every model with a foreign key. In previous versions <2.0 'cascade' was the default method so it shouldn't break anything (Source). However other issues need to be fixed as well. For example, django.core.urlresolvers
got removed.
Thanks for the reply, i figured it had to do with on_delete but anyway i ended up downgrading Django back to 1.11.x
Do you want to request a feature or report a bug? Bug
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem After installing with pip and adding dbmail to INSTALLED_APPS, i tried to migrate and got the following error:
Full traceback
Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/Users/imad/.virtualenvs/pr2/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line utility.execute() File "/Users/imad/.virtualenvs/pr2/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute django.setup() File "/Users/imad/.virtualenvs/pr2/lib/python3.6/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/Users/imad/.virtualenvs/pr2/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate app_config.import_models() File "/Users/imad/.virtualenvs/pr2/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models self.models_module = import_module(models_module_name) File "/Users/imad/.virtualenvs/pr2/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 "/Users/imad/.virtualenvs/pr2/lib/python3.6/site-packages/dbmail/models.py", line 106, in <module> class MailFromEmail(models.Model): File "/Users/imad/.virtualenvs/pr2/lib/python3.6/site-packages/dbmail/models.py", line 113, in MailFromEmail blank=True, null=True, default=None) TypeError: __init__() missing 1 required positional argument: 'on_delete'
What is the expected behavior?Python: 3.6
Thank you for the effort