[Answer]-Django CreateView demands pk

1๐Ÿ‘

โœ…

If you look at the full traceback, you should be able to see that it is not the LampCreateView that is raising the exception.

It sounds like you have another url pattern above the lamp_create which matches /shotmaker/camera/create/ first. For example:

url(r'^camera/(?P<pk>[-\w]+)/$', views.OtherView.as_view(), name='other_view')
url(r'^camera/create/(?P<pk>[-\w]+)$', views.LampCreateView.as_view(), name='lamp_create'),

To solve the problem, move the other_view url below the lamp_create url.

๐Ÿ‘คAlasdair

Leave a comment