Compare commits

..

No commits in common. "a574db73e5b6ad4067b2e5e264e32d0645874c6e" and "b40b4e63069e60f97b084670034954af0d2dc91d" have entirely different histories.

View file

@ -23,13 +23,10 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
days = options["days"] days = options["days"]
since = (datetime.utcnow() - timedelta(days=days)).date() since = datetime.utcnow() - timedelta(days=days)
print(f"Deleting map in trash since {since}") print(f"Deleting map in trash since {since}")
maps = Map.objects.filter(share_status=Map.DELETED, modified_at__lt=since) maps = Map.objects.filter(share_status=Map.DELETED, modified_at__lt=since)
for map in maps: for map in maps:
map_id = map.id
map_name = map.name
trashed_at = map.modified_at.date()
if not options["dry_run"]: if not options["dry_run"]:
map.delete() map.delete()
print(f"Deleted map {map_name} ({map_id}), trashed at {trashed_at}") print(f"Deleted map {map.name} ({map.id}), trashed on {map.modified_at}")