这是我的代码:
views.py
class CollDetailView(DetailView):
if self.request.user.is_authenticated:
vote = Vote.objects.get_vote_or_unsaved_blank_vote(art=self.object,user=self.request.user)
if vote.id:
vote_form_url = reverse(
'UpdateVote',
kwargs={'art_id':vote.art.id,'pk':vote.id})
else:
vote_form_url = reverse(
'CreateVote',
kwargs={
'movie_id':self.object.id}
class UpdateVote(LoginRequiredMixin, UpdateView):
form_class = VoteForm
queryset = Vote.objects.all()
class CreateVote(LoginRequiredMixin, CreateView):
form_class = VoteForm
urls.py
path('poll/arts/<int:pk>/',
CollDetailView.as_view(),
name='art_detail'),
path('poll/arts/<int:art_id>/vote',
CreateVote.as_view(),
name='CreateVote'),
path('poll/arts/<int:art_id>/vote',
UpdateVote.as_view(),
name='UpdateVote')
我收到此错误:
找不到带有关键字参数'{'movie_id':29}'的'CreateVote'。尝试了1种模式:['poll \ / arts \ /(?P [0-9] +)\ / vote $']
说实话,我是小学生,我不知道该如何解决