0

I am trying to upgrade my django project to Django 2.0, and I have read the release notes and read several blog posts about what to change, but nothing addresses my problem so far, which relates to the package pinax:

      File "/Users/marlo/miniconda3/envs/project/lib/python3.6/site-
        packages/pinax/eventlog/models.py", line 13, in 
        class Log(models.Model):
      File "/Users/marlo/miniconda3/envs/project/lib/python3.6/site-packages/pinax/eventlog/models.py", line 22, in Log
        content_type = models.ForeignKey(ContentType, null=True)
    TypeError: __init__() missing 1 required positional argument: 'on_delete'

Are there any fixes for this yet?

Marlo
  • 490
  • 3
  • 7
  • 21
  • You might need to update your library. "The on_delete argument for ForeignKey and OneToOneField is now required in models and migrations" - [source](https://docs.djangoproject.com/en/2.0/releases/2.0/#features-removed-in-2-0) – Bojan Kogoj Feb 21 '18 at 21:41
  • @BojanKogoj It's true that this was missing `on_delete`, but pinax is a package, not a file in my project, so I shouldn't be changing the code. It turned out that we needed to update `pinax-eventlog`: `pip install -U pinax-eventlog` – Marlo Feb 22 '18 at 16:23

1 Answers1

2

You'll want to update pinax-eventlog to latest to pick up Django 2.0 compatibility, which is currently 2.0.3.

In your project's requirements.txt file add:

pinax-eventlog==2.0.3

So when you run pip install -r requirements.txt the right version will install. Otherwise, you can just run pip install pinax-eventlog==2.0.3.

Patrick Altman
  • 890
  • 8
  • 10