divio/django-cms — Issue #1077: CMSPlugin.get_plugin_instance performance consideration
Author: ojii
Created: 2011-10-29 16:21:38+00:00
State: open

In order to allow developers to use custom managers on their plugin model classes to auto-select_related related models, get_plugin_instance should probably use ``plugin_class.model.objects.get(cmsplugin_ptr=self)``, since the current implementation uses ``plugin_class._base_manager`` (see ``django.db.models.fields.related.SingleRelatedObjectDescriptor.__get__``) ignoring all custom managers. The only advantage of using the ``SingleRelatedObjectDescriptor`` to access the plugin instance here is that this descriptor caches the object. This could be implemented easily in our code though.