def delete_all_models(model_class):
    while model_class.objects.count():
        ids = model_class.objects.values_list('pk', flat=True)[:80]
        model_class.objects.filter(pk__in=ids).delete()
A sqlite3-safe deletion function to avoid "django.db.utils.OperationalError: too many SQL variables"
dataset/ETHPy150Open django-silk/silk/project/tests/util.py/delete_all_models