Refactor: put the delete rule constants into the queryset module, too.

This commit is contained in:
Vincent Driessen
2010-12-13 13:42:01 -08:00
parent 3b55deb472
commit f30fd71c5e
2 changed files with 11 additions and 13 deletions

View File

@@ -10,11 +10,18 @@ import copy
import itertools
__all__ = ['queryset_manager', 'Q', 'InvalidQueryError',
'InvalidCollectionError']
'InvalidCollectionError', 'DO_NOTHING', 'NULLIFY', 'CASCADE', 'DENY']
# The maximum number of items to display in a QuerySet.__repr__
REPR_OUTPUT_SIZE = 20
# Delete rules
DO_NOTHING = 0
NULLIFY = 1
CASCADE = 2
DENY = 3
class DoesNotExist(Exception):
pass
@@ -882,8 +889,6 @@ class QuerySet(object):
:param safe: check if the operation succeeded before returning
"""
from document import CASCADE, DENY, NULLIFY
doc = self._document
# Check for DENY rules before actually deleting/nullifying any other