forked from viewflow/cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurls.py
85 lines (76 loc) · 2.71 KB
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
from django.contrib import admin
from django.contrib.auth import login
from django.contrib.auth.models import User
from django.views.generic import TemplateView
from django.shortcuts import redirect
from django.urls import path, include
from viewflow.contrib.auth import AuthViewset
from viewflow.urls import Application, Site
from viewflow.workflow.flow import FlowAppViewset
from ..bloodtest.flows import BloodTestFlow
from ..dynamic_split.flows import DynamicSplitFlow
from ..helloworld.flows import HelloWorldFlow
from ..reassign.flows import ReassignFlow
from ..shipment.flows import ShipmentFlow
from ..shipment.viewsets import ShipmentViewset, CarierViewset
from ..subprocesses.flows import OrderItemFlow, CustomerVerificationFlow, OrderFlow
site = Site(
title="Workflow 101 Demo",
viewsets=[
Application(
app_name="intro",
icon="account_balance",
title="Introduction",
menu_template_name=None,
urlpatterns=[
path(
"",
TemplateView.as_view(template_name="workflow101/index.html"),
name="index",
),
],
),
FlowAppViewset(HelloWorldFlow, icon="assignment"),
FlowAppViewset(DynamicSplitFlow, icon="call_split"),
FlowAppViewset(BloodTestFlow, icon="bloodtype"),
FlowAppViewset(ReassignFlow, icon="swap_horiz"),
Site(
app_name="subprocess",
title="Orders processing",
icon="account_tree",
permission="view_orderprocess",
primary_color="#d20011",
viewsets=[
FlowAppViewset(OrderFlow, icon="shopping_cart"),
FlowAppViewset(CustomerVerificationFlow, icon="hail"),
FlowAppViewset(OrderItemFlow, icon="toc"),
FlowAppViewset(
ShipmentFlow,
icon="local_shipping",
viewsets=[
CarierViewset(),
ShipmentViewset(),
],
),
],
),
],
)
def users(request):
return {"users": User.objects.filter(is_active=True).order_by("-username")}
def login_as(request):
try:
user = User.objects.get(username=request.GET.get("username"))
except User.DoesNotExist:
pass
else:
user.backend = "django.contrib.auth.backends.ModelBackend"
login(request, user)
return redirect("/")
urlpatterns = [
path("admin/", admin.site.urls),
path("accounts/", AuthViewset().urls),
path("login_as/", login_as, name="login_as"),
path("", include("cookbook.workflow101.hellorest.urls")),
path("", site.urls),
]