Skip to content

Commit

Permalink
Merge pull request #758 from ontruck/feature_0.11.0/raise_if_unsaved_…
Browse files Browse the repository at this point in the history
…using_state_adding

Use_state.adding in raise_if_unsaved
  • Loading branch information
matthiask committed Sep 7, 2020
2 parents 8619999 + 997cc35 commit 16b1586
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mptt/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def register(meta, cls, **kwargs):
def raise_if_unsaved(func):
@wraps(func)
def _fn(self, *args, **kwargs):
if not self.pk:
if self._state.adding:
raise ValueError(
'Cannot call %(function)s on unsaved %(class)s instances'
% {'function': func.__name__, 'class': self.__class__.__name__}
Expand Down

0 comments on commit 16b1586

Please sign in to comment.