Move new version creation blocking from the documents app to the checkouts app.

Closes GitLab #294.
This commit is contained in:
Roberto Rosario
2016-12-22 01:45:43 -04:00
parent 71af09c1fc
commit 1e194e04fa
16 changed files with 181 additions and 99 deletions

View File

@@ -87,3 +87,14 @@ class DocumentCheckoutManager(models.Manager):
return True
else:
return not checkout_info.block_new_version
class NewVersionBlockManager(models.Manager):
def block(self, document):
self.get_or_create(document=document)
def unblock(self, document):
self.filter(document=document).delete()
def is_blocked(self, document):
return self.filter(document=document).exists()