File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1389,15 +1389,17 @@ def __iter__(self) -> Iterator[tuple[str, list[str]]]:
13891389 # states__type_id, states__slug directly in the `filter()`
13901390 # works, but it does not work as expected in `exclude()`.
13911391 active_state = State .objects .get (type_id = "draft" , slug = "active" )
1392+ active_pks = [] # build a static list of the drafts we actually returned as "active"
13921393 active_drafts = drafts .filter (states = active_state )
13931394 for this_draft in active_drafts :
1395+ active_pks .append (this_draft .pk )
13941396 for alias , addresses in self ._yield_aliases_for_draft (this_draft ):
13951397 yield alias , addresses
13961398
13971399 # Annotate with the draft state slug so we can check for drafts that
13981400 # have become RFCs
13991401 inactive_recent_drafts = (
1400- drafts .exclude (states = active_state )
1402+ drafts .exclude (pk__in = active_pks ) # don't re-filter by state, states may have changed during the run!
14011403 .filter (expires__gte = show_since )
14021404 .annotate (
14031405 # Why _default_manager instead of objects? See:
You can’t perform that action at this time.
0 commit comments