嗨Stackoverflow人,Django:使用參數調用views.py
我爲我的用戶註冊站點使用Userena軟件包。該包允許在調用views.py函數「def profile_edit」期間(如果我正確理解)更改模板或表單類。
視圖功能的完整標題是:
def profile_edit(request, username, edit_profile_form=EditUserProfileForm,
template_name='userena/profile_form.html', success_url=None,
extra_context=None):
示範項目通過urls.py的發言
{% url userena_profile_edit user.username %}
當我試圖改變調用模板中的視圖功能例如與形式參數
{% url userena_profile_edit user.username edit_profile_form=EditUserProfileForm %}
我得到的跟隨錯誤,它會做n對我有意義:
Caught ValueError while rendering: Don't mix *args and **kwargs in call to reverse()!
我也試圖指定kwargs字典,但它也沒有工作。
{% url userena_profile_edit user.username kwargs={'edit_profile_form':EditUserProfileForm} %}
如何正確調用該函數?我很困惑爲什麼最後的聲明不起作用。
謝謝你的幫助!
您應該向我們展示'urls.py'中相關行的外觀如何。 – Lycha
#修改個人資料 URL(R '^(θP [\。\ w] +)/編輯/ $', userena_views.profile_edit, 名= 'userena_profile_edit'), –
neurix