Software⏱️ 2 min read📅 2026-05-31

How to Fix: Getting TypeError: __init__() missing 1 required positional argument: 'on_delete' when trying to add parent table after child table with entries

Learn how to fix: Getting TypeError: __init__() missing 1 required positional argument: 'on_delete' when trying to add parent table after child table with entries.

Quick Answer: Try checking your system settings or restarting.

To resolve the TypeError: __init__() missing 1 required positional argument: 'on_delete' when trying to add parent table after child table with entries, you need to specify the on_delete parameter in your ForeignKey field. This parameter is used to define the behavior of the foreign key when the referenced object is deleted.

🛠️ Step-by-Step Verified Fixes

Method 1: Using on_delete parameter

  1. Step 1: Open your Article model file and add the on_delete parameter to the ForeignKey field.

Method 2: Using set_default

  1. Step 1: Open your Article model file and add the set_default parameter to the ForeignKey field.

💡 Conclusion

By specifying the on_delete parameter or using set_default, you can resolve the TypeError and successfully add the parent table after the child table with entries.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions