# 83 Publication rework interventions
* adds abstract is_ready_for_publish method to PublishableObjectMixin which needs to be implemented in subclasses * adds implementation for intervention model * adds publishable check to rendering report view * adds/updates translations
This commit is contained in:
@@ -8,6 +8,8 @@ Created on: 15.11.21
|
||||
import shutil
|
||||
|
||||
from django.contrib import messages
|
||||
from django.utils import timezone
|
||||
|
||||
from user.models import User
|
||||
from django.db import models, transaction
|
||||
from django.db.models import QuerySet
|
||||
@@ -282,6 +284,22 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec
|
||||
request = self.set_geometry_conflict_message(request)
|
||||
return request
|
||||
|
||||
def is_ready_for_publish(self) -> bool:
|
||||
""" Checks whether the data passes all constraints for being publishable
|
||||
|
||||
Returns:
|
||||
is_ready (bool) : True|False
|
||||
"""
|
||||
now_date = timezone.now().date()
|
||||
binding_date = self.legal.binding_date
|
||||
is_binding_date_ready = binding_date is not None and binding_date <= now_date
|
||||
is_recorded = self.recorded is not None
|
||||
is_free_of_revocations = not self.legal.revocations.exists()
|
||||
is_ready = is_binding_date_ready \
|
||||
and is_recorded \
|
||||
and is_free_of_revocations
|
||||
return is_ready
|
||||
|
||||
|
||||
class InterventionDocument(AbstractDocument):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user