Esempio n. 1
0
"""helloworld_project URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.0/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 include, path
from insta.views import HelloWorld, PostsView, PostDeleteView, UserDetailView, PostUpdateView, PostDetailView, PostCreateView, addLike

urlpatterns = [
    path('', PostsView.as_view(), name='helloworld'),
    path('posts/', 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'),
]
Esempio n. 2
0
"""instagram URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.0/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 include, path
from insta.views import HelloWorld, PostsView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView

urlpatterns = [
    path('', HelloWorld.as_view(), name='helloworld'),
    path('posts/', 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="post_update"),
    path('posts/delete/<int:pk>', PostDeleteView.as_view(),
         name="post_delete"),
]
Esempio n. 3
0
from django.contrib.auth.decorators import login_required
from django.urls import path

from insta.views import PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView, PostLikeAPIToggle, \
    PostLikeToggle, CommentCreateView

app_name = 'insta'

urlpatterns = [
    path('', (PostListView.as_view()), name='post_list'),
    path('detail/<int:id>', PostDetailView.as_view(), name='post_detail'),
    path('new/', PostCreateView.as_view(), name='post_new'),
    path('update/<int:id>/', PostUpdateView.as_view(), name='post_update'),
    path('delete/<int:id>/', PostDeleteView.as_view(), name='post_delete'),
    path('<int:id>/likes/', PostLikeToggle.as_view(), name='like_toggle'),
    path('api/<int:id>/likes/',
         PostLikeAPIToggle.as_view(),
         name='like_api_toggle'),
    path('create-comment/<pk>',
         CommentCreateView.as_view(),
         name='create_comment'),
]