Closed maxloyd closed 4 years ago
I'm also observing this issue.
Python == 3.7.3
Django==2.0 django-model-utils==3.1.2 django-moderation==0.5.0
in django 2.0 it is required to specify on_delete in ForeignKey Declaration, while waiting the update you could clone the repo and add on_delete on each ForeignKey inside the code
@NwawelAIroume on_delete is set there already https://github.com/dominno/django-moderation/blob/master/moderation/models.py#L43
@mshamma could you just clone the repo and install package with the command python setup.py install inside the cloned directory. I had the same issue as you and i noticed the same version in pypy package did not include on_delete on foreignkey.
@NwawelAIroume Just did it and I'm no longer seeing the TypeError as I originally stated. In fact, I tried it twice: 1) As you instructed via cloning the repo and running setup.py 2). Installing via pip
Both methods worked.
@NwawelAIroume @dominno I think pythonhosted.org is serving a 'corrupt' copy of django-moderation. A quick inspection of the models.py from the package here (see url) shows that on_delete is not in the code:
PKG-INFO is showing that this is version 0.5.0
lines 40-44 of the file
class ModeratedObject(models.Model):
content_type = models.ForeignKey(ContentType, null=True, blank=True,
editable=False)
object_pk = models.PositiveIntegerField(null=True, blank=True,
Just installed the app. But cannot run server as I'm getting this error:
Unhandled exception in thread started by <function check_errors..wrapper at 0x7f72953ac268>
Traceback (most recent call last):
File "/mnt/c/Users/maxlo/Documents/apps/adinl/env/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, *kwargs)
File "/mnt/c/Users/maxlo/Documents/apps/adinl/env/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/mnt/c/Users/maxlo/Documents/apps/adinl/env/lib/python3.6/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "/mnt/c/Users/maxlo/Documents/apps/adinl/env/lib/python3.6/site-packages/django/core/management/init.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/mnt/c/Users/maxlo/Documents/apps/adinl/env/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(args, **kwargs)
File "/mnt/c/Users/maxlo/Documents/apps/adinl/env/lib/python3.6/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/mnt/c/Users/maxlo/Documents/apps/adinl/env/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
app_config.import_models()
File "/mnt/c/Users/maxlo/Documents/apps/adinl/env/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/mnt/c/Users/maxlo/Documents/apps/adinl/env/lib/python3.6/site-packages/django_moderation-0.5.0-py3.6.egg/moderation/models.py", line 41, in
File "/mnt/c/Users/maxlo/Documents/apps/adinl/env/lib/python3.6/site-packages/django_moderation-0.5.0-py3.6.egg/moderation/models.py", line 43, in ModeratedObject
editable=False)