def _method(): self.revision_context_manager.set_user(self.user) action_view = self.admin_view comment = action_view.description % model_format_dict(self.opts) self.revision_context_manager.set_comment(comment) return __()
def _get_action_choices(self): choices = [] if type(self.actions)==SortedDict: show_action = [] if hasattr(self.admin_view,'action_show_by_status'): for each_act in self.admin_view.action_always_show: show_action.append("act_{}".format(each_act)) if hasattr(self.admin_view,'action_show_by_status'): for status, value_action in self.admin_view.action_show_by_status.iteritems(): if value_action.get(self.request.GET.get(status, None)): for act in value_action.get(self.request.GET.get(status, None)): show_action.append("act_{}".format(act)) for ac, name, verbose_name, icon in self.actions.values(): if self.opts: choice = (name, verbose_name % model_format_dict(self.opts), icon) else: choice = (name, verbose_name, icon) if hasattr(self.admin_view, 'action_show_by_status'): if not name.startswith('act_'): choices.append(choice) elif name in show_action: choices.append(choice) else: choices.append(choice) else: for ac in self.actions: ac_url = ac.get_page_url() choices.append( (ac_url+'?', ac.verbose_name, ac.icon) ) return choices
def get_action_choices(self): """ Return a list of choices for use in a form object. Each choice is a tuple (name, description). """ choices = [] for ac, name, description, icon in self.actions.values(): choice = (name, description % model_format_dict(self.opts), icon) choices.append(choice) return choices
def _get_action_choices(self): choices = [] if type(self.actions)==SortedDict: for ac, name, verbose_name, icon in self.actions.itervalues(): if self.opts: choice = (name, verbose_name % model_format_dict(self.opts), icon) else: choice = (name, verbose_name, icon) choices.append(choice) else: for ac in self.actions: ac_url = ac.get_page_url() choices.append( (ac_url+'?', ac.verbose_name, ac.icon) ) return choices
def get_action_choices(self): """ Return a list of choices for use in a form object. Each choice is a tuple (name, description). """ choices = [] if sys.version < '3': items = self.actions.itervalues() else: items = self.actions.values() for ac, name, description, icon in items: choice = (name, description % model_format_dict(self.opts), icon) choices.append(choice) return choices
def get_action_choices(self): """ Return a list of choices for use in a form object. Each choice is a tuple (name, description). app_label'.Can_'model_name'_'functionname """ choices = [] for ac, name, description, icon in self.actions.itervalues(): if self.opts.model_name in [ 't_online_info_amazon_listing', 't_erp_aliexpress_online_info', 't_online_info_ebay_listing' ]: permname = '{}.Can_{}_{}'.format(self.opts.app_label, self.opts.model_name, name) if not self.request.user.is_superuser and not self.request.user.has_perm( permname): continue choice = (name, description % model_format_dict(self.opts), icon) choices.append(choice) return choices