from django.urls import path from blog.views import Home, Like, ArticleDetail, ArticleDetailLike app_name = 'blog' urlpatterns = [ path('', Home.as_view(), name='home'), path('like/<int:post>/', Like.as_view(), name='like'), path('article_detail_like/<int:post>/', ArticleDetailLike.as_view(), name='article_detail_like'), path('article/<int:pk>/', ArticleDetail.as_view(), name='article_detail'), ]
"""blog_project 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 path, include from blog.views import Home urlpatterns = [ path('admin/', admin.site.urls), path('', Home.as_view()), path('blog/', include('blog.urls', namespace='blog')), ]
from django.conf.urls import url, include from django.contrib import admin from blog.views import BlogListView, Home from django.views.generic import DetailView, ListView, TemplateView import blog # старый метод реализации: # urlpatterns = [ # url(r'^$', 'blog.views.home', name='home'), # url(r'^about/$', 'blog.views.about', name='about'), # url(r'^contact/$', 'blog.views.contact', name='contact'), # url(r'^articles/(?P<article_id>[0-9]+)/$', 'blog.views.show_article', name='article'), # ] # новый метод реализации urlpatterns = [ url(r'^$', Home.as_view(), name='home'), url(r'^about/$', TemplateView.as_view(template_name='blog/about.html'), name='about'), url(r'^contact/$', TemplateView.as_view(template_name='blog/contact.html'), name='contact'), url(r'^articles/(?P<pk>[0-9]+)/(?P<permalink>[\w\\\-\d\.]+)$', BlogListView.as_view(), name='article'), ]
from django.urls import path from django.contrib import admin from blog.views import Home, ListLadies, ListMaterials, ListArticles, ShowArticle app_name = 'blog' urlpatterns = [ path('', Home.as_view(), name='about'), path('ladies/', ListLadies.as_view(), name='ladies'), path('materials/', ListMaterials.as_view(), name='material'), path('blog/', ListArticles.as_view(), name='blog'), path('blog/article/<slug:slug>/', ShowArticle.as_view(), name='article'), ]
# coding:utf-8 __author__ = 'albert' from django.conf.urls import include, url from django.contrib import admin from blog.views import Home, Detail urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^$', Home.as_view()), url(r'^article/(?P<slug>\d+).html$', Detail.as_view()), ]
https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 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. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from blog import views from blog.views import Home,List,Detail, MyPostList, Myarticles,Delete urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', Home.as_view(), name='home'), url(r'^post/', List.as_view(), name='list'), url(r'^detail/(?P<pk>[0-9]+)/', Detail.as_view(), name='post_detail'), url(r'^list/', MyPostList.as_view(), name='articlelist'), url(r'^article/(?P<pk>[0-9]+)/', Myarticles.as_view(), name='article'), url(r'^delete/(?P<pk>[0-9]+)/', Delete.as_view(), name='delete'), ]
from django.urls import path from blog.views import Home, SearchView, CategoryView, PostListView, PostDetailView, PhotoDetailView urlpatterns = [ path('search', SearchView.as_view(), name="search"), path('category/<slug:slug>', CategoryView.as_view(), name="category"), path('', Home.as_view(), name="index"), path('blog', PostListView.as_view(), name="blog"), path('posts/<slug:slug>', PostDetailView.as_view(), name="post-detail"), path('photos/<int:pk>', PhotoDetailView.as_view(), name="photo-detail"), ]
from django.conf.urls import url from blog.views import ( Posts, Tags, ImageUpload, CommentProcess, searchresult, Home, MiscView, GamesView, ) urlpatterns = [ # Examples: # url(r'^$', 'newblog.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'posts/$', Posts.as_view(), name='posts'), url(r'tags/$', Tags.as_view(), name='tags'), url(r'misc/$', MiscView.as_view(), name='misc'), url(r'games/$', GamesView.as_view(), name='games'), url(r'upload-image/$', ImageUpload.as_view(), name='upload-image'), url(r'comment/process/$', CommentProcess.as_view(), name='comment'), url(r'search/results/$', searchresult, name='searchresult'), url(r'(?P<slug>[-a-zA-z0-9]+)/$', Home.as_view(), name='home'), url(r'^$', Home.as_view(), name='index'), ]
from django.urls import path from django.contrib.auth import views as auth_views from blog.views import Home, SearchView, CategoryView, PostListView, PostDetailView, PhotoDetailView, PostListRest, \ PostDetailRest, Login, TagIndexView, SignUpView, PwResetView, activate, PwResetDoneView, PwResetConfirmView, \ PwResetCompleteView, resend_activation, ResendActivaton urlpatterns = [ path('search', SearchView.as_view(), name='search'), path('category/<slug:slug>', CategoryView.as_view(), name='category'), path('tags/<slug:slug>', TagIndexView.as_view(), name='tagged'), path('', Home.as_view(), name='index'), path('signup/', SignUpView.as_view(), name='signup'), path('activate/<slug:uidb64>/<slug:token>/', activate, name='activate'), path('reactivate/', resend_activation, name='reactivate'), path('reactivation_succesful/', ResendActivaton.as_view(), name='reactivation_successful'), path('login/', Login.as_view(), name='login'), path('logout/', auth_views.LogoutView.as_view(), name='logout'), path('password_change/', auth_views.PasswordChangeView.as_view(), name='password_change'), path('password_change/done/', auth_views.PasswordChangeDoneView.as_view(), name='password_change_done'), path('password_reset/', PwResetView.as_view(), name='password_reset'), path('password_reset/done/', PwResetDoneView.as_view(), name='password_reset_done'), path('reset/<slug:uidb64>/<slug:token>/', PwResetConfirmView.as_view(),