示例#1
0
    def plugin(self):
        """
        Access the parent plugin which renders this model.

        :rtype: :class:`~fluent_contents.extensions.ContentPlugin`
        """
        from fluent_contents.extensions import plugin_pool
        if self.__class__ in (ContentItem,):
            # Also allow a non_polymorphic() queryset to resolve the plugin.
            # Corresponding plugin_pool method is still private on purpose.
            # Not sure the utility method should be public, or how it should be named.
            return plugin_pool._get_plugin_by_content_type(self.polymorphic_ctype_id)
        else:
            return plugin_pool.get_plugin_by_model(self.__class__)
示例#2
0
    def plugin(self):
        """
        Access the parent plugin which renders this model.

        :rtype: :class:`~fluent_contents.extensions.ContentPlugin`
        """
        from fluent_contents.extensions import plugin_pool
        if self.__class__ in (ContentItem, ):
            # Also allow a non_polymorphic() queryset to resolve the plugin.
            # Corresponding plugin_pool method is still private on purpose.
            # Not sure the utility method should be public, or how it should be named.
            return plugin_pool._get_plugin_by_content_type(
                self.polymorphic_ctype_id)
        else:
            return plugin_pool.get_plugin_by_model(self.__class__)
示例#3
0
 def plugin(self):
     """
     Access the parent plugin which renders this model.
     """
     from fluent_contents.extensions import plugin_pool
     return plugin_pool.get_plugin_by_model(self.__class__)