Skip to content

List only area on delete - #450

Open
norm wants to merge 2 commits into
masterfrom
list-only-area-on-delete
Open

norm wants to merge 2 commits into
masterfrom
list-only-area-on-delete

Conversation

@norm

@norm norm commented Sep 28, 2026

Copy link
Copy Markdown

I'm not sure how I feel about doing a global patch:

    admin_utils.NestedObjects = AreaNestedObjects

but I can't think of another way other than duplicating get_deleted_objects in a Mixin and then using that on every class that has an area below it. And that feels just as wrong but in a different way.

Closes #448.

An area can have thousands of related objects, and this will quickly
crash the server as it runs out of memory.
@norm
norm requested a review from dracos September 28, 2026 14:00

@dracos dracos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, sorry for the delay in getting around to it!

Having thought about it, just to try and prevent the possibility of a mis-click causing an issue in future, we should probably also then look at not showing any related fields if someone tries to delete any of Country, a Generation, a NameType, a CodeType, or a Type? Feels like the Area list alone (ignoring the Area's "children" that this PR fixes) for one of those could be very large (e.g. 115k NameType "S" in the db, 138k "ons" CodeType).

@norm

norm commented Oct 20, 2026

Copy link
Copy Markdown
Author

If we want to expand it to other models, then a OmitNestedObjectsMixin is probably the right way to go about now? Then it should be a simple pattern to follow if we add more later.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add override delete confirmation page

2 participants