I’ve got this urls.py :
urlpatterns = patterns('',
# Plugin actions
url(r'plugin/((?P<slug>[a-zA-Z0-9_\-]*)/)?$', PluginView.as_view(), name='wa-plugin'),
)
Then when I use reverse :
reverse('wa-plugin', args=[u'plugin-header-1'])
or even
reverse('wa-plugin', kwargs={'slug':u'plugin-header-1'})
I get
NoReverseMatch: Reverse for 'wa-plugin' with arguments
'('plugin-header-1',)' and keyword arguments '{}' not found.
Do you have any ideas of how I can make it works ?
if the problem is the optional argument, one way around that is to define two url entries (to the same view):
(pretty sure you can even use the same name, since they have different “signatures (kwargs)”)