Example #1
0
# url configuration for app Insta
"""InstagramDjango URL Configuration

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

urlpatterns = [
    path('tests/', HelloWorld.as_view(), name='helloworld'),
    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='update_post'),
    path('post/delete/<int:pk>', PostDeleteView.as_view(), name='delete_post')
]
Example #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'),
]
Example #3
0
from django.urls import path
from Insta.views import HelloWorld, PostsView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView

urlpatterns = [
    path('', HelloWorld.as_view(), name='home'),
    path('posts/', PostsView.as_view(), name="posts"),
    path('posts/<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="update_post"),
    path('post/delete/<int:pk>/', PostDeleteView.as_view(),
         name="delete_post"),
]
Example #4
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, SignUp, addLike, UserDetailView

urlpatterns = [
    path('helloworld/', HelloWorld.as_view(), name='helloworld'),
    path('', PostsView.as_view(), name='posts'),
    path(
        'posts/<int:pk>'  #given an int as primary key
        ,
        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'),
    path('user_detail/<int:pk>/', UserDetailView.as_view(),
         name='user_detail'),
]
Example #5
0
    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('helloworld/', HelloWorld.as_view(), name='helloworld'),
    path('', PostsView.as_view(), name='posts'),
    path('posts/<int:pk>/', PostDetailView.as_view(), name='posts_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'),
    path('user/<int:pk>/', UserDetailView.as_view(), name='user_detail'),
    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'),
]
Example #6
0
"""InstaJZ URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/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

urlpatterns = [
    path('', HelloWorld.as_view(), name='helloworld'),
    path('posts/', PostsView.as_view(), name='posts'),  #访问这个路径是用这个view
    path('posts/<int:pk>/', PostDetailView.as_view(),
         name='post_detail'),  #int为到时候提供的integer,把其当作primary key(id)用
]
Example #7
0
"""InstaJZ 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, addLike, UserDetailView

urlpatterns = [
    path('', HelloWorld.as_view(), name='helloworld'),
    path('posts/', PostsView.as_view(), name='posts'),
    path('post/<int:pk>/', PostDetailView.as_view(), name='post_detail'),#pass int:pk as argu
    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'),
]
Example #8
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, 
                        addLike, PostCreateView, PostUpdateView, PostDeleteView, ExploreView,
                        UserDetailView, EditProfile, toggleFollow, addComment) 

urlpatterns = [
    path('helloworld/', HelloWorld.as_view(), name='helloWorld'), #当输入是空的时候返回hello world
    path('', PostsView.as_view(), name = 'posts'),#当传递进来的路径是posts的时候,我们会用PostsView.as_view()这个函数
    path('post/<int:pk>', PostDetailView.as_view(), name = 'post_detail'), #a key will be provided with the post and use it as primary key to render it.
    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('edit_profile/<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'),

]