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

feat: command to find orphans medias in a pytition install #250

Merged
merged 3 commits into from
Sep 3, 2020

Conversation

bbmt-bbmt
Copy link
Contributor

La commande utilise le path d'un media dans mediaroot et cherche si ce path est contenu dans une des petitions ou dans twitter_image.
Si ce n'est pas le cas, le chemin du fichier est affiché. Cela permet de faire régulièrement le nettoyage sur une installation avec la commande suivante par exemple:

python3`` manage.py medias_orphan | xargs -I{} rm {}

Peut-être aussi utiliser avec grep pour discriminer suivant l'utilisateur:

python3 manage.py medias_orphan | grep john | xargs -I{} rm {}

@fallen fallen self-requested a review July 30, 2020 16:06
@fallen fallen added this to the 2.3 milestone Jul 30, 2020
Copy link
Member

@fallen fallen left a comment

Choose a reason for hiding this comment

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

Good idea, looks good except the minor style issue.
Thanks!

pytition/petition/management/commands/medias_orphan.py Outdated Show resolved Hide resolved
Copy link
Member

@fallen fallen left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@fallen fallen merged commit 9e5d7c2 into pytition:master Sep 3, 2020
@bbmt-bbmt bbmt-bbmt deleted the orphan_media branch September 3, 2020 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants