Example #1
0
 def _get_object_list(self):
     if self._object_list is None:
         query = self.query or self.query_factory()
         get_pk = self.get_pk
         self._object_list = [(text_type(get_pk(obj)), obj)
                              for obj in query]
     return self._object_list
Example #2
0
def list_formatter(view, values):
    """
        Return string with comma separated values

        :param values:
            Value to check
    """
    return u', '.join(text_type(v) for v in values)
Example #3
0
    def get_actions_list(self):
        """
            Return a list and a dictionary of allowed actions.
        """
        actions = []
        actions_confirmation = {}

        for act in self._actions:
            name, text = act

            if self.is_action_allowed(name):
                actions.append((name, text_type(text)))

                confirmation = self._actions_data[name][2]
                if confirmation:
                    actions_confirmation[name] = text_type(confirmation)

        return actions, actions_confirmation
Example #4
0
    def get_actions_list(self):
        """
            Return a list and a dictionary of allowed actions.
        """
        actions = []
        actions_confirmation = {}

        for act in self._actions:
            name, text = act

            if self.is_action_allowed(name):
                actions.append((name, text_type(text)))

                confirmation = self._actions_data[name][2]
                if confirmation:
                    actions_confirmation[name] = text_type(confirmation)

        return actions, actions_confirmation
Example #5
0
    def get_options(self, view):
        """
            Return list of predefined options.

            Override to customize behavior.

            :param view:
                Associated administrative view class.
        """
        if self.options:
            return [(v, text_type(n)) for v, n in self.options]

        return None
Example #6
0
    def get_options(self, view):
        """
            Return list of predefined options.

            Override to customize behavior.

            :param view:
                Associated administrative view class.
        """
        if self.options:
            return [(v, text_type(n)) for v, n in self.options]

        return None
Example #7
0
    def get_options(self, view):
        """
            Return list of predefined options.

            Override to customize behavior.

            :param view:
                Associated administrative view class.
        """
        options = self.options

        if options:
            if callable(options):
                options = options()

            return [(v, text_type(n)) for v, n in options]

        return None
Example #8
0
    def get_options(self, view):
        """
            Return list of predefined options.

            Override to customize behavior.

            :param view:
                Associated administrative view class.
        """
        options = self.options

        if options:
            if callable(options):
                options = options()

            return [(v, text_type(n)) for v, n in options]

        return None
Example #9
0
 def _get_object_list(self):
     if self._object_list is None:
         query = self.query or self.query_factory()
         get_pk = self.get_pk
         self._object_list = [(text_type(get_pk(obj)), obj) for obj in query]
     return self._object_list
Example #10
0
def get_pk_from_identity(obj):
    # TODO: Remove me
    cls, key = identity_key(instance=obj)
    return u':'.join(text_type(x) for x in key)