Skip to content

Instantly share code, notes, and snippets.

View armando-herastang's full-sized avatar

Armando Heras Tang armando-herastang

View GitHub Profile
@armando-herastang
armando-herastang / qs_evaluated.py
Last active April 4, 2024 13:59
Check whether a Django queryset has been evaluated or not
from django.db.models import QuerySet
def is_qs_evaluated(qs: QuerySet) -> bool:
return getattr(qs, '_result_cache', None) is not None