Ejemplo n.º 1
0
# We can create "urls.py" for each App and use this method to manage all the urls.
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 include, path
from Insta.views import MyView, PostsView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView, addLike, \
    UserDetailView, toggleFollow, EditProfile, addComment, ExploreView

urlpatterns = [
    path('myview', MyView.as_view(), name='my_view'),
    path('', PostsView.as_view(), name='posts'),
    path('posts/<int:pk>/', PostDetailView.as_view(), name='post_detail'),
    path('posts/new/', PostCreateView.as_view(), name='make_post'),
    path('posts/update/<int:pk>/',
         PostUpdateView.as_view(),
         name='update_post'),
    path('posts/delete/<int:pk>/',
         PostDeleteView.as_view(),
         name='delete_post'),
    path('like', addLike, name='addLike'),
    path('user/<int:pk>/', UserDetailView.as_view(), name='user_detail'),
    path('togglefollow', toggleFollow, name='togglefollow'),
    path('user/<int:pk>/edit_profile',
         EditProfile.as_view(),
         name='edit_profile'),
    path('comment', addComment, name='addComment'),
    path('explore', ExploreView.as_view(), name='explore'),
]
Ejemplo n.º 2
0
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'),
]
Ejemplo n.º 3
0
    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 include, path
from Insta.views import (HelloWorld, PostsView, PostDetailView, PostCreateView,
                         PostUpdateView, PostDeleteView, addLike,
                         UserDetailView, EditProfile, toggleFollow, addComment,
                         ExploreView)

urlpatterns = [
    path('', PostsView.as_view(), name='posts'),
    path('post/<int:pk>/', PostDetailView.as_view(), name='post_detail'),
    path('post/new/', PostCreateView.as_view(), name='make_post'),
    path('post/update/<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('user/edit/<int:pk>', EditProfile.as_view(), name='edit_profile'),
    path('togglefollow', toggleFollow, name='togglefollow'),
    path('comment', addComment, name='addComment'),
    path('explore', ExploreView.as_view(), name='explore'),
]