Django / Pinax model - Wanted

3 views
Skip to first unread message

Nemo

unread,
Nov 19, 2009, 11:32:13 AM11/19/09
to Pinax Users
Hey everyone!

there is a typical problem when you don't want to physically delete
your objects from the database, but just make them "inactive" or
"archived". So a user can't see them anymore, at the same time they
stay recoverable. Similar thing with objects which are "just created"
- sometimes you need them to be "activated". Some implementations
require that after "activation" an object can't be moved to the
previous state etc. - by that require some "workflow" logic.

Could somebody please advise whether there is already a class / model
in Django / Pinax which handles such "States" (like Initialized /
Active / Inactive / Archived)? And probably some basic workflow? So to
help me avoid reinventing a wheel.

Many thanks

A

skylar....@gmail.com

unread,
Nov 19, 2009, 11:51:05 AM11/19/09
to pinax...@googlegroups.com
Is there a reason that a bool or select field wouldn't suffice? You could also I suppose create a new table with a genericFK and check if the obj has such a relation... I don't know of any reusables that so this sort of thing generically </2cents>
--

You received this message because you are subscribed to the Google Groups "Pinax Users" group.
To post to this group, send email to pinax...@googlegroups.com.
To unsubscribe from this group, send email to pinax-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pinax-users?hl=.




...

Tom Clancy

unread,
Nov 19, 2009, 12:20:55 PM11/19/09
to Pinax Users
Yes, I think it's pretty common to either have an 'active' or
'deleted' boolean field. Often you create a custom manager (e.g.,
http://www.djangosnippets.org/snippets/562/) and assign it to a
property name of "live" in your model to so you can get all active
objects with MyModel.live.all()

ptone

unread,
Nov 19, 2009, 3:10:10 PM11/19/09
to Pinax Users
This is more of a general django question, not a pinax question - but
you might take a look at django-reversion - which allows you to add
generic versioning to any model. The same approach could be used to
add a state and workflow abstraction to your models, but it will
likely be less work if you just build your custom workflow in, as
opposed to abstract out a general tool. Not sure there is a universal
enough use case to justify a universal abstract tool here.

some other possible links of interest:

http://code.google.com/p/goflow/
http://github.com/maaku/django-workflow

-Preston

Nemo

unread,
Nov 23, 2009, 5:15:04 AM11/23/09
to Pinax Users
Many thanks for useful answers,

Bests,

A


On Nov 19, 9:10 pm, ptone <pres...@ptone.com> wrote:
> This is more of a general django question, not a pinax question - but
> you might take a look at django-reversion - which allows you to add
> generic versioning to any model.  The same approach could be used to
> add a state and workflow abstraction to your models, but it will
> likely be less work if you just build your custom workflow in, as
> opposed to abstract out a general tool.  Not sure there is a universal
> enough use case to justify a universal abstract tool here.
>
> some other possible links of interest:
>
> http://code.google.com/p/goflow/http://github.com/maaku/django-workflow
Reply all
Reply to author
Forward
0 new messages