Skip to content

Commit b348b19

Browse files
committed
readme updates, general enhancements
1 parent a2204a3 commit b348b19

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
### Introduction
1010
**ActivFlow** is a generic, light-weight and extensible workflow engine for agile development and automation of complex Business Process operations.
1111

12-
Developers can emphasize towards mapping the Business Process model as ActivFlow workflow without having to worry about implementing the core workflow processing logic. The generic implementation of the workflow engine manages the automation of the Business Processes from start to finish as per the defined configuration.
12+
Developers can emphasize towards mapping the Business Process model as ActivFlow workflow without having to worry about implementing the core workflow processing logic. The generic implementation of the workflow engine manages the automation of the Business Processes from start to finish as per the defined flow.
1313

1414
What defines an ActivFlow workflow?
1515
- Business Process flow mapped as ActivFlow configuration
@@ -35,10 +35,9 @@ WORKFLOW_APPS = ['leave_request']
3535

3636
#### Step 2: Activity Configuration
3737
- Activities (States/Nodes) are represented as Django models
38-
- **AbstractInitialActivity** should be the base for the initial activity
39-
- **AbstractActivity** should be the base for all other activities
38+
- Activity must inherit from **AbstractInitialActivity**/**AbstractActivity** respectively
4039
- Custom validation logic must be defined under **clean()** on the activity model
41-
- Custom field specific validation should be defined under **app/validator** and applied to the field as **validators** attribute
40+
- Custom field specific validation should go under **app/validator** and applied to the field as **validators** attribute
4241
```python
4342
from activflow.core.models import AbstractActivity, AbstractInitialActivity
4443
from activflow.leave_request.validators import validate_initial_cap
@@ -67,9 +66,9 @@ class ManagementApproval(AbstractActivity):
6766
```
6867
#### Step 3: Flow Definition
6968
- A flow is represented by collection of Activities (States/Nodes) connected using Transitions (Edges)
70-
- Rules are applied on transitions to allow switching from one activity to another provided the condition satisfies
69+
- Rules are applied on transitions to allow routing between activities, provided, the condition satisfies
7170
- Business Process flow must be defined as **FLOW** under **app/flow**
72-
- As a default behavior, the Role maps OTO with django Group (this can be customized by developers as per the requirements)
71+
- As a default behavior, the Role maps OTO with django Group (developers, feel free to customize)
7372
```python
7473
from activflow.leave_request.models import RequestInitiation, ManagementApproval
7574
from activflow.leave_request.rules import validate_request
@@ -101,10 +100,10 @@ def validate_request(self):
101100
```
102101

103102
#### Step 5: Configure Field Visibility (Optional)
104-
- Include **config.py** in the workflow app and define **ACTIVITY_CONFIG** as Nested Ordered Dictionary if you want to have more control over what gets displayed.
105-
- Define for each activity model the visibility of fields for display on templates and forms
106-
- **create:** field will appear on activity create form
107-
- **update:** field will be available for activity update operation
103+
- Include **config.py** in the workflow app and define **ACTIVITY_CONFIG** as Nested Ordered Dictionary if you want to have more control over what gets displayed on the UI
104+
- Define for each activity model, the visibility of fields, for display on templates and forms
105+
- **create:** field will appear on activity create/initiate form
106+
- **update:** field will be available for activity update/revise operation
108107
- **display:** available for display in activity detail view
109108
```python
110109
from collections import OrderedDict as odict
@@ -130,11 +129,14 @@ ACTIVITY_CONFIG = odict([
130129
```
131130

132131
#### Step 6: Access/Permission Configuration (Optional)
133-
The logic for restricting the access is defined as **AccessDeniedMixin** under **core/mixins**
132+
The core logic to restrict the access is defined as **AccessDeniedMixin** under **core/mixins**
134133
This can be customized by the developer based on the requirements
135134

136135
#### Demo Instructions
137136
Execute the below command to configure ActivFlow for demo purpose
138137
```
139138
python demo.py
139+
140+
submitter: john.doe/12345
141+
reviewer: jane.smith/12345
140142
```

activflow/core/views.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def dispatch(self, request, *args, **kwargs):
5959
request, *args, **kwargs)
6060

6161

62-
class RollBackActivity(generic.View):
62+
class RollBackActivity(LoginRequiredMixin, generic.View):
6363
"""Rollbacks workflow task"""
6464
@transaction.atomic
6565
def post(self, request, **kwargs):
@@ -72,7 +72,7 @@ def post(self, request, **kwargs):
7272
reverse('workflow-detail', args=[app_title]))
7373

7474

75-
class DeleteActivity(generic.DeleteView):
75+
class DeleteActivity(LoginRequiredMixin, generic.DeleteView):
7676
"""Deletes activity instance"""
7777
def dispatch(self, request, *args, **kwargs):
7878
"""Overriding dispatch on DeleteView"""
@@ -156,7 +156,6 @@ def post(self, request, **kwargs):
156156
if 'save' in request.POST:
157157
redirect_to_update = True
158158
instance.update()
159-
160159
elif 'finish' in request.POST:
161160
instance.finish()
162161
else:
@@ -167,12 +166,10 @@ def post(self, request, **kwargs):
167166
instance.task.submit(
168167
app_title, self.request.user, next_activity)
169168

170-
if redirect_to_update:
171-
return HttpResponseRedirect(
172-
reverse('update', args=(
173-
app_title, instance.title, instance.id)))
174-
else:
175-
return HttpResponseRedirect(
169+
return HttpResponseRedirect(
170+
reverse('update', args=(
171+
app_title, instance.title, instance.id))
172+
) if redirect_to_update else HttpResponseRedirect(
176173
reverse('workflow-detail', args=[app_title]))
177174
else:
178175
context = {

demo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77

88
def main():
9+
"""Entry Point"""
910
print ('Setting Up demo...')
1011
django.setup()
1112
os.system('sudo rm db.sqlite3')

0 commit comments

Comments
 (0)