Skip to content

Commit

Permalink
Merge branch 'master' into fix_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief authored May 4, 2018
2 parents 8ec0d7e + 3e04c7b commit abb3565
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions shop/admin/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

from django.contrib import admin
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.forms import fields, models, widgets
from django.utils import six
from django.utils.translation import ugettext_lazy as _

from django_fsm import RETURN_VALUE

from shop.models.notification import Notify, Notification, NotificationAttachment
from shop.models.order import OrderModel

Expand Down Expand Up @@ -44,9 +46,11 @@ def __init__(self, *args, **kwargs):
def get_transition_choices(self):
choices = OrderedDict()
for transition in OrderModel.get_all_transitions():
if transition.target:
transition_name = OrderModel.get_transition_name(transition.target)
choices[transition.target] = transition_name
if isinstance(transition.target, six.string_types):
choices[transition.target] = OrderModel.get_transition_name(transition.target)
elif isinstance(transition.target, RETURN_VALUE):
for target in transition.target.allowed_states:
choices[target] = OrderModel.get_transition_name(target)
return choices.items()

def get_recipient_choices(self):
Expand Down

0 comments on commit abb3565

Please sign in to comment.