Skip to content

Commit

Permalink
Merge pull request #66 from jpadilla/admin-message
Browse files Browse the repository at this point in the history
Add correct message level for transition errors
  • Loading branch information
jgeskens committed Mar 19, 2015
2 parents e75f8e6 + 3c76ad6 commit ddc1271
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion django_states/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from collections import defaultdict
import logging

from django.contrib import messages
from django_states.exceptions import (TransitionNotFound, TransitionValidationError,
UnknownState, TransitionException, MachineDefinitionException)

Expand Down Expand Up @@ -244,7 +245,8 @@ def action(modeladmin, request, queryset):
get_STATE_info().test_transition(transition_name,
request.user)
except TransitionException, e:
modeladmin.message_user(request, 'ERROR: %s on: %s' % (e.message, unicode(o)))
modeladmin.message_user(request, 'ERROR: %s on: %s' % (e.message, unicode(o)),
level=messages.ERROR)
return

# Make actual transitions
Expand Down

0 comments on commit ddc1271

Please sign in to comment.