gpt4 book ai didi

python - Django - ajax_select 小部件

转载 作者:行者123 更新时间:2023-11-28 19:27:28 24 4
gpt4 key购买 nike

我正在尝试用 ajax_select 替换 SelectMultiple 默认小部件一个。

我按照安装指南操作,这是我的文件:

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')),
# ...
)

模型.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)

然后尝试为 Dubber 对象加载管理页面,我收到此消息

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

最佳答案

我使用 grappelli 作为管理界面。
它提供自动完成查找。

关于python - Django - ajax_select 小部件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6666059/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com