Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_final_states(content_type):
"""
A state which is not a source of a transition but can be destination of a transition OR not (a source of a transition and this transition direction is FORWARD)
"""
proceedings = ProceedingService.get_final_proceedings(content_type)
if proceedings.count() == 0:
raise RiverException(ErrorCode.NO_AVAILABLE_FINAL_STATE, 'There is no available final state for the content type %s.' % content_type)
return State.objects.filter(pk__in=proceedings.values_list('meta__transition__destination_state', flat=True))
def details(self):
detail = super(State, self).details()
detail.update(
{
'label': self.label,
'description': self.description
}
)
return detail
def __init__(self, *args, **kwargs):
self.field_name = None
kwargs['null'] = True
kwargs['blank'] = True
kwargs['to'] = '%s.%s' % (State._meta.app_label, State._meta.object_name)
kwargs['on_delete'] = kwargs.get('on_delete', CASCADE)
kwargs['related_name'] = "+"
super(StateField, self).__init__(*args, **kwargs)