{% endblock %}
``helloword/templates/base_form.html``::
{% extends "lbadminlte/base_form.html" %}
Install required static package::
$ cd helloword
$ python manager bower install
run the following command to create database and create two superuser ``admin`` and ``vicalloy``::
$ python manage.py migrate
$ python manage.py createsuperuser
$ python manage.py createsuperuser
Start the development server::
$ python manage.py runserver
Now, open a Web browser and go to "/" on your local domain – e.g., http://127.0.0.1:8000/ .
You should see the admin’s login screen. After login you can see the home page of this project.
Start a new flow
----------------
Create app and generate base code
#################################
Creating the issue app::
$ python manage.py startapp issue
Add ``issue`` to ``INSTALLED_APPS`` in ``settings.py``::
INSTALLED_APPS = [
...
'issue',
]
Creating models::
from django.db import models
from lbworkflow.models import BaseWFObj
class Issue(BaseWFObj):
title = models.CharField('Title', max_length=255)
summary = models.CharField('Summary', max_length=255)
content = models.TextField('Content', blank=True)
def __str__(self):
return self.title
``python manager.py shell`` to open django shell, and run the following code to generate skeleton code::
>>> from lbworkflow.flowgen import FlowAppGenerator
>>> from issue.models import Issue as wf_class
>>> FlowAppGenerator().gen(wf_class)
run the following command to update database::
$ python manage.py makemigrations issue
$ python manage.py migrate
Config flow
###########
You can config flow in django admin or create a python file and execute it.
Config the flow by code ``issue/wfdata.py``::
from lbworkflow.core.datahelper import create_node
from lbworkflow.core.datahelper import create_category
from lbworkflow.core.datahelper import create_process
from lbworkflow.core.datahelper import create_transition
def load_data():
load_issue()
def load_issue():
""" load_[wf_code] """
category = create_category('5f31d065-00cc-0020-beea-641f0a670010', 'HR')
process = create_process('issue', 'Issue', category=category)
create_node('5f31d065-00a0-0020-beea-641f0a670010', process, 'Draft', status='draft')
create_node('5f31d065-00a0-0020-beea-641f0a670020', process, 'Given up', status='given up')
create_node('5f31d065-00a0-0020-beea-641f0a670030', process, 'Rejected', status='rejected')
create_node('5f31d065-00a0-0020-beea-641f0a670040', process, 'Completed', status='completed')
create_node('5f31d065-00a0-0020-beea-641f0a670050', process, 'A1', operators='[vicalloy]')
create_transition('5f31d065-00e0-0020-beea-641f0a670010', process, 'Draft,', 'A1')
create_transition('5f31d065-00e0-0020-beea-641f0a670020', process, 'A1,', 'Completed')
Add the following code in the file settings.py::
LBWF_APPS = {
'issue': 'issue',
}
run the following command to load flow config to database::
$ python manage.py callfunc lbworkflow.wfdata.load_data
$ python manage.py callfunc issue.wfdata.load_data
Submit and audit
----------------
Now we can start the server and submit a issue. We also can audit the issue.
Start the development server::
$ python manage.py runserver
- Left menu
- ``Todo`` All task need you todo
- ``My`` All process you submitted
- ``Submit`` Submit a new process
- ``All`` You process that you can see
- ``Report list`` Report list