[Answered ]-Django IntegrityError while deleting objects

2👍

Try passing a callable instead of get_default_category().

    category = models.ForeignKey(Category, related_name='posts',
                                 on_delete=models.SET(get_default_category))

Leave a comment