djangpostman+Djangoajax选择美国政府

2024-09-27 19:20:48 发布

您现在位置:Python中文网/ 问答频道 /正文

所以我刚开始使用django-postman==3.2.2,我正试图使用django-ajax-selects==1.3.6来集成auto-complete,而使用django-authtools==1.2.0来获得一个定制的用户模型,但运气不佳。在

设置.py

AJAX_LOOKUP_CHANNELS = {
    'postman_users': dict(model='authtools.user', search_field='email'),
}
POSTMAN_AUTOCOMPLETER_APP = {
    'arg_default': 'postman_users',
}
AUTH_USER_MODEL = 'authtools.User'

我试着从model='authtools.user改为model='auth.user,但没用。在

网址.py

^{pr2}$

然后转到内置的postman视图http://localhost:8000/messages/write/,当我填充接收者输入时,什么也没有发生。在

我错过了什么?这不应该只在这些设置下工作吗?在


Tags: django用户py模型automodelajaxpostman
1条回答
网友
1楼 · 发布于 2024-09-27 19:20:48

作为一种解决方法,我最终使用了django-autocomplete-light,我发现它比django-ajax-selects更容易使用和理解 然后,我创建了自己的扩展表单并传递到write视图:

class MyCustomWriteForm(BaseWriteForm):
    recipients = autocomplete_light.ChoiceField(
        'UserAutocomplete', label='recipients')

    class Meta(BaseWriteForm.Meta):
        fields = ('recipients', 'subject', 'body')

在我的网址.py公司名称:

^{pr2}$

我想是因为这个。在

相关问题 更多 >

    热门问题