@task
def delete_old_documentspamattempt_data(days=30):
 older = (datetime.now() - timedelta(days=30))
 dsas = DocumentSpamAttempt.objects.filter(created__lt=older).exclude(data__isnull=True)
 dsas_reviewed = dsas.exclude(review=DocumentSpamAttempt.NEEDS_REVIEW)
 dsas_unreviewed = dsas.filter(review=DocumentSpamAttempt.NEEDS_REVIEW)
 dsas_reviewed.update(data=None)
 dsas_unreviewed.update(data=None, review=DocumentSpamAttempt.REVIEW_UNAVAILABLE)

@ task def delete_old_documentspamattempt_data ( days = 30 ) : older = ( datetime . now ( ) - timedelta ( days = 30 ) ) dsas = DocumentSpamAttempt . objects . filter ( created__lt = older ) . exclude ( data__isnull = True ) dsas_reviewed = dsas . exclude ( review = DocumentSpamAttempt . NEEDS_REVIEW ) dsas_unreviewed = dsas . filter ( review = DocumentSpamAttempt . NEEDS_REVIEW ) dsas_reviewed . update ( data = None ) dsas_unreviewed . update ( data = None , review = DocumentSpamAttempt . REVIEW_UNAVAILABLE )
delete old documentspamattempt .