cli-delete-posts

Added the possibility to delete single posts or a range of multiple posts at once using the command as following:<br/>
`docker-compose run server ./szuru-admin --delete posts 35 36 40-45`<br/>
Each space represents a single post id, using a `-` between two ids will delete all posts within range, including the first and the last one
This commit is contained in:
anbosuki 2022-07-04 19:22:35 +02:00
parent 03a513b8b6
commit 97dfc1f21f

View file

@ -119,6 +119,9 @@ def delete_posts(parameters: list) -> None:
snapshots.delete(post, None)
def delete_multiple_posts(start_id: int, end_id: int) -> None:
if start_id > end_id:
start_id, end_id = end_id, start_id
for post_id in range(start_id, end_id + 1):
delete_one_post(post_id)