I need to set items in an InlinePanel on a page as 'archived' so they don't display in the InlinePanel. There should only be a few items visible at once but deleting them is not an option as they are required for historical information and reporting etc.
Is there a way to do this without just hiding them with Javascript (which will slow down page loads over time)? If they are archived and removed from the QuerySet via filtering, they are then deleted when the page is published because they are not longer needed by the InlinePanel. I have tried SET_NULL but they are still deleted. Using PROTECT stops the page from being published but this wont work because it's just blocking the inline object from being deleted.
So how could this be done, or is this just asking too much from an InlinePanel?
Basic code example. SET_NULL is ignored and related object is deleted when the page is published.
class Variant(models.Model):
product = ParentalKey(
'wagtailcore.Page',
related_name='variants',
on_delete=models.SET_NULL,
null=True,
)
class Product(Page):
panels = [
MultiFieldPanel([
InlinePanel('variants', label='Item Variants'),
]),
]