示例#1
0
from django.contrib.auth.decorators import login_required
from django.urls import path

from blog import views
from blog.apps import BlogConfig
from blog.views import PostDetailView, PostListView, PostCreateView, PostUpdateView

app_name = BlogConfig.name
urlpatterns = [
    path(r'', PostListView.as_view(), name='index'),
    path(r'post/<int:pk>/', PostDetailView.as_view(), name='post'),
    path(r'post/upload/',
         login_required(PostCreateView.as_view()),
         name='upload'),
    path(r'post/remove/<int:post_id>/',
         login_required(views.remove),
         name='remove'),
    path(r'post/edit/<int:pk>/',
         login_required(PostUpdateView.as_view()),
         name='edit'),
]
示例#2
0
文件: urls.py 项目: schir2/schirus
from django.urls import path, include

from blog.views import CategoryAutoCompleteView
from blog.views import PostDetailView, PostListView, PostCreateView, PostUpdateView, PostDeleteView, PostLikeView

urlpatterns = [
    path('category',
         CategoryAutoCompleteView.as_view(create_field='name'),
         name='category-autocomplete'),
    path('', PostListView.as_view(), name='post-list'),
    path('', PostListView.as_view(), name='home'),
    path('create', PostCreateView.as_view(), name='post-create'),
    path(
        '<str:slug>-<int:pk>/',
        include([
            path('', PostDetailView.as_view(), name='post-detail'),
            path('update', PostUpdateView.as_view(), name='post-update'),
            path('delete', PostDeleteView.as_view(), name='post-delete'),
            path('like', PostLikeView.as_view(), name='post-like'),
        ]))
]
示例#3
0
from django.urls import path

from blog import views
from blog.views import (PostCreateView, PostDetailView, PostListView,
                        PostDeleteView, PostUpdateView, UserPostListView)

urlpatterns = [
    # Since we want it to be the blog homepage we leave the string, blank.
    path("", PostListView.as_view(), name="blog-home"),
    path("post/new/", PostCreateView.as_view(), name="post-create"),
    path("post/<int:pk>/", PostDetailView.as_view(), name="post-detail"),
    path("post/<int:pk>/update/", PostUpdateView.as_view(),
         name="post-update"),
    path("post/<int:pk>/delete/", PostDeleteView.as_view(),
         name="post-delete"),
    path("user/<str:username>/", UserPostListView.as_view(), name="user-post"),
    path("about", views.about, name="blog-about"),
]
示例#4
0
    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 (
    PostListView,
    PostDetailView,
    PostCreateView,
    PostUpdateView,
    PostDeleteView,
    UserPostListView,
)
from blog import views
urlpatterns = [
    path('', PostListView.as_view(), name='blog-home'),
    path('users/<str:username>', UserPostListView.as_view(), name='user-post'),
    path('post/<int:pk>/', PostDetailView.as_view(), name='post-detail'),
    path('post/new/', PostCreateView.as_view(), name='post-create'),
    path('post/<int:pk>/update/', PostUpdateView.as_view(),
         name='post-update'),
    path('post/<int:pk>/delete/', PostDeleteView.as_view(),
         name='post-delete'),
    path('about/', views.about, name='blog-about'),
]
示例#5
0
    about,
)
from users.forms import ForgotPasswordForm
from users.views import(
    signup,
    profile
)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', PostListView.as_view(), name="blog-home"),
    path('user-profile/', profile, name="user-profile"),  
    path('<str:username>-posts/', UserPostListView.as_view(), name="userposts-list"),
    path('post-<int:pk>/', PostDetailView.as_view(), name="post-detail"),
    path('new-post/', PostCreateView.as_view(), name="post-create"),
    path('post-<int:pk>/update/', PostUpdateView.as_view(), name="post-update"),
    path('post-<int:pk>/delete/', PostDeleteView.as_view(), name="post-delete"),
    path('about/', about, name="blog-about"),
    path('signup/', signup, name="user-signup"),
    path('signin/', LoginView.as_view(template_name="users/signin.html"), name="user-signin"),
    path('signout/', LogoutView.as_view(template_name="users/signout.html"), name="user-signout"),
    path('password-reset/', PasswordResetView.as_view(template_name="users/password_reset.html", form_class=ForgotPasswordForm), name="password_reset"),
    path('password-reset/done/', PasswordResetDoneView.as_view(template_name="users/password_reset_done.html"), name="password_reset_done"),
    path('password-reset/confirm/<uidb64>/<token>/', PasswordResetConfirmView.as_view(template_name="users/password_reset_confirm.html"), name="password_reset_confirm"),
    path('password-reset/complete/', PasswordResetCompleteView.as_view(template_name="users/password_reset_complete.html"), name="password_reset_complete"),
    path('password-change/', PasswordChangeView.as_view(template_name="users/password_change.html"), name="password_change"),
    path('password-change/done/', PasswordChangeDoneView.as_view(template_name="users/password_change_done.html"), name="password_change_done"),
]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
示例#6
0
from django.urls import path
from blog.views import home, about, PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView

urlpatterns = [
    path('', PostListView.as_view(), name='blog-home'),
    path('post/new/', PostCreateView.as_view(), name='blog-post-create'),
    path('post/<str:uuid>/', PostDetailView.as_view(), name='blog-post-detail'),
    path('post/<str:uuid>/update/',
         PostUpdateView.as_view(), name='blog-post-update'),
    path('post/<str:uuid>/delete/',
         PostDeleteView.as_view(), name='blog-post-delete'),
    path('about/', about, name='blog-about')
]
示例#7
0
文件: urls.py 项目: schir2/hangboard
from django.urls import path

from blog.views import PostDetailView
from blog.views import PostListView
from blog.views import PostCreateView
from blog.views import PostUpdateView
from blog.views import PostDeleteView


urlpatterns = [
    path('', PostListView.as_view(), name='index'),
    path('posts/', PostListView.as_view(), name ='post_list'),
    path('post/<slug:slug>', PostDetailView.as_view(), name='post_detail'),
    path('posts/create', PostCreateView.as_view(), name='post_create'),
    path('posts/<slug:slug>/edit', PostUpdateView.as_view(), name='post_update'),
    path('posts/<slug:slug>/delete', PostDeleteView.as_view(), name='post_delete'),
]
示例#8
0
from django.urls import path, re_path
from django.views.generic import TemplateView
from blog.views import PostsListView, PostDetailView, PostCreateView,\
                       PostUpdateView, PostDeleteView

app_name = "blog"
urlpatterns = [
    path('', PostsListView.as_view(), name='posts'),
    path('<int:pk>/', PostDetailView.as_view(), name='post_detail'),
    path('create/', PostCreateView.as_view(), name='post_create'),
    path('<int:pk>/update/', PostUpdateView.as_view(), name='post_update'),
    path('<int:pk>/delete/', PostDeleteView.as_view(), name='post_delete'),
]
示例#9
0
from django.conf.urls import url

from blog.views import PostListView, PostDetailView, PostCreateView, PostUpdateView

urlpatterns = [
    url(r'^post/$', PostListView.as_view(), name='post_list'),
    url(r'^post/(?P<pk>\d+)/$', PostDetailView.as_view(), name='post_detail'),
    url(r'^post/new/$', PostCreateView.as_view(), name='post_new'),
    url(r'^post/edit/(?P<pk>\d+)/$', PostUpdateView.as_view(), name='post_edit'),
]
示例#10
0
文件: urls.py 项目: oilujc/tuexperto
    path('profile/<slug:username>/', ProfileView.as_view(), name='profile'),

    #Auth System
    path('account/signin/', LoginView.as_view(template_name='auth/login.html',
                                    redirect_authenticated_user=True,
                                    extra_context={'title_page':'Sign in',
                                                   'breadcrumb':[(reverse_lazy('home'),'Inicio'), ('','Iniciar Sesión')]}
                                    ),
                                    name='signin'),

    path('account/logout/', LogoutView.as_view(), name='logout'),
    path('account/signup/', register_view, name='signup'),
    
    path('account/<slug:pt>/', UserPostListView.as_view(), name='user_post'),
    path('account/<slug:pt>/new', PostCreateView.as_view(), name='user_post_new'),
    path('account/<slug:pt>/<slug:slug>/edit', PostUpdateView.as_view(), name='user_post_edit'),
    path('account/<slug:pt>/<slug:slug>/delete', PostDeleteView.as_view(), name='user_post_delete'),

    path('ckeditor/', include('ckeditor_uploader.urls')),
    path('select2/', include('django_select2.urls')),
    path('activate/<str:uidb64>/<str:token>', activate, name='activate'),

    #Api
    path('api/', include('api.urls')),

]
if settings.DEBUG:
    #static = Funcion auxiliar para devolver un patron de URL para servir archivos en modo debug
    urlpatterns += static(settings.STATIC_URL, document_root= settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL, document_root= settings.MEDIA_ROOT)
示例#11
0
from django.urls import path
from blog.views import index, post_details, category_specific
from blog.views import ContactUsView, PostlistView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView, SuccessView, SearchView
urlpatterns = [
    path("", PostlistView.as_view(), name='home'),
    path("<int:id>", category_specific, name='category_specific'),
    path('blog/<slug:slug>', PostDetailView.as_view(), name='post-detail'),
    path('contact', ContactUsView.as_view(), name='contact'),
    path('post', PostCreateView.as_view(), name='create_new'),
    path('post/<slug:slug>', PostUpdateView.as_view(), name='update_post'),
    path('post_delete/<slug:slug>',
         PostDeleteView.as_view(),
         name='delete_post'),
    path('success', SuccessView.as_view(), name='success'),
    path('url', SearchView.as_view(), name='search_page')
]
示例#12
0
from django.urls import path
from blog.views import (PostDetailView, 
						PostUpdateView, 
						PostCreateView, 
						PostDeleteView, 
						ComentarioCreateView, 
						ComentarioDeleteView,
						HomePostDetailView,
                        Inicio
						)

from . import views

urlpatterns = [
    path('', Inicio.as_view(), name='blog-inicio'),
    path('inicio/', HomePostDetailView.as_view(), name='blog-home'),
    path('post/<int:pk>/', PostDetailView.as_view(), name='post-detail'),
    path('post/<int:pk>/actualizar/', PostUpdateView.as_view(), name='post-actualizar'),
    path('post/<int:pk>/eliminar/', PostDeleteView.as_view(), name='post-eliminar'),
    path('post/<int:pk>/agregar_comentario/', ComentarioCreateView.as_view(), name='post-agregar-comentario'),
    path('post/<int:pk>/eliminar_comentario/', ComentarioDeleteView.as_view(), name='eliminarComentario'),
    path('post/nuevo/', PostCreateView.as_view(), name='post-nuevo'),
]
示例#13
0
    PostUpdateView,
    PostDeleteView,
    Draft,
    add_comment,
    publish_post,
    approve_comment,
    delete_comment,
    register_page,
)

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', PostListView.as_view(), name='post_list'),
    url(r'^(?P<pk>\d+)/$', PostDetailView.as_view(), name='post_detail'),
    url(r'^create/$', PostCreateView.as_view(), name='create'),
    url(r'^(?P<pk>\d+)/edit/$', PostUpdateView.as_view(), name='edit'),
    url(r'^(?P<pk>\d+)/delete/$', PostDeleteView.as_view(), name='delete'),
    url(r'^drafts/$', Draft.as_view(), name='draft'),
    url(r'^(?P<pk>\d+)/comment/$', add_comment, name='comment'),
    url(r'^comments/(?P<pk>\d+)/approve/$',
        approve_comment,
        name='approve_comment'),
    url(r'^comments/(?P<pk>\d+)/delete/$',
        delete_comment,
        name='delete_comment'),
    url(r'^(?P<pk>\d+)/publish/$', publish_post, name='publish'),
    url(r'^register/$', register_page, name='register'),
    url(r'^accounts/login/$', login, name='login'),
    url(r'^accounts/logout/$',
        logout,
        name='logout',
 def test_Post_Update_url_is_resolved(self):
     url = reverse('post-update', args=['2'])
     self.assertEquals(
         resolve(url).func.__name__,
         PostUpdateView.as_view().__name__)
示例#15
0
from django.urls import path
from blog.views import (PostListView, PostCreateView, PostDetailView,
                        PostUpdateView, PostDeleteView, CommentView,
                        CommentDeleteView)

app_name = "blog"

urlpatterns = [
    # User posts
    path('user/<str:username>/', PostListView.as_view(), name='user-posts'),
    # Posts by date
    path('date/<str:date>/', PostListView.as_view(), name='date-posts'),
    # New post
    path('new/', PostCreateView.as_view(), name='new-post'),
    # All post
    path('<slug>/', PostDetailView.as_view(), name='post-detail'),
    # Update post
    path('<slug>/update/', PostUpdateView.as_view(), name='post-update'),
    # Delete post
    path('<slug>/delete/', PostDeleteView.as_view(), name='post-delete'),
    # New comment
    path('comment/<slug>/new/', CommentView.as_view(), name='new-comment'),
    # Delete comment
    path('comment/delete/<int:pk>/',
         CommentDeleteView.as_view(),
         name='comment-delete'),
]
示例#16
0
from django.urls import path
from blog import views
from blog.views import PostListView, PostDeleteView, UserPostListView, PostCreateView, PostUpdateView
#PostDetailView
app_name = 'blog'

urlpatterns = [
    path('', PostListView.as_view(), name='blogHome'),
    path('posts/<username>/', UserPostListView.as_view(), name='user_posts'),
    path('<int:pk>/', views.blogPost, name='blogPost'),
    path('profile/', views.profile, name='profile'),
    path('new/', PostCreateView.as_view(), name='new'),
    path('post_update/<int:pk>/', PostUpdateView.as_view(), name="post_update"),
    path('delete/<int:pk>/', PostDeleteView.as_view(), name='delete'),
    path('comment/<int:sno>/', views.comment, name="comment")
]

# Class Based Views Look ForThe Below Template By Default:
# <appname>/<model>_<viewtype>.html
# path('<int:pk>/', PostDetailView.as_view(), name='blogPost')
# path('new/', views.new, name='new')
# path('post_update/<int:sno>/', views.post_update, name="post_update")
示例#17
0
from django.urls import path

from blog import views
from blog.views import (PostCreateView, PostDeleteView, PostDetailView,
                        PostListView, PostUpdateView)

urlpatterns = [
    path("", PostListView.as_view(), name="blog-home"),
    path("post/<int:pk>/", PostDetailView.as_view(), name="post-detail"),
    path("post/<int:pk>/update", PostUpdateView.as_view(), name="post-update"),
    path("post/<int:pk>/delete", PostDeleteView.as_view(), name="post-delete"),
    path("post/new/", PostCreateView.as_view(), name="post-create"),
    path("about/", views.about, name="blog-about"),
]
示例#18
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.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
from blog.views import PostListView
from blog.views import PostDetailView
from django.conf.urls.static import static
from django.conf import settings
from blog.views import PostCreateView
from blog.views import PostUpdateView
from blog.views import PostDeleteView
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', PostListView.as_view(), name="post_list"),
    path('create/', PostCreateView.as_view(), name="post_create"),
    path('<pk>/', PostDetailView.as_view(), name="post_detail"),
    path('<pk>/update/', PostUpdateView.as_view(), name="post_update"),
    path('<pk>/delete/', PostDeleteView.as_view(), name="post_delete"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(
    settings.STATIC_URL, document_root=settings.STATIC_ROOT)
示例#19
0
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth.views import LoginView, LogoutView, PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView
from blog.views import blog_view, PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView, UserPostListView
from home.views import home_view
from checks.views import checkAdd, narc_check_view, check_home_view, WeeklyCheckView, post_unit_view, AddDrugNarcBox, SubDrugNarcBox
from safe.views import check_safe_view, safe_home_view, AddDrug, SubDrug, CheckDrug, search_drug
from components.views import component_home_view, add_drug, add_vehicle, profile, register, UnitUpdateView, UnitListView, UnitDetailView, DrugListView, DrugUpdateView, MedicCreateView, MedicListView, MedicUpdateView

urlpatterns = [
    path('blog/', PostListView.as_view(), name='blog'),
    path('user/<str:username>/', UserPostListView.as_view(),
         name='user_posts'),
    path('blog/new/', PostCreateView.as_view(), name='blog_create'),
    path('blog/<int:pk>/update/', PostUpdateView.as_view(),
         name='blog_update'),
    path('blog/<int:pk>/delete/', PostDeleteView.as_view(),
         name='blog_delete'),
    path('blog/<int:pk>/', PostDetailView.as_view(), name='blog_detail'),
    path('checks/', check_home_view, name='check_home_view'),
    path('checks/home/', post_unit_view, name='post_unit_view'),
    path('checks/daily/', checkAdd.as_view(), name='daily'),
    path('checks/weekly/', WeeklyCheckView.as_view(), name='weekly'),
    path('checks/narc_daily/', narc_check_view, name='narc_daily'),
    path('checks/narc_add/', AddDrugNarcBox.as_view(), name='narc_add'),
    path('checks/narc_sub/', SubDrugNarcBox.as_view(), name='narc_sub'),
    path('safe/', safe_home_view, name='safe_home_view'),
    path('safe/check/', check_safe_view, name='safe_check_view'),
    path('safe/add/', AddDrug.as_view(), name='safe_add_view'),
    path('safe/remove/', SubDrug.as_view(), name='safe_remove_view'),
示例#20
0
    # Example : /blog/archive/
    path('archive/', PostAV.as_view(), name='post_archive'),

    # Example: /blog/archive/2019/
    path('archive/<int:year>/', PostYAV.as_view(), name='post_year_archive'),

    # Example: /blog/archive/2019/12/
    path('archive/<int:year>/<int:month>/',
         PostMAV.as_view(),
         name='post_month_archive'),

    # Example: /blog/archive/2019/12/17/
    path('archive/<int:year>/<int:month>/<int:day>/',
         PostDAV.as_view(),
         name='post_day_archive'),

    # Example: /blog/archive/today/
    path('archive/today/', PostTAV.as_view(), name='post_today_archive'),

    # Example: /blog/add/
    path('add/', PostCreateView.as_view(), name="add"),

    # Example: /blog/change/
    path('change/', PostChangeLV.as_view(), name="change"),

    # Example: /blog/99/delete/
    path('<int:pk>/delete/', PostDeleteView.as_view(), name="delete"),

    # Example: /blog/99/update/
    path('<int:pk>/update/', PostUpdateView.as_view(), name="update"),
]
sfrom django.urls import path
from blog.views import (AboutView,
                        PostListView,
                        PostDetailView,
                        CreatePostView,
                        PostUpdateView,
                        PostDeleteView,
                        DraftListView,
                        add_comment_to_post,
                        comment_approve,
                        comment_remove,
                        post_publish,signupview)

urlpatterns = [
    path('',PostListView.as_view(),name='post_list'),
    path('about/',AboutView.as_view(),name='aboutview'),  
    path('post/<int:pk>',PostDetailView.as_view(),name='post_detail'),
    path('post/new/',CreatePostView.as_view(),name='new_post'),
    path('post/<int:pk>/edit/',PostUpdateView.as_view(),name='post_edit'),
    path('post/<int:pk>/remove/',PostDeleteView.as_view(),name='post_remove'), 
    path('drafts/',DraftListView.as_view(),name='post_draft_list'),
    path('post/<int:pk>/comments/',add_comment_to_post,name='add_comment_to_post'),
    path('comment/<int:pk>/approve/',comment_approve,name='comment_approve'),
    path('comment/<int:pk>/remove/',comment_remove,name='comment_remove'),
    path('post/<int:pk>/publish/',post_publish,name='post_publish'),
    path('signup/',signupview,name='signup'),

]
示例#22
0
from django.urls import path, include
from blog.views import (HomeView, PostListView, PostLikeRedirect,
                        PostFavoriteRedirect, PostCreateView, PostUpdateView,
                        PostDetailView, PostDeleteView)

from users.views import removeFav

urlpatterns = [
    path('<slug:slug>/', HomeView.as_view(), name="post-filter"),
    path('', HomeView.as_view(), name="blog-home"),
    path('post/myposts/', PostListView.as_view(), name="my-posts"),
    path('post/new/', PostCreateView.as_view(), name="post-create"),
    path('post/<slug:slug>/comment/', include(("comments.urls", "comments"))),
    path('post/<slug:slug>/like', PostLikeRedirect.as_view(), name="likes"),
    path('post/<slug:slug>/favorite',
         PostFavoriteRedirect.as_view(),
         name="favorite"),
    path('post/<slug:slug>/update/',
         PostUpdateView.as_view(),
         name="post-update"),
    path('post/<slug:slug>/delete/',
         PostDeleteView.as_view(),
         name="post-delete"),
    path('post/<slug:slug>/', PostDetailView.as_view(), name="post-detail"),
    path('profile/<slug:slug>/favorite', removeFav, name="rem-fav"),
    # path('about/', AboutView.as_view(), name="blog-about"),
]
示例#23
0
from django.urls import path
from . import views
from blog.views import PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView

urlpatterns = [
    path('', PostListView.as_view(), name='blog-index'),
    path('post/<int:pk>', PostDetailView.as_view(), name='post-detail'),
    path('post/new/', PostCreateView.as_view(), name='post-create'),
    path('post/<int:pk>/update', PostUpdateView.as_view(), name='post-update'),
    path('post/<int:pk>/delete', PostDeleteView.as_view(), name='post-delete'),
    path('about/', views.about, name='blog-about'),
]
示例#24
0
from django.urls import path
from blog.views import PostListView,  PostDetailView, contact_us_form_view,  PostCreateView, PostUpdateView, PostDeleteView, profileDetailView, SearchListView, BookmarkView, CommentDeleteView, bookmarkDeleteView




urlpatterns = [
    path('', PostListView.as_view(), name='home'),
    # path('blog', blogList),
    path('blogs/<slug:slug>', PostDetailView.as_view(), name='post-detail'),
    path('contactUs/', contact_us_form_view, name='contactUs'),
    path('category/<int:id>/', PostListView.as_view(), name='post_by_category'),

    path('post/',PostCreateView.as_view() , name='post'),
    path('update/<slug:slug>/', PostUpdateView.as_view(), name='update'),
    path('delete/<slug:slug>/', PostDeleteView.as_view(), name='delete'),
    path('<int:pk>/', profileDetailView.as_view(), name='profile'),
    path('search/', SearchListView, name='search'),
    path('blog/bookmark', BookmarkView.as_view(),name='bookmark'),
    path('blog/<int:pk>/add_bookmark', BookmarkView.as_view(), name='add-bookmark' ),
    path('comment/<int:id>/',CommentDeleteView, name='commentDelete' ),
    path('bookmark/<int:id>/', bookmarkDeleteView, name='bookmarkDelete')


]