Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

added setting for enabling the select2 widget #21

Merged
merged 1 commit into from

3 participants

@alesdotio

No description provided.

@digi604 digi604 commented on the diff
stacks/cms_plugins.py
@@ -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):
@digi604 Collaborator
digi604 added a note

could we check here if select2 is in INSTALLED_APPS as well and make the default TRUE if it is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@stefanfoulis stefanfoulis merged commit d8b53d8 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 15, 2013
  1. @alesdotio
This page is out of date. Refresh to see the latest.
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):
@digi604 Collaborator
digi604 added a note

could we check here if select2 is in INSTALLED_APPS as well and make the default TRUE if it is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ if db_field.name == "stack":
+ return StackSearchField(**kwargs)
return super(StackPlugin, self).formfield_for_dbfield(db_field, request=request, **kwargs)
Something went wrong with that request. Please try again.