Beispiel #1
0
from django.urls import include, path, re_path
from post.views import (
    PostCreateView,
    PostDetailView,
    PostDeleteView,
    PostListView,
    PostUpdateView,
)

urlpatterns = [
    re_path(r'^$', PostListView.as_view(), name="List"),
    re_path(r'^create', PostCreateView.as_view(), name="Create"),
    re_path(r'^detail/(?P<pk>[\d-]+)/$',
            PostDetailView.as_view(),
            name="Details"),
    re_path(r'update/(?P<pk>[\d-]_)/$',
            PostUpdateView.as_view(),
            name="Update"),
    re_path(r'^delete/(?P<pk>[\d]+)/$',
            PostDeleteView.as_view(),
            name="Delete")
]
Beispiel #2
0
from django.conf.urls import patterns, url
from post.views import PostListView, PostDetailView, PostCreateView

urlpatterns = patterns(
    'post.views',

    url(r'^$', PostListView.as_view(), name='post-list'),
    url(r'^(?P<slug>[-_\w]+)/$', PostDetailView.as_view(), name='post-detail'),
    url(r'^add$', PostCreateView.as_view(), name='post-add'),

)
Beispiel #3
0
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path

from post.views import PostDetailView, PostListView

urlpatterns = [
    path(r'', PostListView.as_view()),
    path(r'detail/<pk>', PostDetailView.as_view()),
]
# 開発環境でのメディアファイルの配信設定
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Beispiel #4
0
from django.urls import path

from post.views import PostDetailView, PostListView

app_name = 'post'

urlpatterns = [
    path('post/<int:pk>/', PostDetailView.as_view(), name='post-detail-view'),
    path('post-feed/', PostListView.as_view(), name='post-list-view')
]
Beispiel #5
0
from django.urls import path
from post.views import PostListView, PostDetailView

app_name = 'post'

urlpatterns = [
    path('', PostListView.as_view(), name='post-list'),
    path('<int:pk>/', PostDetailView.as_view(), name='post-detail'),
]
Beispiel #6
0
    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.conf.urls.static import static
from django.contrib import admin
from django.urls import path, re_path, include

from blog import settings
from post.views import PostListView, PostDetailView, add_post

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', PostListView.as_view(), name="post-list"),

    path('detail/<int:pk>/', PostDetailView.as_view(), name="post-detail"),
    path('add/', add_post, name="post-add"),

    re_path(r'^ajaximage/', include('ajaximage.urls')),

] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \
  + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Beispiel #7
0
from django.conf.urls.defaults import patterns, include, url
from post.views import PostListView, PostDetailView 
from post.models import Post 

urlpatterns = patterns('',
	url(r'^$', PostListView.as_view(), name='home'),
	url(r'^blog/$', PostListView.as_view(), name='blog'),
	url(r'^blog/entry/(?P<pk>[\d]+)$', PostDetailView.as_view(), name='post-detail'),
)
from django.conf.urls import url
from post.views import (PostCreateView, PostDetailView, PostDeleteView,
                        PostListView, PostUpdateView, AuthorPostView)

app_name = 'post'

urlpatterns = [
    url(r'^$', PostListView.as_view(), name='List'),
    url(r'^create', PostCreateView.as_view(), name='Create'),
    url(r'^detail/(?P<pk>[\d-]+)/$', PostDetailView.as_view(), name='Details'),
    url(r'^update/(?P<pk>[\d-]+)/$', PostUpdateView.as_view(), name='Update'),
    url(r'^delete/(?P<pk>[\d-]+)/$', PostDeleteView.as_view(), name='Delete'),
    url(r'^author/(?P<username>[-\w]+)/$',
        AuthorPostView.as_view(),
        name='Author-Post')
]
Beispiel #9
0
from django.urls import path

from post.views import PostDetailView, PostListView

app_name = 'post'

urlpatterns = [
    path('', PostDetailView.as_view(), name='post-detail-view'),
    path('post-feed/', PostListView.as_view(), name='post-list-view')
]
Beispiel #10
0
    # Core links
    path("", user_view.index, name="homepage"),
    path("admin/", admin.site.urls, name="admin"),
    # Game Related Links
    path("viewGames/", AllGameView.as_view(), name="games"),
    path("viewGames/<int:game_id>/", GameTitleView, name="game-title"),
    path("newGame/", AddGameView.as_view(), name="add-game"),
    path("viewGames/platform/<str:platform>/", PlatformView, name="platform"),
    path("viewGames/search/<str:title>/", Search, name="search"),
    # Auth Links
    path("login/", auth_view.login_view, name="login"),
    path("signup/", auth_view.signup_view, name="signup"),
    path("logout/", auth_view.logout_view, name="logout"),
    # Post Links
    path("post/add/", PostCreate.as_view(), name="post-create"),
    path("posts/<int:pk>/", PostDetailView.as_view(), name="post_detail"),
    path("posts/", PostListView.as_view(), name="post-list"),
    path("post/<int:pk>/comment/", add_comment_to_post, name="add_comment_to_post"),
    # Follow Links
    path("follow/<int:user_id>", follower_view, name="follow"),
    path("unfollow/<int:user_id>", unfollow_view, name="unfollow"),
    # User/Profile Links
    path("user/<int:CustomUser_id>/", user_profile_view, name="user-profile"),
    # path("viewProfile/<str:username>/", user_profile_view, name="profile"),
    path("viewUsers/", user_list_view, name="users"),
    # Favorites
    path("favorite_game/<int:game_id>", favorite_game_view, name="favorite_game"),
    path("unfavorite_game/<int:game_id>", unfavorite_game_view, name="unfavorite_game"),
    # Statics
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Beispiel #11
0
from django.urls import path
from post.views import (PostCreateView, PostDetailView, PostListView,
                        PostUpdateView, PostDeleteView, PublishView,
                        MyDraftsView, MyPostsView)

from django.contrib.auth.decorators import login_required

app_name = 'post'

urlpatterns = [
    path('new/', PostCreateView, name='create'),
    path('me/', MyPostsView, name='me'),
    path('drafts/', MyDraftsView, name='drafts'),
    path('', PostListView.as_view(), name='list'),
    path('<pk>/', PostDetailView.as_view(), name='detail'),
    path('<pk>/update/',
         login_required(PostUpdateView.as_view()),
         name='update'),
    path('<pk>/delete/',
         login_required(PostDeleteView.as_view()),
         name='delete'),
    path('<pk>/publish/', PublishView, name='publish'),
]
Beispiel #12
0
from django.urls import path, re_path
from post.views import (
    PostListView,
    createpost_view,
    PostDetailView,
)

app_name = 'post'

urlpatterns = [
    path('', PostListView.as_view(), name='postlist'),
    path('createpost/', createpost_view, name='createpost'),
    re_path(r'(?P<slug>[\w-]+)/$', PostDetailView.as_view(),
            name='postdetail'),
]
Beispiel #13
0
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter

from post.api import CreatePostAPI, PostDetailAPI, UserPostsViewSet
from post.views import HomeView, PostDetailView, UserPostsView, CreatePostView

router = DefaultRouter()
router.register('api/1.0/blogs/(?P<blogger>[a-z0-9_-]+)', UserPostsViewSet, base_name='api_user_posts')

urlpatterns = [
    #Web URLs
    url(r'^$', HomeView.as_view(), name='post_home'),
    url(r'^blogs/(?P<blogger>[a-z0-9_-]+)/$', UserPostsView.as_view(), name='post_usersposts'),
    url(r'^blogs/(?P<blogger>[a-z0-9_-]+)/(?P<pk>[0-9]+)$', PostDetailView.as_view(), name='post_postdetail'),
    url(r'^new-post$', CreatePostView.as_view(), name='post_createpost'),

    #API URLs
    # url(r'^api/1.0/blogs/(?P<blogger>[a-z0-9_-]+)/$', UserPostsAPI.as_view(), name='api_usersposts'),
    url(r'^api/1.0/blogs/(?P<blogger>[a-z0-9_-]+)/(?P<pk>[0-9]+)$', PostDetailAPI.as_view(), name='api_postdetail'),
    url(r'^api/1.0/new-post$', CreatePostAPI.as_view(), name='api_newpost'),

    url('', include(router.urls))
]
Beispiel #14
0
from django.contrib import admin
from django.urls import path
from post.views import PostListView, PostDetailView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', PostListView.as_view()),
    path('<pk>', PostDetailView.as_view())
]
Beispiel #15
0
from django.urls import path
from post.views import PostDetailView, PostCreateView, PostUpdateView, PostLike, PostDeleteView

app_name = "post"

urlpatterns = [
    path('<int:pk>', PostDetailView.as_view(), name='detail'),
    path('new', PostCreateView.as_view(), name='new'),
    path('<int:pk>/update', PostUpdateView.as_view(), name='update'),
    path('<int:pk>/delete', PostDeleteView.as_view(), name='delete'),
    path('api/like/', PostLike, name='postlike')
]
Beispiel #16
0
from django.conf.urls import url
from post.views import (NewPostView, PostListView, CommentView, PostDetailView,
                        ProfilePage, UserProfilePage, ChangeAvatarView,
                        LikeView)
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    url(r'^(?P<user_name>[a-zA-z0-9.]+)/profile/$',
        UserProfilePage.as_view(),
        name='user_profile'),
    url(r'^profile/avatar/$', ChangeAvatarView.as_view(),
        name='change_avatar'),
    url(r'^post/new/$', NewPostView.as_view(), name='new_post'),
    url(r'^profile/me/$', ProfilePage.as_view(), name='profile'),
    url(r'^post/like/(?P<post_id>\d+)/$', LikeView.as_view(), name='like'),
    url(r'^post/comment/(?P<post_id>\d+)/$',
        CommentView.as_view(),
        name='comment'),
    url(r'^post/(?P<post_id>\d+)/$', PostDetailView.as_view(), name='post'),
    url(r'^$', PostListView.as_view(), name='posts'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)