Skip to content
Browse files

Merge pull request #21 from alesdotio/develop

added setting for enabling the select2 widget
  • Loading branch information...
2 parents be898df + c3292eb commit d8b53d86973937ad0da412d90e472fa77017bfe1 @stefanfoulis stefanfoulis committed
Showing with 5 additions and 2 deletions.
  1. +5 −2 stacks/cms_plugins.py
View
7 stacks/cms_plugins.py
@@ -6,6 +6,7 @@
from stacks.fields import StackSearchField
from stacks.models import StackLink, Stack
from cms.plugins.utils import get_plugins
+from django.conf import settings
class StackPlugin(CMSPluginBase):
@@ -13,6 +14,7 @@ class StackPlugin(CMSPluginBase):
name = _("Stack")
render_template = "cms/plugins/stacks.html"
admin_preview = False
+ raw_id_fields = ('stack',)
def render(self, context, instance, placeholder):
# TODO: once we drop 2.3.x support we can just use the "render_plugin" templatetag
@@ -28,8 +30,9 @@ def render(self, context, instance, placeholder):
return context
def formfield_for_dbfield(self, db_field, request=None, **kwargs):
- if db_field.name == "stack":
- return StackSearchField(**kwargs)
+ if getattr(settings, 'DJANGOCMS_STACKS_USE_SELECT2', False):
+ if db_field.name == "stack":
+ return StackSearchField(**kwargs)
return super(StackPlugin, self).formfield_for_dbfield(db_field, request=request, **kwargs)

0 comments on commit d8b53d8

Please sign in to comment.
Something went wrong with that request. Please try again.