1212from django .utils .module_loading import import_string
1313from django .utils .safestring import SafeString
1414from django .utils .translation import gettext_lazy as t
15+ from django .views import View
1516from django .views .generic .edit import BaseCreateView
1617
17- from . import tasks , utils , views
18+ from . import utils
1819from .conf import settings
1920from .utils import NoDashDiGraph
2021
@@ -41,14 +42,14 @@ def __new__(mcs, name, bases, attrs):
4142 if func in nodes :
4243 node = getattr (klass , name )
4344 node .name = name
44- node .type = (
45- tasks .HUMAN
46- if isinstance (node , views .TaskViewMixin )
47- else tasks .MACHINE
48- )
45+ node .type = getattr (node , "type" , "machine" )
4946 node .workflow_cls = klass
5047 except TypeError :
5148 pass
49+ if "override_view" in attrs and isinstance (klass .override_view , str ):
50+ klass .override_view = import_string (klass .override_view )
51+ if "detail_view" in attrs and isinstance (klass .detail_view , str ):
52+ klass .detail_view = import_string (klass .detail_view )
5253 return klass
5354
5455
@@ -94,8 +95,8 @@ def save(self, **kwargs):
9495 including start end end not of an edge.
9596 """
9697
97- override_view = views .OverrideView
98- detail_view = views .WorkflowDetailView
98+ override_view = "joeflow. views.OverrideView"
99+ detail_view = "joeflow. views.WorkflowDetailView"
99100
100101 @classmethod
101102 def _wrap_view_instance (cls , name , view_instance ):
@@ -133,7 +134,7 @@ def urls(cls):
133134 """
134135 urls = []
135136 for name , node in cls .get_nodes ():
136- if isinstance (node , views . TaskViewMixin ):
137+ if isinstance (node , View ):
137138 if isinstance (node , BaseCreateView ):
138139 route = "{name}/" .format (name = name )
139140 else :
@@ -205,7 +206,7 @@ def get_graph(cls, color="black"):
205206 )
206207 for name , node in cls .get_nodes ():
207208 node_style = "filled"
208- if node .type == tasks . HUMAN :
209+ if node .type == "human" :
209210 node_style += ", rounded"
210211 graph .node (name , style = node_style , color = color , fontcolor = color )
211212
@@ -251,7 +252,7 @@ def get_instance_graph(self):
251252 style = "filled"
252253 peripheries = "1"
253254
254- if task .type == tasks . HUMAN :
255+ if task .type == "human" :
255256 style += ", rounded"
256257 if not task .completed :
257258 style += ", bold"
@@ -284,7 +285,7 @@ def get_instance_graph(self):
284285 for task in self .task_set .exclude (name__in = names ).exclude (name = "override" ):
285286 style = "filled, dashed"
286287 peripheries = "1"
287- if task .type == tasks . HUMAN :
288+ if task .type == "human" :
288289 style += ", rounded"
289290 if not task .completed :
290291 style += ", bold"
0 commit comments