Skip to content

TypeError: __init__() missing 1 required positional argument: 'on_delete' #28

@a-maryam

Description

@a-maryam

Location 1

File "/srv/venv/lib/python3.5/site-packages/flatcontent/models.py", line 13, in FlatContent
site = models.ForeignKey(Site, blank=True, null=True)
TypeError: init() missing 1 required positional argument: 'on_delete'

Location 2

File "/srv/venv/lib/python3.5/site-packages/flatcontent/migrations/0001_initial.py", line 20, in Migration
('site', models.ForeignKey(to='sites.Site', null=True, blank=True)),
TypeError: init() missing 1 required positional argument: 'on_delete'

Location 3

File "/srv/venv/lib/python3.5/site-packages/flatcontent/migrations/0001_initial.py", line 20, in Migration
('site', models.ForeignKey(to='sites.Site', null=True, blank=True)),
TypeError: init() missing 1 required positional argument: 'on_delete'

Fix (Disclaimer: Not acquainted with the possible repercussions)

add on_delete=models.PROTECT to the foreign key arguments

Source

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions