admin: add support for more transitions in workflow graphs (#1724)

This commit is contained in:
Frédéric Péters 2012-10-02 14:42:33 +02:00
parent fb54638215
commit a94cc30625
1 changed files with 12 additions and 5 deletions

View File

@ -113,11 +113,18 @@ def graphviz(workflow, url_prefix='', select=None, svg=True,
for status in workflow.possible_status:
i = status.id
for item in status.items:
if getattr(item, 'status', None):
next_id = item.status
else:
next_id = status.id
print >>out, 'status%s -> status%s' % (i, next_id)
next_status_ids = []
for status_key in item.__dict__:
if status_key == 'status' or \
status_key.startswith('status_') or \
status_key.endswith('_status'):
next_id = getattr(item, status_key, None)
if next_id:
next_status_ids.append(next_id)
if not next_status_ids:
next_status_ids = [status.id]
for next_id in next_status_ids:
print >>out, 'status%s -> status%s' % (i, next_id)
url = 'status/%s/items/%s/' % (i, item.id)
if getattr(item, 'label', None):
label = item.label