开发者

Django - ajax_select widget

I'm trying to replace a SelectMultiple default widget by the ajax_select one.

I followed the installation guide, here are my files:

settings.py

AJAX_LOOKUP_CHANNELS = {
    'dubberword' : dict(model='content.DubberWord', search_field='name'),
}

INSTALLED_APPS = (
# ...
    'ajax开发者_高级运维_select',
# ...
)

urls.py

urlpatterns = patterns('',
# ...
  (r'^ajax_select/', include('ajax_select.urls')),
# ...
)

models.py

class DubberWord(models.Model):
  name = models.CharField(max_length=50, unique=True)
  image = models.ImageField(upload_to='images/', blank=True, null=True)

  def __unicode__(self):
    return self.name

class Dubber(models.Model):
  name = models.CharField(max_length=50)
  words = models.ManyToManyField(DubberWord, verbose_name='Items')

  def __unicode__(self):
    return self.name

admin.py

from ajax_select import make_ajax_form

class DubberAdmin(admin.ModelAdmin):
    form = make_ajax_form(Dubber, dict(words='dubberword'))

admin.site.register(Dubber,DubberAdmin)

And trying to load the admin page for a Dubber object, I get this message

Caught TemplateDoesNotExist while rendering: autocompleteselectmultiple_dubberword.html, autocompleteselectmultiple.html


I used grappelli for the admin interface.
It supplies Autocomplete Lookups.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜