Пример #1
0
from django.urls import path
from django.views.generic import TemplateView

from articleapp.views import ArticleCreateView, ArticleDetailView, ArticleUpdateView, ArticleDeleteView, ArticleListView

app_name = 'articleapp'
urlpatterns = [
    path('list/', ArticleListView.as_view(), name='list'),
    path('create/', ArticleCreateView.as_view(), name='create'),
    path('detail/<int:pk>', ArticleDetailView.as_view(), name='detail'),
    path('update/<int:pk>', ArticleUpdateView.as_view(), name='update'),
    path('delete/<int:pk>', ArticleDeleteView.as_view(), name='delete'),
]
Пример #2
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/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 import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include

from articleapp.views import ArticleListView

urlpatterns = [
    path('', ArticleListView.as_view(), name='home'),
    path('admin/', admin.site.urls),
    path('accounts/', include('accountapp.urls')),
    path('profiles/', include('profileapp.urls')),
    path('articles/', include('articleapp.urls')),
    path('comments/', include('commnetapp.urls')),
    path('projects/', include('projectapp.urls')),
    path('subscribes/', include('subscribeapp.urls'))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Пример #3
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.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include

from articleapp.views import ArticleListView

urlpatterns = [
    path('admin/', admin.site.urls, name='admin'),
    path('',
         ArticleListView.as_view(template_name='articleapp/list.html'),
         name='index'),
    path('accounts/', include('accountapp.urls')),
    path('profiles/', include('profileapp.urls')),
    path('articles/', include('articleapp.urls')),
    path('comments/', include('commentapp.urls')),
    path('projects/', include('projectapp.urls')),
    path('subscriptions/', include('subscriptionapp.urls')),
]
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
Пример #4
0
from django.urls import path
from django.views.generic import TemplateView

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

app_name = "articleapp"
urlpatterns = [
    path("list/", ArticleListView.as_view(), name="list"),
    path(
        "create/",
        ArticleCreateView.as_view(),
        name="create",
    ),
    path(
        "detail/<int:pk>",
        ArticleDetailView.as_view(),
        name="detail",
    ),
    path(
        "update/<int:pk>",
        ArticleUpdateView.as_view(),
        name="update",
    ),
    path(
        "delete/<int:pk>",
Пример #5
0
    https://docs.djangoproject.com/en/3.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 import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include

from articleapp.views import ArticleListView

urlpatterns = [
    path("", ArticleListView.as_view(), name="home"),
    path("admin/", admin.site.urls),
    path("accounts/", include("accountapp.urls")),
    path("profiles/", include("profileapp.urls")),
    path("articles/", include("articleapp.urls")),
    path("comments/", include("commentapp.urls")),
    path("projects/", include("projectapp.urls")),
    path("subscribe/", include("subscribeapp.urls")),
    path("likes/", include("likeapp.urls")),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)