Clean up old failed uploads
1)
Make a model manager hiding
Data.upload_completed_successfully = False
Something like how we manage ChaHub users:
class ChaHubUserManager(UserManager):
def get_queryset(self):
return super().get_queryset().filter(deleted=False)
def all_objects(self):
return super().get_queryset()
2)
Clean up uploads that failed > 3 days ago:
older_than_3_days = now()-timedelta(days=3)
# may need to access model manager differently, like Data.objects.include_unsuccessful ...
Data.objects.filter(upload_completed_successfully=False, created_when__gte=older_than_3_days).delete()