2011-12-21 19 views
1

我使用django-postman提供用戶到用戶的信息設備,這使用Django的ajax-selects爲用戶名提供autocomplete設備發送消息時。我需要爲Django用戶聲明一個頻道並將其傳遞給postman應用程序。這裏是如何做到的。我宣佈一個通道如下圖所示,並如何申報的Django用戶模型查找CHANNEL在Django Ajax的選擇

AJAX_LOOKUP_CHANNELS = { 
    # pass a dict with the model and the field to search against 
    'user' : {'model':'django.contrib.auth.User', 'search_field':'username'}, 
} 

在這裏我將它傳遞給postman應用

POSTMAN_AUTOCOMPLETER_APP = { 
     'name': 'ajax_select', 
     'field': 'AutoCompleteField', 
     'arg_name': 'channel', 
     'arg_default': 'user', # no default, mandatory to enable the feature 
    } 

但是當我這樣做,我得到一個template syntax errorCaught ValueError while rendering: too many values to unpack

任何人可以幫助我知道這裏真的發生了什麼。

回答

4
AJAX_LOOKUP_CHANNELS = { 
    'user' : {'model': 'auth.user', 'search_field': 'username'}, 
} 

改變'django.contrib.auth.User''auth.user'