from django.urls import path from Insta.views import HelloDjango, PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView, addLike urlpatterns = [ path('test/', HelloDjango.as_view(), name='helloworld'), path('posts/', PostListView.as_view(), name='posts'), path('posts/<int:pk>/', PostDetailView.as_view(), name='post_detail'), path('posts/new/', PostCreateView.as_view(), name='post_create'), path('posts/update/<int:pk>', PostUpdateView.as_view(), name='post_update'), path('posts/delete/<int:pk>', PostDeleteView.as_view(), name='post_delete'), path('like', addLike, name='addLike'), ]
from django.urls import path, include from Insta.views import PostListView, PostDetailView, PostCreateView, PostUpdateView urlpatterns = [ path('', PostListView.as_view()), path('post/<int:pk>/', PostDetailView.as_view(), name='post'), path('post/new/', PostCreateView.as_view(), name='make_post'), path('post/edit/<int:pk>', PostUpdateView.as_view(), name='post_edit'), ]
from django.urls import path from Insta.views import (EditProfile, ExploreView, PostCreateView, PostDeleteView, PostDetailView, PostListView, PostUpdateView, SignUp, UserProfile, addComment, addLike, toggleFollow) urlpatterns = [ path('', PostListView.as_view(), name='home'), path('post/<int:pk>/', PostDetailView.as_view(), name='post'), path('post/new/', PostCreateView.as_view(), name='make_post'), path('post/edit/<int:pk>', PostUpdateView.as_view(), name='edit_post'), path('post/delete/<int:pk>', PostDeleteView.as_view(), name='delete_post'), path('auth/signup', SignUp.as_view(), name='signup'), path('user_profile/<int:pk>/', UserProfile.as_view(), name='profile'), path('edit_profile/<int:pk>/', EditProfile.as_view(), name='edit_profile'), path('togglefollow', toggleFollow, name='togglefollow'), path('like', addLike, name='addLike'), path('comment', addComment, name='addComment'), path('explore', ExploreView.as_view(), name='explore'), ]
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 Insta.views import HelloWorld, PostListView, PostDetailView, PostCreatView, PostUpdateView, PostDeleteView, addLike, UserDetailView, addComment, toggleFollow, EditProfile urlpatterns = [ path('index', HelloWorld.as_view(), name='HelloWorld'), path('', PostListView.as_view(), name='index'), path('post/<int:pk>/', PostDetailView.as_view(), name='post_detail'), path('new/', PostCreatView.as_view(), name='make_post'), path('post/edit/<int:pk>/', PostUpdateView.as_view(), name='post_update'), path('post/delete/<int:pk>/', PostDeleteView.as_view(), name='post_delete'), path('like', addLike, name='addlike'), path('user/<int:pk>/', UserDetailView.as_view(), name='user_detail'), path('comment', addComment, name='addcomment'), path('togglefollow', toggleFollow, name='togglefollow'), path('edit_user/<int:pk>/', EditProfile.as_view(), name='edit_profile'), ]