KREDIFLO
A resuable python django package that can handle state transition in your django application .
Description
- Finflo is designed to carry on FSM transition on your django application .
- Your state transition's are made easy with finflo
- customizable Actions and states with on_flow interchangable
- Pre installed signature levels for each action
TECHNOLOGY STACK
IMPORTANT LINKS
Authors
Prerequisite
- python
- Django
- Django-rest-framework
1. Installation
1.1 Initial setup
- Install finflo using pip
pip install finflo
- In your django application , browse to installed_apps section in settings.py and add this ,
INSTALLED_APPS = [
'finflo',
'rest_framework'
]
- Add this in your settings.py
FINFLO = {
'WORK_MODEL' : ['MyApp.Model','MyApp2.Model2'],
'PARTY_MODEL' : [] #optional
}
-
The PARTY_TYPE is optional , if it is not needed you can leave it as blank like this []
-
Navigate to the middleware section in your settings.py and add the finflo middleware
MIDDLEWARE = [
'finflo.middleware.TransitionUserMiddleware',
]
- Now add this peice of code in your urls.py
urlpatterns = [
path('', include('finflo.urls'))
]
1.2 Migrations
- once all the steps done from the above section 1.1 .
- now we can apply the migrations for the database using ,
- python manage.py makemigrations
- python manage.py migrate
1.3 Re-migrate
- scenario 1 : if any new values is added to the WORK_MODEL
- example for scenario 1 :
# see 1.1
FINFLO = {
'WORK_MODEL' : ['MyApp.Model','MyApp2.Model2','MyApp3.Model3'],
'PARTY_TYPE' : ['MyApp1.Model1']
}
- In the above 1.1 , you can see MyApp3.Model3 is newly addded
- Now you can remigrate the database without droping it simply by the below command .
- python manage.py migrate --fake finflo 0001
- python manage.py migrate finflo 0002
Usage
-
Once your setup is completed , whenever the objects in WORK_MODEL is created , the finflo automatically creates :
- Transition manager
- workflowitems
- workevents
-
The transition for each model can be carried out with 2 methods:
-
Navigate to the url : localhost/transition/
- in the content section use the format as below and POST
- {"type" : "MyApp.Model" , "action" : "MyAction" , "t_id" : "1"}
-
In Postman , pass the following key in body as follows
- t_id (transition_id)
- type (model_type)
- action
- Example
-
-
Some important information for transition are as follows :
Arguments Data_Type type str action str t_id int source str interim str target str from_party str to_party str
API URLS
- List of all Url's
| Api URL's | METHOD | FORM DATA | QUERY_PARAMS |
|---|---|---|---|
| localhost/model/ | GET | NONE | ?type=Model&t_id=1 or or t_id=1 |
| localhost/transition/ | POST | action , type , t_id , optional : from_party , to_party , source , interim , target |
NONE |
| localhost/transition/reset/ | POST | type , t_id | NONE |
| localhost/action/ | GET , POST | description , model , from_state ,to_state , from_party , to_party , stage_required |
?action=MYACTION or ?action=MYACTION&?model=Model |
| localhost/signatures/ | GET , POST | name , sub_action_name | NONE |
| localhost/party-type/ | GET , POST | description | NONE |
| localhost/states/ | GET , POST | description | NONE |
| localhost/workflowitems/ | GET | NONE | NONE |
| localhost/workevents/ | GET | NONE | NONE |
MANUAL TRANSITION
-
example
from finflo.transition import FinFlotransition # create a manual transition FinFlotransition(t_id = "some id",type = "example_model",source = "your own state" , interim = "your own state" , target = "your own state" , from_party = "int or str" , to_party = "int or str" , record_datas = "model_json_data")
Support
For support, contact
Metadata
Release files for finflo 2.0.44
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| finflo-2.0.44.tar.gz | 18.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| finflo-2.0.44-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.0 kB
Release files / finflo-2.0.44.tar.gz
| Download URL | finflo-2.0.44.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
daeb3713ebbe2d4f1bdac291874ca40e333cd1f2233432822a3871f4c1b53350
|
|
BLAKE2b-256 checksum How to use checksums |
b028cee3c871cb07fade3685d33cfcab8365b48a6420690f4af67722c9cd5e61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / finflo-2.0.44-py3-none-any.whl
| Download URL | finflo-2.0.44-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26af26c4c8da748ff75f22e4884113adf3c6ccdd2477f5145e12037133ff8cc4
|
|
BLAKE2b-256 checksum How to use checksums |
5ac736fb15b662ac5810ed2a0ca8f0e56e236c4e1c2b34ced8e9bbbaaea8ff55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for finflo 2.0.44
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.