Updating a review
Let's look at the steps to do this:
- We create a URL path to update a review in
/movie/urls.py
:… urlpatterns = [ path('<int:movie_id>', views.detail, name='detail'), path('<int:movie_id>/create', views.createreview, name='createreview'), path('review/<int:review_id>', views.updatereview, name='updatereview'), ]
The path takes in the review ID (the review's primary key) – for example, http://localhost:8000/movie/review/2
.
- In
/movie/views.py
, we then adddef updatereview
:… def updatereview(request, review_id): review = get_object_or_404( Review,pk=review_id,user...