Exemplo n.º 1
0
    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.contrib.auth.views import LoginView, LogoutView

from blog.views import BlogListView, BlogDetailView, BlogCreateView, BlogUpdateView, BlogDeleteView

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', BlogListView.as_view(), name="index"),
    path('<int:pk>', BlogDetailView.as_view(), name="detail"),
    path('create', BlogCreateView.as_view(), name="create"),
    path('<int:pk>/update', BlogUpdateView.as_view(), name="update"),
    path('<int:pk>/delete', BlogDeleteView.as_view(), name="delete"),
    path('login', LoginView.as_view(template_name='login.html'), name="login"),
    path('logout',
         LogoutView.as_view(template_name='logout.html'),
         name="logout"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Exemplo n.º 2
0
from blog.api.views import PostCreateApiView
from blog.views import BlogCreateView, post_action_get_view, BlogUserListView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('accounts/', include('allauth.urls')),
    path('blog/', include('blog.urls', namespace='blog')),
    path('comment_thread/', include('comments.urls', namespace='comments')),
    path('api/blog/', include('blog.api.urls', namespace='blog_api')),
    path('api/comments/', include('comments.api.urls',
                                  namespace='comments_api')),
    # Todo: path('vlog/', include('vlog.urls', namespace='vlog')) might be api

    #  blog create urls  reason for the slug
    path('blog_new/', BlogCreateView.as_view(), name='blog_create'),

    # blog api create view
    path('blog_create_api/', PostCreateApiView.as_view(), name='update'),
    path('', include('user.urls', namespace='user-page')),
    path('api/user/', include('user.api.urls', namespace='user_api')),
    path('user/<str:username>/',
         BlogUserListView.as_view(),
         name='blog_user_list'),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
Exemplo n.º 3
0
from django.urls import path
from blog.views import (
    BlogView, BlogCreateView
)

urlpatterns = [
    path('', BlogView.as_view(), name='blog'),
    path('create/', BlogCreateView.as_view(), name='create'),
]
Exemplo n.º 4
0
from django.urls import path
from blog.views import (BlogListView, BlogDetailView, BlogCreateView,
                        BlogUpdateView, BlogDeleteView)

urlpatterns = [
    path('post/<int:pk>/delete/', BlogDeleteView.as_view(),
         name='post_delete'),
    path('post/<int:pk>/edit', BlogUpdateView.as_view(), name='post_edit'),
    path('post/new/', BlogCreateView.as_view(), name='post_new'),
    path('post/<int:pk>/', BlogDetailView.as_view(), name='post_detail'),
    path('', BlogListView.as_view(), name='home'),
]
Exemplo n.º 5
0
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Import the include() function: from django.conf.urls import url, include
    3. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import url
from django.contrib import admin
from blog.views import BlogListView as blog_list
from blog.views import BlogSingleView as blog_single
from blog.views import BlogCreateView as blog_form
from blog.views import BlogUpdateView as blog_update

urlpatterns = [
    url(r'^admin/', admin.site.urls),

    # blog app urls that map the view to template.

    url(r'^$', blog_list.as_view(), name='blog'),
    url(r'blog/create/$', blog_form.as_view(), name='blog_form'),
    url(r'^blog/(?P<slug>[\w-]+)/$', blog_single.as_view(), name='single_blog'),
    url(r'^blog/update/(?P<slug>[\w-]+)/$', blog_update.as_view(), name='update_blog'),


]

Exemplo n.º 6
0
from django.urls import path
from blog.views import BlogListView,BlogCreateView,\
BlogUpdateView,BlogDeleteView,BlogDetailView
from django.contrib.auth.decorators import login_required

urlpatterns = [
    path('', BlogListView.as_view(), name='blog_list'),
    path('detail/<pk>', BlogDetailView.as_view(), name='blog_detail'),
    path('create/',
         login_required(BlogCreateView.as_view()),
         name='blog_create'),
    path('update/<pk>',
         login_required(BlogUpdateView.as_view()),
         name='blog_update'),
    path('delete/<pk>',
         login_required(BlogDeleteView.as_view()),
         name='blog_delete'),
]
Exemplo n.º 7
0
from django.conf.urls import url
from django.contrib import admin
from blog import views
from blog.views import TagSearchView, BlogDetailView, BlogCreateView

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    url(r'^$', views.home, name='blog-home'),
    url(r'^search/(?P<tag>.*)/$', TagSearchView.as_view(), name='blog-search'),
    url(r'^detail/(?P<pk>\d+)/$', BlogDetailView.as_view(),
        name='blog-detail'),
    url(r'^create/', BlogCreateView.as_view(), name='blog-create'),

    # url(r'^register',users_views.register,name='register'),
    # url(r'login',auth_views.LoginView.as_view(template_name='users/login.html'),name='login'),
    # url(r'logout',auth_views.LogoutView.as_view(template_name='users/logout.html'),name='logout'),
    # url(r'^profile',users_views.profile,name='profile'),
]
Exemplo n.º 8
0
from django.urls import path

from blog.views import (
    BlogListView,
    BlogDetailView,
    BlogCreateView,
    BlogUpdateView,
    BlogDeleteView,
)

urlpatterns = [
    path('post/<int:pk>/delete/', BlogDeleteView.as_view(),
         name='post_delete'),
    path('post/add', BlogCreateView.as_view(), name='post_add'),
    path('post/<int:pk>/', BlogDetailView.as_view(), name='post_detail'),
    path('post/<int:pk>/edit/', BlogUpdateView.as_view(), name='post_edit'),
    path('', BlogListView.as_view(), name='post_list'),
]
Exemplo n.º 9
0
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.contrib.auth.views import LoginView, LogoutView

from blog.views import BlogListView, BlogDetailView, BlogCreateView, BlogUpdateView, BlogDeleteView

urlpatterns = [
    path('', BlogListView.as_view(), name='index'),  # 記事一覧画面
    path('<int:pk>/update', BlogUpdateView.as_view(), name='update'),  # 記事編集画面
    path('<int:pk>/delete', BlogDeleteView.as_view(), name='delete'),  # 記事削除画面
    path('<int:pk>', BlogDetailView.as_view(), name='detail'),  # 記事詳細画面
    path('create', BlogCreateView.as_view(), name='create'),  # 記事投稿画面
    path('login', LoginView.as_view(template_name='login.html'),
         name='login'),  # ログイン画面
    path('logout',
         LogoutView.as_view(template_name='logout.html'),
         name='logout'),  # ログアウト画面
    path('admin/', admin.site.urls),
]
Exemplo n.º 10
0
from django.urls import path
from blog.views import blog_login_view, blog_logout_view, blog_register_view, BlogHomeView, BlogDetailView, BlogCommentView, BlogCreateView, BlogDeleteView, BlogUpdateView

app_name = 'blog'
urlpatterns = [
    path('<slug>/update_post/',
         BlogUpdateView.as_view(),
         name='blog_post_update_url'),
    path('<slug>/delete_post/',
         BlogDeleteView.as_view(),
         name='blog_post_delete_url'),
    path('create_post/', BlogCreateView.as_view(),
         name='blog_post_create_url'),
    path('accounts/logout/', blog_logout_view, name='blog_logout_url'),
    path('accounts/login/', blog_login_view, name='blog_login_url'),
    path('login/', blog_login_view, name='blog_login_url'),
    path('register/', blog_register_view, name='blog_register_url'),
    path('', BlogHomeView.as_view(), name='blog_home_url'),
    path('<slug>/comment/', BlogCommentView.as_view(), name='add_comment_url'),
    path('<slug>/', BlogDetailView.as_view(), name='post_detail_url'),
]
Exemplo n.º 11
0
    CommentFormView,
#    comment_approve,
    comment_remove,
#    ReplyFormView,
#    reply_approve,
#    reply_remove,
)


app_name = 'blog'
urlpatterns = [
    path('', IndexView.as_view(),name="index"),
    path('blog/', BlogListView.as_view(),name="blog"),
    path('search/', SearchPostView.as_view(), name='search_post'),
    path('blog_detail/<int:pk>/', BlogDetailView.as_view(),name="blog_detail"),
    path('blog_create/', BlogCreateView.as_view(),name="blog_create"),
    path('blog_update/<int:pk>/', BlogUpdateView.as_view(),name="blog_update"),
    path('blog_delete/<int:pk>/', BlogDeleteView.as_view(),name="blog_delete"),
    path('contact/', ContactView.as_view(),name="contact"),
    path('categories/', CategoryListView.as_view(), name='category_list'),
    path('tags/', TagListView.as_view(), name='tag_list'),
    path('category/<str:category_slug>/',
         CategoryPostView.as_view(), name='category_post'),
    path('tag/<str:tag_slug>/', TagPostView.as_view(), name='tag_post'),
    path('comment/<int:pk>/', CommentFormView.as_view(), name='comment_form'),
##    path('comment/<int:pk>/approve/', comment_approve, name='comment_approve'),
    path('comment/<int:pk>/remove/', comment_remove, name='comment_remove'),
##    path('reply/<int:pk>/', ReplyFormView.as_view(), name='reply_form'),
##    path('reply/<int:pk>/approve/', reply_approve, name='reply_approve'),
##    path('reply/<int:pk>/remove/', reply_remove, name='reply_remove'),
]
Exemplo n.º 12
0
from django.urls import path
from blog.views import blog_login_view, blog_logout_view, blog_register_view, BlogHomeView, BlogDetailView, BlogCommentView, BlogCreateView, BlogDeleteView, BlogUpdateView

app_name = 'blog'
urlpatterns = [

    path('<slug>/update_post/', BlogUpdateView.as_view(), name='blog_post_update_url'),
    path('<slug>/delete_post/', BlogDeleteView.as_view(), name='blog_post_delete_url'),
    path('create_post/', BlogCreateView.as_view(), name='blog_post_create_url'),
    path('accounts/logout/', blog_logout_view, name='blog_logout_url'),
    path('accounts/login/', blog_login_view, name='blog_login_url'),
    path('login/', blog_login_view, name='blog_login_url'),
    path('register/', blog_register_view, name='blog_register_url'),
    path('', BlogHomeView.as_view(), name='blog_home_url'),
    path('<slug>/comment/', BlogCommentView.as_view(), name='add_comment_url'),
    path('<slug>/', BlogDetailView.as_view(), name = 'post_detail_url'),
]
Exemplo n.º 13
0
from django.urls import path
from blog.views import (
    BlogListView,
    BlogDetailView,
    BlogCreateView,
    BlogUpdateView,
    BlogDeleteView,
    NoteListView,
    NoteDetailView,
    NoteCreateView,
    NoteUpdateView,
    NoteDeleteView,
)

urlpatterns = [
    path("", BlogListView.as_view(), name="blog_list"),
    path("post/<int:pk>/", BlogDetailView.as_view(), name="post_detail"),
    path("post/new/", BlogCreateView.as_view(), name="post_new"),
    path("post/<int:pk>/delete", BlogDeleteView.as_view(), name="post_delete"),
    path("post/<int:pk>/update", BlogUpdateView.as_view(), name="post_update"),
    path("note/new/", NoteCreateView.as_view(), name="note_new"),
    path("note/<int:pk>/", NoteDetailView.as_view(), name="note_detail"),
    path("note/<int:pk>/delete", NoteDeleteView.as_view(), name="note_delete"),
    path("note/<int:pk>/update", NoteUpdateView.as_view(), name="note_update"),
]
Exemplo n.º 14
0
from django.conf.urls import url

from blog.views import BlogListView, BlogDetailView, BlogCreateView, BlogUpdateView

app_name = 'blog'
urlpatterns = [
    url(r'^$', BlogListView.as_view(), name='blog_list'),
    url(r'^(?P<pk>\d+)/$', BlogDetailView.as_view(), name='blog_detail'),
    url(r'^create/$', BlogCreateView.as_view(), name='blog_create'),
    url(r'^update/(?P<pk>\d+)/$', BlogUpdateView.as_view(), name='blog_update'),
]