order in displaying the messages?

#1 · open · 3 comments

View on GitHub ↗

YAmikep

Hi, Nice work. It would be nice to have a setting to define the order we want the messages to be displayed. ERROR, then WARNING, then INFO, then SUCCESS Thanks

Comments

dbrgn

That might be possible by overriding the template and using the [dictsort filter](https://docs.djangoproject.com/en/1.7/ref/templates/builtins/#dictsort). Could you try?

YAmikep

dictsort will sort by the key given in the argument but we did not define the order we would like. I do not think we can specify a function to be called on each list element prior to making comparisons? So it would not be possible to define the order: 1: Error / 2: Warning / 3: Info / 4: Success or 1: Info / 2: Success / 3: Warning / 4: Error

dbrgn

Ah, you're right, it's not a numeric value. Right now I don't really have the time to implement this, but if you have a good idea on how to do it please provide a pull request :) Shouldn't be hard to add. Sorting should be optional though. AFAIK the default order is the order in which the messages have been added. For most people that is what they want.