def test_first_page(self): movie_list_path = reverse('core:movie-list') request = RequestFactory().get(path=movie_list_path) response = MovieListView.as_view()(request) self.assertEqual(200, response.status_code) self.assertTrue(response.context_data['is_paginated']) self.assertInHTML( self.ACTIVE_PAGINATION_HTML.format(movie_list_path, 1, 1), response.rendered_content)
"""django_movies URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include from core.views import MovieListView, MovieCreateView, MovieDeleteView, MovieUpdateView, MovieDetailView app_name = 'core' urlpatterns = [ path('movie/list', MovieListView.as_view(), name='movie_list'), path('movie/detail/<pk>', MovieDetailView.as_view(), name='movie_detail'), path('movie/create', MovieCreateView.as_view(success_url='create'), name='movie_create'), path('movie/update/<pk>', MovieUpdateView.as_view(), name='movie_update'), path('movie/delete/<pk>', MovieDeleteView.as_view(), name='movie_delete') ]
from django.urls import path from core.views import (MovieListView, MovieDetailView, PersonDetailView, PersonListView, CreateVoteView, UpdateVoteView, MovieUploadImageView, TopMoviesView) app_name = 'core' urlpatterns = [ path('movies', MovieListView.as_view(), name='movie-list'), path('movies/top', TopMoviesView.as_view(), name='top-movies'), path('movies/<int:pk>', MovieDetailView.as_view(), name='movie-detail'), path('movies/<int:movie_id>/image/upload', MovieUploadImageView.as_view(), name='movie-image-upload'), path('movies/<int:movie_id>/vote', CreateVoteView.as_view(), name='create-vote'), path('movies/<int:movie_id>/vote/<int:pk>',