Ejemplo n.º 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')
]
Ejemplo n.º 2
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",
    ),
]
Ejemplo n.º 3
0
from django.conf.urls import url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from blog.views import IndexView, ArticleDetailView, CategoryView, CommentCreateView, ArticleCreateView, ArticleUpdateView

from django.contrib.auth import views as auth_views

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^login/$', auth_views.LoginView.as_view()),
    url(r'^logout/$', auth_views.LogoutView.as_view(next_page="/")),
    url(r'^comment/create/$',
        CommentCreateView.as_view(),
        name="comment-create"),
    url(r'^categorie/(?P<slug>[-\w]+)/$',
        CategoryView.as_view(),
        name='category'),
    url(r'^article/create/$',
        ArticleCreateView.as_view(),
        name='article-create'),
    url(r'^article/(?P<slug>[-\w]+)/edit/$',
        ArticleUpdateView.as_view(),
        name='article-update'),
    url(r'^article/(?P<slug>[-\w]+)/$',
        ArticleDetailView.as_view(),
        name='article-detail'),
    url(r'^$', IndexView.as_view(), name="index"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Ejemplo n.º 4
0
"""
from django.contrib import admin
from django.urls import path
from blog.views import ArticleListView, ArticleDetailView, ArticleUpdateView, ArticleDeleteView, ArticleCreateView, CommentCreateView, CommentDeleteView, AnswerCommentCreateView, change_comment
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', ArticleListView.as_view(), name='index'),
    path('article/<int:pk>', ArticleDetailView.as_view(), name='view'),
    path('article/<int:pk>/update',
         ArticleUpdateView.as_view(),
         name='article_update'),
    path('article/<int:pk>/delete',
         ArticleDeleteView.as_view(),
         name='del_article'),
    path('article/create', ArticleCreateView.as_view(), name='article_create'),
    path('article/<int:pk>/add_comment',
         CommentCreateView.as_view(),
         name='add_comment'),
    path('comment/<int:pk>/delete',
         CommentDeleteView.as_view(),
         name='del_comment'),
    path('article/<int:pk>/comment/<int:comment_pk>/create_answer',
         AnswerCommentCreateView.as_view(),
         name='add_answer_comment'),
    path('article/<int:article_pk>/comment/<int:comment_pk>/update',
         change_comment,
         name='change'),
]
urlpatterns += staticfiles_urlpatterns()
Ejemplo n.º 5
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'),
]
Ejemplo n.º 6
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"),
]
Ejemplo n.º 7
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"),
]
Ejemplo n.º 8
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 blog.views import IndexView, ArticleDetailView, ArticleCreateView, LoginFormView, LogoutView, \
    ArticleUpdateView, ArticleDeleteView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', IndexView.as_view(), name='index'),
    path('article/<int:pk>', ArticleDetailView.as_view(), name='detail'),
    path('article/add', ArticleCreateView.as_view(), name='add_article'),
    path('article/update/<int:pk>',
         ArticleUpdateView.as_view(),
         name='update_article'),
    path('article/delete/<int:pk>',
         ArticleDeleteView.as_view(),
         name='delete_article'),
    path('login/', LoginFormView.as_view(), name='login'),
    path('logout/', LogoutView.as_view(), name='logout'),
]
Ejemplo n.º 9
0
    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')),
]
Ejemplo n.º 10
0
from django.conf.urls import url
from blog.views import (article_listview, index, category_listview,
                        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),