2017-01-15 89 views
0

我有一個url兩個字段user_id說明和代碼:地址反向錯誤

url(r'^account_completion/(?P<user_id>d+)$/(?P<code>[-w]+)$', confirm_verification, name="confirmation_link"), 

我已經試過出現鏈接從shell得到一個錯誤

In [2]: reverse('confirmation_link', args=(123,'aaaaaaa'))/home/samuel/Documents/code/kazi/django_project/django_project/urls.py:34: 
    t = url(prefix=prefix, *t) 

--------------------------------------------------------------------------- 
NoReverseMatch       Traceback (most recent call last) 
... 
... 

NoReverseMatch: Reverse for 'confirmation_link' with arguments '(123, 'aaaaaaa')' and keyword arguments '{}' not found. 1 pattern(s) tried: ['register/account_completion/(?P<user_id>d+)$/(?P<code>[-w]+)$'] 

回答

1

你有一個錯誤在你的URL正則表達式。請嘗試以下操作:

url(r'^account_completion/(?P<user_id>\d+)/(?P<code>[-\w]+)$', 
    confirm_verification, name="confirmation_link"),