-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat(attachments, storage): u#3727 t#3961 physical attachment deletion system #476
Conversation
Coverage Report
|
8841c36
to
67b776c
Compare
a226a7a
to
449e660
Compare
449e660
to
d37d442
Compare
d772072
to
ff3f953
Compare
94bb974
to
dde6bf1
Compare
@admin.register(StoragedObject) | ||
class StoragedObjectAdmin(admin.ModelAdmin[StoragedObject]): | ||
list_display = ( | ||
"id" "file", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You missed a comma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouch
dde6bf1
to
3547390
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mega clap!
This PR ensures that the files are deleted when the attachments are deleted. Several things must be taken into consideration:
The solution that has been reached consists of:
taiga.commons.storage
where everything related to file storage will be created.StoragedObject
model that will store the information about where the file is stored.Attachment
model will have aForeingKey
toStoragedObject
Attachment
during thepost_save
that will mark the associatedStoragedObject
as deleted.StoragedObject
records that have been deleted more than X days ago. (The frequency of the periodic task and time that the files will be kept are configurable parameters).StoragedObject
items and their files.How to tests:
python -m taiga storage clean-storaged-objects --help
TAIGA_STORAGE__DAYS_TO_STORE_DELETED_STORAGED_OBJECTS
(int or None for all) andTAIGA_STORAGE__DAYS_TO_STORE_DELETED_STORAGED_OBJECTS
(use cron format)