Ability to specify order statuses

Create issue
Issue #680 wontfix
Former user created an issue

One of our clients would like the ability to change the possible order statuses to something more specific to his industry. The change is fairly straight-forward in my mind--just change the status field to be a foreign key to a new Status model. However, this would present some backward-incompatible changes, and I'm not sure exactly how pervasive the current static choice list is in the codebase.

Are there parts of the codebase (other than the Order model) which rely on the ORDER_STATUS tuple? What about parts that expect something like 'Pending' (or whatever the first item in the nested tuple happens to be)? Seems like I encountered some stuff like that while working on a payment module recently...

Reported by wheaties.box

Comments (2)

  1. Chris Moffitt repo owner

    This would be useful. There are some places in the admin where we do explicitly look for certain states. It would make sense to abstract this out and make it more user configurable.

  2. Hynek Cernoch

    1) The tuple ORDER_STATUS is used only on two places

    a) choices of two textfileld in db model This is used only in admin and cen be easily overriden by "formfield_for_choice_field". https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#modeladmin-methods

    "... the formfield_for_choice_field method can be overridden to change the default formfield for a field that has declared choices. For example, if the choices available to a superuser should be different than those available to regular staff, you could proceed as follows..."

    b) in the template tag status_label in payment.templatetags

    You can create customized template tag or can use an ugly hack
    payment.templatetags.ORDER_STATUS = (...your extended status tuple...)

    2) If status choices would be stored in the database there would be many issues that someone removed or broke e.g. status "new" and something does not work.

  3. Log in to comment