Beispiel #1
0
from django.contrib import admin
from django.urls import path

from blog.views import (ArticleListView, ArticleDetailView, ArticleCreateView,
                        ArticleUpdateView, ArticleDeleteView)

app_name = 'blog'
urlpatterns = [
    path('', ArticleListView.as_view(), name='article-list'),
    path('<int:my_id>/', ArticleDetailView.as_view(), name='article-detail'),
    # Generic detail view ArticleDetailView must be called with either an object pk or a slug in the URLconf.
    path('create/', ArticleCreateView.as_view(), name='article-create'),
    path('<int:id>/update/',
         ArticleUpdateView.as_view(),
         name='article-update'),
    path('<int:id>/delete/',
         ArticleDeleteView.as_view(),
         name='article-delete')
]
from django.urls import path
from blog.views import (
    ArticleListView,
    ArticleDetailView,
    ArticleCreateView,
    ArticleUpdateView,
    ArticleDeleteView
)

app_name = 'blog'
urlpatterns = [
    path('', ArticleListView.as_view(), name='article-list'),
    path('create/', ArticleCreateView.as_view(), name='article-create'),
    path('<int:id>/', ArticleDetailView.as_view(), name='article-detail'),
    path('<int:id>/update/', ArticleUpdateView.as_view(), name='article-update'),
    path('<int:id>/delete/', ArticleDeleteView.as_view(), name='article-delete'),


]
Beispiel #3
0
from django.urls import path
from blog.views import ArticleCreateView, ArticleListView, ArticleDeleteView, ArticleDetailView, ArticleUpdateView

app_name = "blog"

urlpatterns = [
    path('create/', ArticleCreateView.as_view(), name='CreateArticle'),
    path('articles/<pk>/', ArticleDetailView.as_view(), name='ArticleDetail'),
    path('<pk>/delete/', ArticleDeleteView.as_view(), name='ArticleDelete'),
    path('<pk>/update/', ArticleUpdateView.as_view(), name='ArticleUpdate'),
    path('articles/', ArticleListView.as_view(), name='ListArticle'),
]
Beispiel #4
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 path, include
from home import views
from blog.views import ArticleDeleteView, ArticleListView, ArticleDetailView, ArticleCreateView, ArticleUpdateView
from accounts.views import UserFormView
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('blog/<int:id>/update/', ArticleUpdateView.as_view()),
    path('blog/create/', ArticleCreateView.as_view()),
    path('blog/<int:id>/', ArticleDetailView.as_view(), name='article-detail'),
    path('blog/', ArticleListView.as_view(), name='article-list'),
    path('admin/', admin.site.urls),
    path('home/', views.main, name="main"),
    path('index/', views.main, name="main"),
    path('logout/', views.logout_user, name="logout"),
    path('search/', views.search, name="search"),
    path('<int:id>/guideprofile/', views.guide_profile, name="guide_profile"),
    path('register/', views.register),
    path('<int:id>/detail/', views.detail),
    path('blog/', include('blog.urls')),
    path('accounts/', include('accounts.urls')),
    path('login/', UserFormView.as_view()),
    path('arts/', include('arts.urls')),
Beispiel #5
0
                        ArticleCreateView, ArticleUpdateView,
                        ArticleDeleteView, ArticleDetailView,
                        CategoryCreateView, CategoryDeleteView,
                        CategoryUpdateView, CategoryDetailView, login, logout,
                        register)
from django.views.generic import TemplateView
from django.views.decorators.cache import cache_page

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', index),
    # urls_for_article
    path('article/', article_listview),
    path('article/create/', ArticleCreateView.as_view()),
    path('article/<int:pk>/delete/', ArticleDeleteView.as_view()),
    path('article/<int:pk>/update/', ArticleUpdateView.as_view()),
    path('article/<int:pk>/', ArticleDetailView.as_view()),

    # path('article/post_form/', post_form),

    # urls_for_category
    path('category/', category_listview),
    path('category/create/', CategoryCreateView.as_view()),
    path('category/<int:pk>/delete/', CategoryDeleteView.as_view()),
    path('category/<int:pk>/update/', CategoryUpdateView.as_view()),
    path('category/<int:pk>/', CategoryDetailView.as_view()),

    # urls_for_login_logout
    path('login/', login),
    path('logout/', logout),
    path('register/', register),
Beispiel #6
0
from django.urls import path

from blog.views import (
    ArticleListView,
    ArticleDetailView,
    ArticleCreateView,
    ArticleUpdateView,
    ArticleDeleteView
)

app_name = 'blog'
urlpatterns = [
    path('', ArticleListView.as_view(), name='article_list'),
    path('<int:id>/', ArticleDetailView.as_view(), name='article_detail'),
    path('create/', ArticleCreateView.as_view(), name='article_create'),
    path('update/<int:id>', ArticleUpdateView.as_view(), name='article_update'),
    path('delete/<int:id>', ArticleDeleteView.as_view(), name='article_delete'),
]