Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select or ignore specific model fields #113

Open
stevelacey opened this issue Jan 21, 2025 · 1 comment · May be fixed by #114
Open

Select or ignore specific model fields #113

stevelacey opened this issue Jan 21, 2025 · 1 comment · May be fixed by #114

Comments

@stevelacey
Copy link

stevelacey commented Jan 21, 2025

It would be helpful if django-cleanup allowed ignoring or selecting specific fields in a model.

In my project some models have fields that can't be cleaned because they have non-uniques, yet other fields would work fine.

Supporting a include/exclude list via decorators would be consistent with what already exists, but maybe a setting would be better, that'd be similar to how cacheops is configured, and I like the idea of keeping it all inside settings.py:

CLEANUP = {
    # "core.achievement": {"frame", "image", "obscure_image"},
    "core.achievementupload": {"achievement_csv"},
    "core.bitstreamversion": {"asset_file"},
    "core.cerberusversion": {"asset_file"},
    "core.feedpost": {"image"},
    # "core.machine": {"backglass_art", "logo", "template_file"},
    "core.recording": {"file"},
    "core.scoredetectorversion": {"asset_file"},
    "core.scoreimage": {"image"},
    # "core.session": {"log_file"},
    "core.slideshowimage": {"image"},
    # "core.spike2firmwareversion": {"asset_file"},
    "core.userprofile": {"profile_picture"},
}

Not really sure how you might want this to play out with the select/ignore modes, changing mode via switching AppConfig is not something I've come across in a Django package before, a setting like this seems more common 🤔

@stevelacey stevelacey linked a pull request Jan 21, 2025 that will close this issue
@vinnyrose
Copy link
Collaborator

Can you clarify what you mean by “non-uniques”?

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 a pull request may close this issue.

2 participants