invalidate the get_state_slug cache when the get_state cache is invalidated. Fixes #2630. Commit ready for merge.
- Legacy-Id: 15720
This commit is contained in:
parent
cb02df1681
commit
f1c1b9fc6c
|
@ -263,11 +263,13 @@ class DocumentInfo(models.Model):
|
|||
if state not in already_set:
|
||||
self.states.add(state)
|
||||
self.state_cache = None # invalidate cache
|
||||
self._cached_state_slug = {}
|
||||
|
||||
def unset_state(self, state_type):
|
||||
"""Unset state of type so no state of that type is any longer set."""
|
||||
self.states.remove(*self.states.filter(type=state_type))
|
||||
self.state_cache = None # invalidate cache
|
||||
self._cached_state_slug = {}
|
||||
|
||||
def get_state(self, state_type=None):
|
||||
"""Get state of type, or default state for document type if
|
||||
|
|
Loading…
Reference in a new issue