Esempio n. 1
0
def test_form_validation(factory, user):
    path = reverse('post-create')
    request = factory.get(path)
    request.user = user
    view = PostCreateView.as_view()
    response = view(request)
    assert response.status_code == 200

    request = factory.post(path)
    request.user = AnonymousUser()
    response = view(request)
    assert response.status_code != 200
    assert 'login' in response.url
Esempio n. 2
0
from django.urls import path
from . import views
from blog.views import PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView, UserPostListView

urlpatterns = [
    path('', PostListView.as_view(), name='blog-home'),  # person_changelist
    path('user/<str:username>', UserPostListView.as_view(), name='user-posts'),
    path('post/<int:pk>/',
         PostDetailView.as_view(template_name='blog/post_detail.html'),
         name='post-detail'),
    path('post/new/',
         PostCreateView.as_view(template_name='blog/post_form.html'),
         name='post-create'),  # person_add
    path('post/<int:pk>/update', PostUpdateView.as_view(), name='post-update'),
    path('post/<int:pk>/delete',
         PostDeleteView.as_view(template_name='blog/post_confirm_delete.html'),
         name='post-delete'),
    path('search', views.search, name='search'),
    path('ajax/load-cities/', views.load_cities, name='ajax_load_cities'),
    path('ajax/load-states/', views.load_states, name='ajax_load_states'),
    path('contact/', views.contact, name='contact'),
]
Esempio n. 3
0
from django.conf.urls.static import static
from django.conf import settings

from mysite.views import UserCreationView, UserCreationDoneTV

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    url(r'^accounts/register/$', UserCreationView.as_view(), name='register'),
    url(r'^accounts/register/done/$',
        UserCreationDoneTV.as_view(),
        name='register_done'),
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^bookmark/$', BookmarkLV.as_view(), name='bookmark_index'),
    url(r'^bookmark/(?P<pk>\d+)$', BookmarkDV.as_view(), name='detail'),
    url(r'^blog/$', PostLV.as_view(), name='blog_index'),
    url(r'^blog/(?P<pk>\d+)$', PostDV.as_view(), name='blog_detail'),
    url(r'^blog/add/$', PostCreateView.as_view(), name="blog_add"),
    url(r'^blog/(?P<pk>[0-9]+)/delete/$',
        PostDeleteView.as_view(),
        name="blog_delete"),
    url(r'^blog/(?P<pk>[0-9]+)/update/$',
        PostUpdateView.as_view(),
        name="blog_update"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""
r'^   =>  localhost:8000/
r'^admin ====> localhost:8000/admin
r'^bookmark/$'  =====>    localhost:8000/bookmark
"""
Esempio n. 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 django.conf import settings
from blog.views import post_create, PostCreateView

urlpatterns = [
    path('', include('main.urls')),
    path('', include('users.urls')),
    path('projects/', include('projects.urls')),
    path('personal/', include('personal.urls')),
    path('personal/blog-post/', PostCreateView.as_view(), name='post_create'),
    #path('personal/blog-post/', post_create, name='post_create'),
    path('personal/blog/', include('blog.urls')),
    path('admin/', admin.site.urls),
]

if settings.DEBUG:
    #test mode
    from django.conf.urls.static import static
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
Esempio n. 5
0
from django.urls import path, include
from blog.views import index, post_details, contact_us_form_view, register_form_view, post_form_view, post_update_form_view
from blog.views import HomeView, PostView, PostCreateView, PostListView, PostDetailView, AboutUs, PostUpdateView
urlpatterns = [
    path('', PostListView.as_view(), name="home"),
    # path('blogs/<slug:slug>',RedirectPost.as_view()),
    path('blogs/<slug:slug>', PostDetailView.as_view(), name="post-detail"),
    path('contact', contact_us_form_view),
    # path('register',register_form_view),
    path('post', PostCreateView.as_view()),
    path('post/<slug:slug>', PostUpdateView.as_view(), name="post-update"),
    path('post/<int:id>', post_update_form_view),
    path('about-us', AboutUs.as_view()),
]
Esempio n. 6
0
from django.conf.urls import url
from blog.views import PostListView,PostCreateView,PostUpdateDeleteView, \
                PostDetailView,CommentView,TagView

urlpatterns = [
    url(r'^view/?$', PostListView.as_view(), name='view-all'),  #GET
    url(r'^create/?$', PostCreateView.as_view(), name='create-post'),  #POST
    url(r'^(?P<pk>\d+)$', PostDetailView.as_view(), name='view-one'),  #GET
    url(r'^(?P<pk>\d+)/update$',
        PostUpdateDeleteView.as_view(),
        name='update-post'),  #PUT
    url(r'^(?P<pk>\d+)/delete$',
        PostUpdateDeleteView.as_view(),
        name='delete-post'),  #DELETE
    url(r'^(?P<pk>\d+)/comment$',
        CommentView.as_view(),
        name='comment-on-post'),  #POST
    url(r'^(?P<pk>\d+)/vote', PostUpdateDeleteView.as_view(),
        name='vote-post'),  #PATCH
    url(r'^tag$', TagView.as_view(), name='list-tag'),  #GET
]
Esempio n. 7
0
from django.urls import path

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

urlpatterns = [
    path('', PostListView.as_view(), name='post_list'),
    path('upload', PostUploadView.as_view(), name='post_upload'),
    path('add', PostCreateView.as_view(), name='post_create'),
    path('<int:pk>', PostDetailView.as_view(), name='post_details'),
    path('<int:pk>/update', PostUpdateView.as_view(), name='post_update'),
]
Esempio n. 8
0
from django.contrib import admin
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'),
Esempio n. 9
0
from django.urls import path, include
from blog.views import PostListView, PostDetailView, PostCreateView



urlpatterns = [
    path('api/', include('api.urls')),
    path('', PostListView.as_view(), name='blog-list-page'),
    path('<str:slug>/', PostDetailView.as_view(), name='blog-details-page'),
    path('new', PostCreateView.as_view(), name='new-page'),
]
Esempio n. 10
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"),
]
Esempio n. 11
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)
Esempio n. 12
0
    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 import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin

from blog.views import ProfileView, PostCreateView, PostListView, PostDetailView, UserPostListView, \
    CommentListView, MessagesListView, MessagesUserView, UserView, PostUpdateView

post_urls = [
    url(r'^create/$', PostCreateView.as_view(), name='post-create'),
    url(r'^update/(?P<pk>[-\w]+)/$',
        PostUpdateView.as_view(),
        name='post-update'),
    url(r'^my/$', UserPostListView.as_view(), name='post-list-user'),
    url(r'^comments/$', CommentListView.as_view(), name='comment-list-user'),
    url(r'^(?P<pk>[-\w]+)/$', PostDetailView.as_view(), name='post-detail'),
]

messages_urls = [
    url(r'^$', MessagesListView.as_view(), name='message_list'),
    url(r'^(?P<user>[-\w]+)/$', MessagesUserView.as_view(), name='message'),
]

urlpatterns = [
    url(r'^admin/', admin.site.urls),
Esempio n. 13
0
"""blog_example URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.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.contrib import admin
from django.urls import path, include
from django.views.generic import TemplateView

import quizzer
from blog.views import PostCreateView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('success/', TemplateView.as_view(template_name='success.html')),
    path('quizzer/', include('quizzer.urls')),
    path('', PostCreateView.as_view())
]
Esempio n. 14
0
from django.conf.urls import url
from . import views
from blog.views import PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView

urlpatterns = [
    #url('^$', views.home, name = 'blog-home'),
    url('^$', PostListView.as_view(), name='blog-home'),
    url('about/', views.about, name='blog-about'),
    url('post/(?P<pk>[0-9]+)/', PostDetailView.as_view(),
        name='post-detail'),  #url for specific post
    url('post/new/', PostCreateView.as_view(), name='post-create'),  #working
    url('post/(?P<pk>[0-9]+)/update/',
        PostUpdateView.as_view(),
        name='post-update'),
    url('post/(?P<pk>[0-9]+)/del/',
        PostDeleteView.as_view(),
        name='post-delete'),
]
#
Esempio n. 15
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")
Esempio n. 16
0
from django.urls import path
from . import views
from blog.views import (PostListView,
                        PostDetailView,
                        PostCreateView,
                        PostUpdateView,
                        PostDeleteView,
                        UserPostListView,
                        AddCommentView,
                        )

urlpatterns = [
    path('', PostListView.as_view(), name='blog-home'),
    path('user/<str:username>', UserPostListView.as_view(), name='user-posts'),
    path('post/<int:pk>/', PostDetailView.as_view(template_name='blog/post_detail.html'), name='post-detail'),
    path('post/<int:pk>/comment/', AddCommentView.as_view(template_name='blog/add_comment.html'), name='post_comment'),
    path('post/<int:pk>/update/', PostUpdateView.as_view(), name='post-update'),
    path('post/<int:pk>/delete/', PostDeleteView.as_view(template_name='blog/post_confirm_delete.html'),
         name='post-delete'),
    path('post/new/', PostCreateView.as_view(template_name='blog/post_form.html'), name='post-create'),
    path('about/', views.about, name='blog-about'),
]
Esempio n. 17
0
"""

    blog.urls
    =========

"""
from django.conf.urls import patterns, url

from blog.views import PostListView, PostDetailView, PostCreateView


urlpatterns = patterns('',
                       #url(r'^$', PostListView.as_view(), name="list"),
                       url(r'^post/new', PostCreateView.as_view(), name="create"),
                       url(r'^post/(?P<slug>[/\w-]+)', PostDetailView.as_view(), name="detail"),
                       )
Esempio n. 18
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'),
]
Esempio n. 19
0
from django.urls import path
from blog.views import home_view, PostList, PostDetail, PostCreateView

app_name = 'blog'

urlpatterns = [
    path('', home_view, name='home'),
    path('blog', PostList.as_view(), name='post_list'),
    path('create', PostCreateView.as_view(), name='create'),
    path('<slug:slug>/', PostDetail.as_view(), name='post_detail'),
]
Esempio n. 20
0
 def setUp(self):
     self.view = PostCreateView()
Esempio n. 21
0
"""reddit URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.9/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.conf.urls import include, url
from django.contrib import admin
from blog.views import PostListView
from blog.views import PostCreateView
from django.contrib.auth.decorators import login_required as auth

urlpatterns = [
    url(r'^admin/', admin.site.urls),

    url(r'^$', PostListView.as_view(), name='home'),
    url(r'^post/create/$', auth(PostCreateView.as_view()), name='post_create'),
]
Esempio n. 22
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"),
]
Esempio n. 23
0
from django.contrib.auth.decorators import login_required
from django.conf.urls import include, url
from django.contrib import admin

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

from blog.views import PostCreateView, PostDetailView, PostUpdateView, PostDeleteView, index
from gallery.views import PhotoCreateView, PhotoListView

# AjaxPhotoUploadView,     url(r'^(?P<pk>\d+)/ajax-upload/$', AjaxPhotoUploadView.as_view(), name='ajax_photo_upload_view',),

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', index, name='list'),
    url(r'^create/$', login_required(PostCreateView.as_view()), name='create'),
    url(r'^detail/(?P<pk>[0-9]+)/$', PostDetailView.as_view(), name='detail'),
    url(r'^update/(?P<pk>[0-9]+)/$',
        login_required(PostUpdateView.as_view()),
        name='update'),
    url(r'^delete/(?P<pk>[0-9]+)/$',
        login_required(PostDeleteView.as_view()),
        name='delete'),
    url(r'^photo_create/$',
        login_required(PhotoCreateView.as_view()),
        name='photo-create'),
    url(r'^photo_list/$', PhotoListView.as_view(), name='photo-list'),
    url(r'^login/$', 'django.contrib.auth.views.login'),
    url(r'^logout/$', 'django.contrib.auth.views.logout'),
    url(r'^tinymce/', include('tinymce.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Esempio n. 24
0
from django.conf.urls import url
from blog.views import PostsListView, PostCreateView, CommentCreateView

urlpatterns = [
    url(r'^$', PostsListView.as_view(), name='blog'),
    url(r'^post/create/$', PostCreateView.as_view(), name='create_post'),
    url(r'^comment/add/(?P<pk>-?\d+)/$',
        CommentCreateView.as_view(),
        name='new_comment'),
]
Esempio n. 25
0
from django.conf.urls import url
from blog.views import (AboutView, PostListView, PostDetailView,
                        PostCreateView, PostUpdateView, PostDeleteView,
                        DraftListView, add_comments_to_post, comment_approve,
                        comment_remove, post_publish)

urlpatterns = [
    url(r'^$', PostListView.as_view(), name='post_list'),
    url(r'^about/$', AboutView.as_view(), name='about'),
    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/(?P<pk>\d+)/edit/$',
        PostUpdateView.as_view(),
        name='post_edit'),
    url(r'^post/(?P<pk>\d+)/delete/$',
        PostDeleteView.as_view(),
        name='post_remove'),
    url(r'^drafts/$', DraftListView.as_view(), name='post_draft_list'),
    url(r'^post/(?P<pk>\d+)/comment/$',
        add_comments_to_post,
        name='add_comment_to_post'),
    url(r'^comment/(?P<pk>\d+)/approve/$',
        comment_approve,
        name='comment_approve'),
    url(r'^comment/(?P<pk>\d+)/delete/$',
        comment_remove,
        name='comment_remove'),
    url(r'^post/(?P<pk>\d+)/publish/$', post_publish, name='post_publish'),
]
Esempio n. 26
0
    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.views import PostDetailView, PostListView, Newsletter, PostCreateView
from userprofile.views import readed, subscribe
from django.contrib.auth.views import login, logout

urlpatterns = [
    url(r'^$',
        login, {
            'template_name': 'login.html',
            'redirect_authenticated_user': True
        },
        name='login'),
    url(r'^logout/$', logout, {'next_page': 'login'}, name='logout'),
    url(r'^news/$', Newsletter.as_view(), name="news"),
    url(r'^admin/', admin.site.urls),
    url(r'^posts/$', PostListView.as_view(), name="posts_list"),
    url(r'^posts/create/$', PostCreateView.as_view(), name="posts_create"),
    url(r'^posts/readed/', readed, name="readed"),
    url(r'^blogs/subs/', subscribe, name="subs"),
    url(r'^(?P<blog_slug>[\w-]+)/(?P<post_pk>\d+)/',
        PostDetailView.as_view(),
        name="post_detail"),
]
Esempio n. 27
0
from django.conf import settings
from django.conf.urls.static import static
from users import views as user_views
from django.views.generic import RedirectView
from django.conf.urls import url
from blog import views
from blog.views import PostCreateView

urlpatterns = [
    path('admin/', admin.site.urls),
]

urlpatterns += [
    path('home/', include('blog.urls'), name='home'),
    path('', RedirectView.as_view(url='/home/'), name='home'),
    path('order/', PostCreateView.as_view(), name='order'),
    path('register/', user_views.register, name='register'),
    path('profile/', user_views.profile, name='profile'),
    path('login/',
         auth_views.LoginView.as_view(template_name='users/login.html'),
         name='login'),
    path('logout/',
         auth_views.LogoutView.as_view(template_name='users/logout.html'),
         name='logout'),
    path('', include('blog.urls')),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
Esempio n. 28
0
#coding: utf-8
from django.conf.urls import url
from blog.views import PostListView, PostDetailView,PostCreateView

urlpatterns = [
    url(r'^$', PostListView.as_view(), name='list'),
    url(r'^(?P<pk>\d+)/$', PostDetailView.as_view(),name='detail'),
    url(r'^create/$', PostCreateView.as_view(),name='create'),
]
Esempio n. 29
0
from django.urls import path
from blog.views import PostListView, PostDetailView, contact_us_form_view, PostCreateView, PostUpdateView, PostDeleteView, profileDetailView, BookmarkView, CommentDeleteView, bookmarkDeleteView, PostSearchListView

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/', PostSearchListView.as_view(), 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')
]
Esempio n. 30
0
from django.urls import path, include
from blog.views import contact_us_form_view, register_form_view, post_update_form_view, post_delete_form_view
from blog.views import PostCreateView, PostListView, PostDetailView

urlpatterns = [
    path('', PostListView.as_view(), name='home'),

    # path('category/<int:id>', HomeView.as_view(), name='category_filters'),
    # path('blog/<int:id>',PostView.as_view(), name='post-detail'),

    # path('blog/<int:pk>',PostDetailView.as_view(), name='post-detail'),

    # if you want to keep id as id then use pk_url_kwarg = 'pk' in views
    path('blog/<int:id>', PostDetailView.as_view(), name='post-detail'),
    path('contact', contact_us_form_view, name='contact-us'),
    path('register', register_form_view, name='register'),
    path('post', PostCreateView.as_view(), name='new-post'),
    path('update/<int:id>', post_update_form_view, name='update'),
    path('delete/<int:id>', post_delete_form_view, name='delete'),
]
from django.urls import path, include
from django.conf.urls import url
from . import views
from blog.views import PostListView, PostDetailView, PostCreateView, PostDeleteView, PostUpdateView,UserPostListView

urlpatterns = [
    path('', PostListView.as_view(), name='blog-home'),
    path('user/<str:username>/', UserPostListView.as_view(), name='user-posts'),
    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'),

]
Esempio n. 32
0
from django.urls import path
from blog import views
from blog.views import AboutView, PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDetailView, PostDraftView

# Template tag
app_name = 'blog'

urlpatterns = [
    path('about', AboutView.as_view(), name='about'),
    path('', PostListView.as_view(), name='post_list'),
    path('post/new', PostCreateView.as_view(), name='post_new'),
    path('post/<int:pk>', PostDetailView.as_view(), name='post_detail'),
    path('post/<int:pk>/edit', PostUpdateView.as_view(), name='post_edit'),
    path('post/<int:pk>/remove', PostDetailView.as_view(), name='post_remove'),
    path('drafts', PostDraftView.as_view(), name='post_draft_list'),

    # Comment urls
    path('post/<int:pk>/comment', views.add_comment_post, name='add_comment_post'),
    path('comment/<int:pk>/approve', views.comment_approve, name='comment_approve'),
    path('comment/<int:pk>/remove', views.comment_remove, name='comment_remove'),
    path('post/<int:pk>/publish', views.post_publish, name='post_publish'),
]
Esempio n. 33
0
from django.urls import path
from django.views.decorators.http import require_POST

from blog.views import IndexView, PostDetailView, PostCreateView, PostEditView, PostDeleteView, post_like, \
    ProfilePageView

urlpatterns = [
    path('', IndexView.as_view(), name='index'),
    path('post/<int:pk>', PostDetailView.as_view(), name='full post'),
    path('post/create/', PostCreateView.as_view(), name='create post'),
    path('post/edit/<int:pk>', PostEditView.as_view(), name='edit post'),
    path('post/delete/<int:pk>', PostDeleteView.as_view(), name='delete post'),
    path('post/like/<int:pk>', post_like, name='like post'),
    path('profile/<int:pk>', ProfilePageView.as_view(), name='profile page'),
]
Esempio n. 34
0
from django.conf.urls import patterns, url

from blog.views import PostListView, PostCreateView

urlpatterns = patterns('',
	url(r'^$', PostListView.as_view(), name='post_list_view'),
	url(r'^create/$', PostCreateView.as_view(), name='post_create_view'),
)