Skip to content Skip to sidebar Skip to footer

Why The Url Works With Parameter Pk And Not Pk2?

When I try to send pk2 or any other argument, it raises an AssertionError. What I mean is this that the url path('grade//', IndividualGrade.as_view(), name='get-grade

Solution 1:

you need to add

lookup_field = 'pk2'

when you are using something else than pk, which is inbuilt for lookup . when you want something else in the url you need to mention that.

Post a Comment for "Why The Url Works With Parameter Pk And Not Pk2?"