Пример #1
0
	def init_deals(self):
		if not hasattr(self, '_deals'):
			self._deals = []

		for p in dir(self):
			attr = tools.get_dict_attr(self, p)
			if not isinstance(attr, Collection) \
					and hasattr(attr, '_deal'):
				title, url, style, ajax = attr._deal
				self._deals.append({
					'title':title,
					'url':'.' + attr.__name__,
					'style':style,
					'ajax':ajax,
				})
Пример #2
0
    def init_actions(self):
        """
            Initialize list of actions for the current administrative view.
        """
        self._actions = []
        self._actions_data = {}

        for p in dir(self):
            attr = get_dict_attr(self, p)

            if hasattr(attr, '_action'):
                name, text, desc = attr._action

                self._actions.append((name, text))

                # TODO: Use namedtuple
                # Reason why we need getattr here - what's in attr is not
                # bound to the object.
                self._actions_data[name] = (getattr(self, p), text, desc)
Пример #3
0
    def init_actions(self):
        """
            Initialize list of actions for the current administrative view.
        """
        self._actions = []
        self._actions_data = {}

        for p in dir(self):
            attr = get_dict_attr(self, p)

            if hasattr(attr, "_action"):
                name, text, desc = attr._action

                self._actions.append((name, text))

                # TODO: Use namedtuple
                # Reason why we need getattr here - what's in attr is not
                # bound to the object.
                self._actions_data[name] = (getattr(self, p), text, desc)