Skip to content

Commit 47c9ccf

Browse files
committed
Handle the case of asking for get_state() on an unsaved document
- Legacy-Id: 7779
1 parent 3c88dc1 commit 47c9ccf

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

ietf/doc/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ def get_state(self, state_type=None):
122122
"""Get state of type, or default state for document type if
123123
not specified. Uses a local cache to speed multiple state
124124
reads up."""
125+
if self.pk == None: # states is many-to-many so not in database implies no state
126+
return None
127+
125128
if state_type == None:
126129
state_type = self.type_id
127130

0 commit comments

Comments
 (0)