Skip to content

Deleting static block also deletes products #212

@emilian

Description

@emilian

I had a big surprise today where deleting a static block also removed the products referencing the block. To stop this the lfs/catalog/models.py file should use on_delete=models.SET_NULL for the static_block foreign key. Like this:

static_block = models.ForeignKey("StaticBlock", on_delete=models.SET_NULL, verbose_name=_(u"Static block"), blank=True, null=True, related_name="products")

That should solve the problem for the products.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions