0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 01:46:24 +01:00

Hide "Submit for moderation" button if moderation is in progress

This commit is contained in:
Karl Hobley 2019-11-25 15:41:11 +00:00 committed by Matt Westcott
parent 2444092c31
commit ad4009633b

View File

@ -1671,6 +1671,9 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
workflow = None
return workflow
def workflow_in_progress(self):
return WorkflowState.objects.filter(page=self, status='in_progress').exists()
class Meta:
verbose_name = _('page')
verbose_name_plural = _('pages')
@ -2093,7 +2096,7 @@ class PagePermissionTester:
return self.user.is_superuser or ('publish' in self.permissions)
def can_submit_for_moderation(self):
return not self.page_locked() and self.page.has_workflow()
return not self.page_locked() and self.page.has_workflow() and not self.page.workflow_in_progress()
def can_set_view_restrictions(self):
return self.can_publish()