import threading
from contextlib import contextmanager
_state = threading.local()
from django.db import models
from django.db.models import Avg, Count, Sum, DecimalField
from django.db.models.functions import Coalesce, TruncDate
from django.utils import timezone
import base64
import json
from django.core.exceptions import BadRequest
from django.db import models
from django.utils import timezone
class SoftDeleteQuerySet(models.QuerySet):
def delete(self):