Exemple #1
0
"""blogproject URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/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. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from blog.views import ArticleListView, ArticleDetailView

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', ArticleListView.as_view()),  # Главная страница со списком всех записей блога
    url(r'^(?P<article_id>[0-9]+)/$', ArticleDetailView.as_view()),  # Страница записи с комментариями
]
Exemple #2
0
from django.urls import path

from blog.views import (ArticleListView, ArticleDetailView,
                        ArticleLikeCreateView, CommentsView, CommentEditView,
                        CommentCreateView, CommentDelete,
                        CommentLikeCreateView, LikesView)

app_name = "blog"

urlpatterns = [
    path('', ArticleListView.as_view(), name='index'),
    path('<int:pk>/', ArticleDetailView.as_view(), name='detail'),
    path('<int:pk>/comments/', CommentsView.as_view(), name='comments_get'),
    path('<int:pk>/likes/', LikesView.as_view(), name='likes_get'),
    path('comments/add/', CommentCreateView.as_view(), name='comment_add'),
    path('comments/<int:pk>/edit/',
         CommentEditView.as_view(),
         name='comment_edit'),
    path('comments/delete/', CommentDelete.as_view(), name='comment_delete'),
    path('likes/articles/add/',
         ArticleLikeCreateView.as_view(),
         name='like_article_add'),
    path('likes/comments/add/',
         CommentLikeCreateView.as_view(),
         name='like_comment_add'),
]
Exemple #3
0
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.urls import path

from blog.views import (
    ArticleDetailView,
    ArticleListView,
    ArticleCreateView,
    ArticlePkAndSlugDetailView,
    ArticleUniqueSlugDetailView,
)

urlpatterns = [
    path("", ArticleListView.as_view(), name="article-list"),
    path("blog/create", ArticleCreateView.as_view(), name="article-create"),
    path("blog/<int:pk>/", ArticleDetailView.as_view(), name="article-detail"),
    path(
        "blog/<int:pk>-<str:slug>/",
        ArticlePkAndSlugDetailView.as_view(),
        name="article-pk-slug-detail",
    ),
    path(
        "blog/<str:slug>",
        ArticleUniqueSlugDetailView.as_view(),
        name="articleunique-slug",
    ),
]
Exemple #4
0
from django.urls import path
from blog.views import (ArticleListView, 
                    ArticleDetailView, 
                    ArticleDeleteView, 
                    ArticleFormView, 
                    ContactFormView, 
                    CategoriesArticleListView, 
                    ArticleUptadeView, 
                    CommentDeleteView)
                    

urlpatterns = [
    
    path('', ArticleListView.as_view(), name="homepage"),
    path('article/<slug:slug>', ArticleDetailView.as_view(), name="article-detail"),
    path('article/delete/<slug:slug>', ArticleDeleteView.as_view(), name="article-delete"),
    path('article/create/', ArticleFormView.as_view(), name="article-create"),
    path('article/edit/<slug:slug>', ArticleUptadeView.as_view(), name="article-edit"),

    path('comment/delete/<int:id>', CommentDeleteView.as_view(), name="comment-delete"),


    path('contact/', ContactFormView.as_view(), name="contact"),
    path('category/<slug:slug>', CategoriesArticleListView.as_view(), name="category"),
]
Exemple #5
0
from django.contrib.sitemaps.views import sitemap
from django.views.static import serve

from blog.sitemaps import BlogSitemap
from blog.views import ArticleListView

sitemaps = {
    'blog': BlogSitemap
}

# i18n_patterns
urlpatterns = [

    ##################################################
    # / Pagina de inicio.
    url(r'^$', ArticleListView.as_view(), name='home_page'),
    ##################################################

    # /accounts/*
    url(r'^accounts/', include('accounts.urls')),

    # /auth/*
    url(r'^auth/', include('authentication.urls')),

    # /blog/*
    url(r'^blog/', include('blog.urls')),

    # /contact/*
    url(r'^contact/', include('contact.urls')),

    # /home/*
Exemple #6
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')
]
Exemple #7
0
from django.conf.urls import url, include

from blog.views import ArticleListView, ArticleDetailView, contactView
from blog.models import UserViewSet
from rest_framework import routers, serializers, viewsets

router = routers.DefaultRouter()
router.register(r'users', UserViewSet, base_name='posts')

urlpatterns = [
    url(r'^$', ArticleListView.as_view(), name='article-list'),
    url(r'^api', include(router.urls)),
    url(r'^api-auth/',
        include('rest_framework.urls', namespace='rest_framework')),
    url(r'^(?P<slug>[-\w]+)/$',
        ArticleDetailView.as_view(),
        name='article-detail'),
    url(r'^contacts$', contactView),
]
Exemple #8
0
from django.urls import path

from main import views
from blog.views import ArticleListView

urlpatterns = [
    path('', views.HomeView.as_view(), name='index'),
    path('about', views.AboutView.as_view(), name='about'),
    path('projects', views.ProjectListView.as_view(), name='projects'),
    path('projects/<int:pk>',
         views.ProjectDetailView.as_view(),
         name='project-detail'),
    path('papers', views.PaperListView.as_view(), name='papers'),
    path('contact', views.contact, name='contact'),
    path('teams', views.TeamListView.as_view(), name='teams'),
    path('gallery', views.GalleryListView.as_view(), name='gallery'),
    path('articles', ArticleListView.as_view(), name='articles'),
]
Exemple #9
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'),
]
Exemple #10
0
from django.conf.urls import url
from django.contrib import admin
from blog.views import EmailView, ArticleCreateView, ArticleDetailView, ArticleListView, ArticleMonthArchiveView, ArticleYearArchiveView
from django.conf.urls import url
from django.views.generic.dates import ArchiveIndexView

from blog.models import Article

app_name = 'blog'

urlpatterns = [
    url(r"^$", EmailView.as_view(), name="index"),
    url(r"^create/$", ArticleCreateView.as_view(), name="create"),
    url(r"^list/$", ArticleListView.as_view(), name="list"),
    url(r"^detail/(?P<pk>\d+)/$", ArticleDetailView.as_view(), name="detail"),
    url(r'^archive/$',
        ArchiveIndexView.as_view(model=Article, date_field="pub_date"),
        name="article_archive"),
    url(r'^(?P<year>[0-9]{4})/$',
        ArticleYearArchiveView.as_view(),
        name="article_year_archive"),

    # Example: /2012/aug/
    url(r'^(?P<year>[0-9]{4})/(?P<month>[-\w]+)/$',
        ArticleMonthArchiveView.as_view(),
        name="archive_month"),
    # Example: /2012/08/
    url(r'^(?P<year>[0-9]{4})/(?P<month>[0-9]+)/$',
        ArticleMonthArchiveView.as_view(month_format='%m'),
        name="archive_month_numeric"),
]
Exemple #11
0
from django.urls import path
from blog.views import (ArticleCreateView, ArticleDetailView,
                        ArticleUpdateView, ArticleDeleteView, ArticleListView)

app_name = "articles"
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"),
]
Exemple #12
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 include, path

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

from pages.views import (home_view, products_view, contact_view, about_view)

from blog.views import ArticleListView

urlpatterns = [
    path('blog/', include('blog.urls')),
    path('user/', include('user.urls')),
    path('products/', include('products.urls')),
    path('', ArticleListView.as_view(), name="user-landing"),
    path('home/', home_view, name="home"),
    path('admin/', admin.site.urls),
    path('contact/', contact_view, name="contact"),
    path('about/', about_view, name="about")
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
Exemple #13
0
from django.urls import path

from . import views
# Views
from blog.views import new_article
from blog.views import article
# class view
from blog.views import ArticleListView
from blog.views import AddPostView
from blog.views import EditArticle
from blog.views import DeleteArticle

urlpatterns = [
    path('', views.articles, name='articles'),
    path('new_article', new_article, name='new_article'),
    path('article/<int:pk>', article, name='article'),
    path('artilcelist/', ArticleListView.as_view(), name='artilces_list'),
    path('new_article_2', AddPostView.as_view(), name='new_article_2'),
    path('edit_article/<int:pk>', EditArticle.as_view(), name='edit_article'),
    path('article/<int:pk>/remove',
         DeleteArticle.as_view(),
         name='delete_article'),
]
Exemple #14
0
from django.urls import path

from blog.views import ArticleListView, ArticleDetailView

urlpatterns = [
    path('', ArticleListView.as_view(), name='blog_url'),
    path('article/<slug:slug>',
         ArticleDetailView.as_view(),
         name='single_article_url'),
]
Exemple #15
0
from django.conf.urls import patterns, url
from blog.views import ArticleListView, TagListView, ArticleDetailView, AuthorListView
from blog.feeds import BlogFeed

urlpatterns = patterns('blog.views',
                       url(r'^$', ArticleListView.as_view(), name='blog_index'),
                       url(r'^tag/(?P<pk>\d+)/$', TagListView.as_view(), name='tag_index'),
                       url(r'^(?P<pk>\d+)/$', ArticleDetailView.as_view(), name='article_detail'),
                       url(r'^author/(?P<name>[^/]+)/$', AuthorListView.as_view(), name='author_list'),
                       url(r'^feed/$', BlogFeed(), name='blog_rss')
                       )
Exemple #16
0
from django.urls import path

from blog.views import ArticleListView, ArticleDetailView, article_create, article_delete, article_update
# 正在部署的应用的名称
app_name = 'blog'

urlpatterns = [
    # path函数将url映射到视图
    path('', ArticleListView.as_view(), name='index'),
    path('article-list/', ArticleListView.as_view(), name='article-list'),
    path('article-detail/<int:article_id>/',
         ArticleDetailView.as_view(),
         name='article-detail'),
    path('article-create/', article_create, name='article-create'),
    path('article-delete/<int:article_id>/',
         article_delete,
         name='article-delete'),
    path('article-update/<int:article_id>/',
         article_update,
         name='article-update'),
]
Exemple #17
0
from django.conf.urls import patterns, url
from blog.views import ArticleListView, TagListView, ArticleDetailView, AuthorListView
from blog.feeds import BlogFeed

urlpatterns = patterns(
    'blog.views', url(r'^$', ArticleListView.as_view(), name='blog_index'),
    url(r'^tag/(?P<pk>\d+)/$', TagListView.as_view(), name='tag_index'),
    url(r'^(?P<pk>\d+)/$', ArticleDetailView.as_view(), name='article_detail'),
    url(r'^author/(?P<name>[^/]+)/$',
        AuthorListView.as_view(),
        name='author_list'), url(r'^feed/$', BlogFeed(), name='blog_rss'))
Exemple #18
0
from django.urls import path

from blog.views import ArticleIndexView, ArticleListView, ArticleDetailView
from blog.views import TutorialListView, TutorialDetailView, TutorialArticleListView, TutorialCommentsView

urlpatterns = [
    # 文章列表页
    path('article/index/', ArticleIndexView.as_view(), name='blog_article_index'),
    path('article/list/', ArticleListView.as_view(), name='blog_article_list'),
    path('article/detail/<int:article_id>', ArticleDetailView.as_view(), name='blog_article_detail'),

    # 教程列表页
    path('tutorial/list/', TutorialListView.as_view(), name='blog_tutorial_list'),
    path('tutorial/detail/<int:tutorial_id>/', TutorialDetailView.as_view(), name='blog_tutorial_detail'),
    path('tutorial/info/<int:tutorial_id>/', TutorialArticleListView.as_view(), name='blog_tutorial_article_list'),
    path('tutorial/comments/<int:tutorial_id>/', TutorialCommentsView.as_view(), name='blog_tutorial_comments'),

    # path('detail/<int:course_id>/', CourseDetailView.as_view(), name='course_detail'),
    # path('info/<int:course_id>/', CourseInfoView.as_view(), name='course_info'),
    # path('comments/<int:course_id>/', CourseCommentsView.as_view(), name='course_comments'),

    # 添加博客评论
    # path('add_comment/', CourseAddCommentView.as_view(), name='add_comment'),

    # 播放视频
    # path('video/<int:video_id>/', VideoPlayView.as_view(), name='video_play'),

]
Exemple #19
0
from django.contrib.auth.decorators import login_required
from django.urls import path

from blog.views import index, ArticleUpdate, article_approval, \
    ArticleEditedListView, ArticleCreate, ArticleListView, \
    update_status

urlpatterns = [
    path('', index, name='index'),
    path('article/new/',
         login_required(ArticleCreate.as_view()),
         name='article-new'),
    path('article/<int:pk>/',
         login_required(ArticleUpdate.as_view()),
         name='article-detail'),
    path('article/status/',
         login_required(update_status),
         name='update-status'),
    path('article/writer/<int:pk>/',
         ArticleListView.as_view(),
         name='article-writer-list'),
    path('article/approval/',
         login_required(article_approval),
         name='article-approval'),
    path('article/edited/',
         login_required(ArticleEditedListView.as_view()),
         name='article-edited'),
]
Exemple #20
0
                       # Examples:
                       # url(r'^$', 'blog.views.home', name='home'),
                       # url(r'^blog/', include('blog.foo.urls')),

                       # Uncomment the admin/doc line below to
                       # enable admin documentation:
                       # url(r'^admin/doc/',
                       # include('django.contrib.admindocs.urls')),
                       url(r'^ckeditor/', include('ckeditor.urls')),
                       # Uncomment the next line to enable the admin:
                       url(r'^admin/', include(admin.site.urls)),

                       url(r'^$', "article.views.index",
                           name="index"),

                       url(r'^user/(?P<pk>\d+)/$', ArticleListView.as_view(),
                           name="article-list"),

                       url(r'^articles/',
                           include('article.urls',
                                   namespace="articles",
                                   app_name="article")),
                       url(r'^accounts/',
                           include('account.urls',
                                   namespace="accounts",
                                   app_name="account")),
                       url(r'^comments/',
                           include('comment.urls',
                                   namespace="comments",
                                   app_name="comment")),
                       url(r'^search/$',