Example #1
0
 def setUpClass(cls):
     super(TestBlogPostView, cls).setUpClass()
     cls.rf = RequestFactory()
     cls.slug = 'my-test-slug'
     cls.request = cls.rf.get('/blog/' + cls.slug)
     cls.post = G(BlogPost, slug=cls.slug)
     cls.view = BlogPostView()
     setattr(cls.view, 'request', cls.request)
Example #2
0
    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 accounts import urls as urls_accounts
from accounts.views import IndexView
from blog.views import BlogPostView
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from tasks.views import ArticlesView, ChargeView, PiecesView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^accounts/', include(urls_accounts)),
    url(r'^articles/', ArticlesView.as_view(), name='articles'),
    url(r'^charge/', ChargeView.as_view(), name='charge'),
    url(r'^pieces/', PiecesView.as_view(), name='pieces'),
    url(r'^blog/', BlogPostView.as_view(), name='blog'),
]

if settings.DEBUG:
    urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.urls import path
from blog.views import BlogPostView, LikeView, CommentView, ListBlogView

urlpatterns = [
    path("post/list/", ListBlogView.as_view()),
    path("post/", BlogPostView.as_view()),
    path("like/<int:id>/", LikeView.as_view()),
    path("comment/", CommentView.as_view()),
]
Example #4
0
from blog.views import BlogListView, BlogPostView, BlogPostEditView, BlogListUnpublishedView, BlogPostCreateView, \
    BlogPostPublishView, BlogPostUnpublishView, AuthorView, AuthorUnpublishedView, AuthorPostsView, \
    BlogPostToPersonalView, BlogPostToCompanyView, AuthorListView, BlogFeedView
from django.conf.urls import url


urlpatterns = [
    url(r'^$', BlogListView.as_view(), name="blog_article_list"),
    url(r'^feed$', BlogFeedView.as_view(), name="blog_feed"),
    url(r'^unpublished$', BlogListUnpublishedView.as_view(), name="blog_unpublished_article_list"),
    url(r'^post/(?P<slug>[^\/]*)$', BlogPostView.as_view(), name="blog_post"),
    url(r'^write$', BlogPostCreateView.as_view(), name="blog_create_post"),
    url(r'^post/(?P<pk>\d+)/edit$', BlogPostEditView.as_view(), name="blog_post_editor"),
    url(r'^post/(?P<pk>\d+)/publish$', BlogPostPublishView.as_view(), name="blog_post_publish"),
    url(r'^post/(?P<pk>\d+)/unpublish$', BlogPostUnpublishView.as_view(), name="blog_post_unpublish"),
    url(r'^post/(?P<pk>\d+)/to_personal$', BlogPostToPersonalView.as_view(), name="blog_post_to_personal"),
    url(r'^post/(?P<pk>\d+)/to_company$', BlogPostToCompanyView.as_view(), name="blog_post_to_company"),

    url(r'^authors/$', AuthorListView.as_view(), name="author_list"),
    url(r'^author/(?P<username>[^\/]*)$', AuthorView.as_view(), name="author"),
    url(r'^author/(?P<username>[^\/]*)/posts$', AuthorPostsView.as_view(), name="author_posts"),
    url(r'^author/(?P<username>[^\/]*)/posts/unpublished$', AuthorUnpublishedView.as_view(),
        name="author_unpublished_posts"),
    url(r'^author/(?P<username>[^\/]*)/posts/personal$', AuthorPostsView.as_view(personal=True),
        name="author_personal_posts"),
    url(r'^author/(?P<username>[^\/]*)/posts/personal/unpublished$', AuthorUnpublishedView.as_view(personal=True),
        name="author_personal_unpublished_posts"),
]
from django.conf.urls import include, url
from django.contrib import admin

from content.views import *
from blog.views import BlogPostsView, BlogPostView



urlpatterns = [
    
    # Main webpage
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^contact/$', ContactView.as_view(), name='contact'),
    url(r'^start/$', StartView.as_view()),
    url(r'^r/(?P<slug>[_\w]+)/$', RoomView.as_view()),
    url(r'^welcome_to_te_league_of_draven/$', BuildTeamView.as_view()),
    url(r'^close_room/$', CloseRoomView.as_view(), name='close_room'),

    # Blog
    url(r'^blog/$', BlogPostsView.as_view(), name='blog_posts'),
    url(r'^blog/(?P<slug>[_\w]+)/$', BlogPostView.as_view(), name='blog_post'),

    # TTTT
    url(r'^supporters/$', SupportersView.as_view(), name='supporters'),


    url(r'^admin/', include(admin.site.urls)),
]
Example #6
0
from ert.views import ContactView
from blog.views import BlogPostView

admin.autodiscover()
# browserid_admin.copy_registry(admin.site)

urlpatterns = patterns(
    '',
    # API for submitting contact form
    url(r'^contact-message/$', ContactView.as_view(), name='contact'),

    # API for beer store
    url(r'^api/store/', include('store.urls')),

    # API for blog
    url(r'^api/blog/posts/?$', BlogPostView.as_view(), name='blog-posts'),

    # Static files for WYSIWYG admin editor
    url(r'^summernote', include('django_summernote.urls')),
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT}),

    # Jasmine front-end unit tests
    url(r'^test/jasmine/$',
        TemplateView.as_view(template_name='jasmine.html'),
        name='jasmine'),

    # Admin site login
    url(r'^admin/', include(admin.site.urls)),

    # Default entry point for all angular pages
Example #7
0
"""blog URL Configuration
"""
from blog.views import BlogPostView
from django.urls import path

urlpatterns = [
    path("", BlogPostView.as_view()),
]
Example #8
0
# -*- coding: utf-8 -*-
"""
  :synopsis: urls for the blog app.

.. module: blog.urls
.. author: Chris Bartlett <*****@*****.**>
"""
from django.urls import path, re_path

from blog.views import BlogPostView, BlogPostListView

urlpatterns = [
    path('', BlogPostListView.as_view(), name='list'),
    re_path(r'(?P<slug>[\w-]+)/$', BlogPostView.as_view(), name='post'),
]
Example #9
0
from django.conf.urls import url

from blog.views import BlogPostView, BlogPostsView

urlpatterns = [
    url(r'post/(?P<pk>\d+)/$', BlogPostView.as_view(), name='post'),
    url(r'posts/$', BlogPostsView.as_view(), name='posts'),
    url(r'posts/(?P<option>\d+)/$', BlogPostsView.as_view(), name='post-option'),
    url(r'posts/(?P<option>\d+)/(?P<count>\d+)/$', BlogPostsView.as_view(), name='post-option-count'),
]
Example #10
0
File: urls.py Project: m3wolf/ert
from blog.views import BlogPostView

admin.autodiscover()
# browserid_admin.copy_registry(admin.site)

urlpatterns = patterns(
    '',
    # API for submitting contact form
    url(r'^contact-message/$', ContactView.as_view(),
        name='contact'),

    # API for beer store
    url(r'^api/store/', include('store.urls')),

    # API for blog
    url(r'^api/blog/posts/?$', BlogPostView.as_view(),
        name='blog-posts'),

    # Static files for WYSIWYG admin editor
    url(r'^summernote', include('django_summernote.urls')),

    url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
        'document_root': settings.MEDIA_ROOT
    }),

    # Jasmine front-end unit tests
    url(r'^test/jasmine/$', TemplateView.as_view(template_name='jasmine.html'),
        name='jasmine'),

    # Admin site login
    url(r'^admin/', include(admin.site.urls)),
Example #11
0
from django.urls import path

from blog.views import BlogListView, BlogDetailView, PostView, BlogSiteView, BlogPostView

urlpatterns = [
    path("blogs/", BlogListView.as_view()),
    path("blogs/<int:blog_id>/", BlogDetailView.as_view()),
    path("blogs/<str:site>/", BlogSiteView.as_view()),
    path("blogs/<int:blog_id>/posts/<int:post_id>/", PostView.as_view()),
    path("blogs/<str:site>/posts/", BlogPostView.as_view())
]
Example #12
0
from django.urls import path

from blog.views import (BlogPostView, CommentView, CreatePostView,
                        DeletePostView, DownVoteView, HotPostsView, IndexView,
                        UpdatePostView, UpvoteView)

urlpatterns = [
    path('', IndexView.as_view(), name='index'),
    path('hot_posts/', HotPostsView.as_view(), name='hot_posts'),
    path('post/create/', CreatePostView.as_view(), name='create_post'),
    path('post/<int:post_id>/', BlogPostView.as_view(), name='blog_post'),
    path('post/<int:post_id>/update/',
         UpdatePostView.as_view(),
         name='update_post'),
    path('post/<int:post_id>/delete/',
         DeletePostView.as_view(),
         name='delete_post'),
    path('post/<int:post_id>/upvote/',
         UpvoteView.as_view(),
         name='upvote_post'),
    path('post/<int:post_id>/downvote/',
         DownVoteView.as_view(),
         name='downvote_post'),
    path('post/<int:post_id>/comment/',
         CommentView.as_view(),
         name='comment_post')
]