def subscribe_to_basket_action(newsletter):
 def subscribe_to_basket(modeladmin, request, queryset):
  'Subscribe to Basket or update details of already subscribed.'
  ts = [subscribe_user_to_basket.subtask(args=[userprofile.id, [newsletter]]) for userprofile in queryset]
  TaskSet(ts).apply_async()
  messages.success(request, 'Basket update started.')
 subscribe_to_basket.short_description = 'Subscribe to or Update {0}'.format(newsletter)
 subscribe_to_basket.__name__ = 'subscribe_to_basket_{0}'.format(newsletter.replace('-', '_'))
 return subscribe_to_basket

def subscribe_to_basket_action ( newsletter ) : def subscribe_to_basket ( modeladmin , request , queryset ) : ts = [ subscribe_user_to_basket . subtask ( args = [ userprofile . id , [ newsletter ] ] ) for userprofile in queryset ] TaskSet ( ts ) . apply_async ( ) messages . success ( request , 'Basket update started.' ) subscribe_to_basket . short_description = 'Subscribe to or Update {0}' . format ( newsletter ) subscribe_to_basket . __name__ = 'subscribe_to_basket_{0}' . format ( newsletter . replace ( '-' , '_' ) ) return subscribe_to_basket
subscribe to basket action .