-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#105] Introduce context variable which contains information about th…
…e hooking as well and document the dynamic hooking [WIP]
- Loading branch information
Showing
16 changed files
with
324 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ factory-boy==2.11.1 | |
mock==2.0.0 | ||
pyhamcrest==1.9.0 | ||
django-cte==1.1.4 | ||
django-codemirror2==0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
from django.contrib import admin | ||
|
||
from river.admin.transitionapprovalmeta import TransitionApprovalMetaAdmin | ||
from river.admin.workflow import WorkflowAdmin | ||
from river.admin.function_admin import * | ||
from river.admin.transitionapprovalmeta import * | ||
from river.admin.workflow import * | ||
from river.admin.hook_admins import * | ||
from river.models import State | ||
|
||
admin.site.register(State) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from codemirror2.widgets import CodeMirrorEditor | ||
from django import forms | ||
from django.contrib import admin | ||
|
||
from river.models import Function | ||
|
||
|
||
class FunctionForm(forms.ModelForm): | ||
body = forms.CharField(widget=CodeMirrorEditor(options={'mode': 'python'})) | ||
|
||
class Meta: | ||
model = Function | ||
fields = ('name', 'body',) | ||
|
||
|
||
class FunctionAdmin(admin.ModelAdmin): | ||
form = FunctionForm | ||
list_display = ('name', 'function_version', 'date_created', 'date_updated') | ||
readonly_fields = ('version', 'date_created', 'date_updated') | ||
|
||
def function_version(self, obj): | ||
return "v%s" % obj.version | ||
|
||
|
||
admin.site.register(Function, FunctionAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from django.contrib import admin | ||
|
||
from river.models import OnApprovedHook, OnTransitHook, OnCompleteHook | ||
|
||
|
||
class OnApprovedHookAdmin(admin.ModelAdmin): | ||
list_display = ('workflow', 'callback_function', 'transition_approval_meta') | ||
|
||
|
||
class OnTransitHookAdmin(admin.ModelAdmin): | ||
list_display = ('workflow', 'callback_function', 'source_state', 'destination_state') | ||
|
||
|
||
class OnCompleteHookAdmin(admin.ModelAdmin): | ||
list_display = ('workflow', 'callback_function') | ||
|
||
|
||
admin.site.register(OnApprovedHook, OnApprovedHookAdmin) | ||
admin.site.register(OnTransitHook, OnTransitHookAdmin) | ||
admin.site.register(OnCompleteHook, OnCompleteHookAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 2.1.4 on 2019-10-16 22:31 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('river', '0003_auto_20191015_1628'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='onapprovedhook', | ||
name='hook_type', | ||
field=models.CharField(choices=[('BEFORE', 'Before'), ('AFTER', 'After')], max_length=50, verbose_name='When?'), | ||
), | ||
migrations.AlterField( | ||
model_name='oncompletehook', | ||
name='hook_type', | ||
field=models.CharField(choices=[('BEFORE', 'Before'), ('AFTER', 'After')], max_length=50, verbose_name='When?'), | ||
), | ||
migrations.AlterField( | ||
model_name='ontransithook', | ||
name='hook_type', | ||
field=models.CharField(choices=[('BEFORE', 'Before'), ('AFTER', 'After')], max_length=50, verbose_name='When?'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.