我使用Django的基於類的視圖獲取Django的錯誤的觀點與自定義函數
class MyView(TemplateView):
def return_JSON(self, object_id):
parent = models.UserForm.objects.get(pk=object_id)
url(r'^return/(?P<object_id>\d+)/json/', views.MyView().return_JSON, name="return_json")
我得到這個錯誤
return_JSON() got multiple values for keyword argument 'object_id'
經過http://stackoverflow.com/questions/13544504/django-form-got-multiple -values-for-keyword-argument&http://stackoverflow.com/questions/3387766/object-detail-got-multiple-values-for-keyword-argument-queryset-while-inputt – avasal
我試着把請求放在函數中然後我得到'對象沒有屬性'請求'' – user825904