Django for workflow

77 views
Skip to first unread message

Caisys

unread,
Aug 13, 2009, 4:21:05 AM8/13/09
to Django users
Hi Everyone,
I would like to develop a small internal tool in my company for
telesales agents to fill in orders of different products then finance
can approve them and send them to the shipping department. I was going
to use php and dreamweaver but I have some python and django
knowledge. My impression is that Django mainly works like a CMS. Is it
possible to use it for the purpose I have? Are there better suited
Python frameworks? or should I stick with PHP?
Thanks

Russell Keith-Magee

unread,
Aug 13, 2009, 7:14:45 AM8/13/09
to django...@googlegroups.com
On Thu, Aug 13, 2009 at 4:21 PM, Caisys<amam...@gmail.com> wrote:
>
> Hi Everyone,
> I would like to develop a small internal tool in my company for
> telesales agents to fill in orders of different products then finance
> can approve them and send them to the shipping department. I was going
> to use php and dreamweaver but I have some python and django
> knowledge. My impression is that Django mainly works like a CMS.

This isn't the best way to describe Django. Django isn't a CMS.
However, it is a magnificent toolkit with which you can build a CMS.
It's also a magnificent tool for building any number of other
web-based applications.

> Is it
> possible to use it for the purpose I have? Are there better suited
> Python frameworks? or should I stick with PHP?

You are the only person that knows your exact requirements. Could you
do this in Django? Certainly. There may be some Django applications
out there that you will be able to reuse to make the job easier. There
might even be a turn-key solution - you'll need to do some searching
to find out if any of the tools in the community meet your
requirements.

Of course, the same is true of PHP, and any other Python framework.
Some frameworks (e.g., Plone) are more CMS-like at the cost of general
flexibility. PHP is just a language for building web apps; language
and programming model differences aside, there's not going to be that
much difference between building your tool in PHP and building your
tool in Django.

If you need a solution _right now_, then I suspect your best options
are to try and find a turn-key solution that meets your requirements,
or to stick to what you know. However, if you have some time at your
disposal, and you're interested in learning a new tool, Django is
certainly capable of doing what you describe.

Yours,
Russ Magee %-)

Tim Chase

unread,
Aug 13, 2009, 9:49:25 AM8/13/09
to django...@googlegroups.com

Russell has already addressed the "Django is mainly for CMS
development" myth.

I've done this in Django -- just created a simple
finite-state-machine of available states and the transitions
available between those states. Attributes on the states &
transitions drive the workflows. All state-changes get logged to
a state-history table so the flow is tracked. The models look
something like:

class State(Model):
name = CharField()
# ... other attributes germane to a State

class Transition(Model):
from_state = ForeignKey(State)
to_state = ForeignKey(State)
# ... other attributes germane to a transition

class MyThing(Model):
state = ForeignKey(State)
state_last_changed = TimeStamp(...)
def get_available_states(self):
"Returns the states to which this thing can transition"
# good for populating dropdown fields
available_ids = Transition.objects.filter(
from_state=self.state).values_list('id', flat=True)
return State.objects.filter(id__inavailable_ids)
def save(...):
# implement state-changed tracking and history logging

class StateHistory(Model):
thing = ForeignKey(MyThing)
state_changed = TimeStamp(...)
from_state = ForeignKey(State)
to_state = ForeignKey(State)
who = ForeignKey(User)
# ... other attributes you want to log re. the change

Hope this gives you a good place to start.

-tkc

Reply all
Reply to author
Forward
0 new messages