Skip to content

Commit

Permalink
Fix relfield select2 plugin bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
sshwsfc committed May 5, 2013
1 parent 81a00fa commit a11fd05
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xadmin/plugins/relfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django import forms
from xadmin.sites import site
from xadmin.views import BaseAdminPlugin, ModelFormAdminView
from xadmin.util import vendor

class ForeignKeySearchWidget(forms.TextInput):

Expand Down Expand Up @@ -37,6 +38,10 @@ def label_for_value(self, value):
return '%s' % escape(Truncator(obj).words(14, truncate='...'))
except (ValueError, self.rel.to.DoesNotExist):
return ""

@property
def media(self):
return vendor('select2.js', 'select2.css', 'xadmin.widget.select.js')

class RelateFieldPlugin(BaseAdminPlugin):

Expand Down

0 comments on commit a11fd05

Please sign in to comment.