fix: Passing unsaved model instances to related filters is no longer … (#37227)

* fix: Passing unsaved model instances to related filters is no longer allowed.
This commit is contained in:
Awais Qureshi
2025-08-20 11:16:20 +05:00
committed by GitHub
parent cb80118ebf
commit 98f4756d09

View File

@@ -522,6 +522,10 @@ def get_group_info_for_cohort(cohort, use_cached=False):
use_cached=True to use the cached value instead of fetching from the
database.
"""
if cohort.pk is None:
# Cohort not saved yet, so no PartitionGroup can be linked to it.
return (None, None)
cache = RequestCache("cohorts.get_group_info_for_cohort").data
cache_key = str(cohort.id)