Exemplo n.º 1
0
from django.views.generic import ArchiveIndexView

from blog.models import Post
from blog.views import main_page, comment_like, PostsView, SinglePost, create_comment, Categories, CategoryPosts, \
    AuthorsPosts, ArticleMonthArchiveView, ArticleWeekArchiveView, ShowMonthly, ShowWeekly, SearchField
from .api import comment_detail, comment_list, PostViewSet, CommentViewSet, CategoryViewSet, PostSettingViewSet, respina_view

from zoomit.urls import router
router.register(r'posts', PostViewSet)
router.register(r'comments', CommentViewSet)
router.register(r'categories', CategoryViewSet)
router.register(r'post_settings', PostSettingViewSet)
# router.register(r'my-model/', ExampleView)

urlpatterns = [
    path('posts/<slug:slug>/', SinglePost.as_view(), name='single_post'),
    path('categories/<slug:slug>/',
         CategoryPosts.as_view(),
         name="category_posts"),
    path('categories/', Categories.as_view(), name='show_categories'),
    path('', main_page, name="main_page"),
    path('like_comment/', comment_like, name='like_comment'),
    path('posts/', PostsView.as_view(), name='posts_archive'),
    path('comment/', create_comment, name='comment_create'),
    path('authors/<slug:slug>/', AuthorsPosts.as_view(), name="authors_posts"),
    path('latest/',
         ArchiveIndexView.as_view(model=Post,
                                  date_field='create_at',
                                  template_name='blog/posts.html',
                                  context_object_name='post_list'),
         name="latest_posts"),
Exemplo n.º 2
0
Arquivo: urls.py Projeto: notfier/blog
from django.conf.urls import patterns, url

from blog.views import PostsList, SinglePost, TagView, AllTagCloudView
from test_blog.settings import MEDIA_ROOT
# urls

urlpatterns = patterns(
    '',
    url(r'^tag/(?P<slug>\S+)/$', TagView.as_view(), name='tagger'),
    url(r'^post/add_comment/(?P<slug>\S+)/$',
        'blog.views.add_comment',
        name="commenter"),
    url(r'^$', PostsList.as_view(), name="all_posts"),
    url(r'^post/(?P<slug>\S+)/$', SinglePost.as_view(), name='single_post'),
)

urlpatterns += patterns(
    '',
    url(r'^media/pictures/(.+)/$', 'django.views.static.serve', {
        'document_root': MEDIA_ROOT,
    }),
)
Exemplo n.º 3
0
from django.conf.urls import patterns, url

from blog.views import HomePage, EditPost, DeletePost, NewPost, SinglePost

urlpatterns = patterns('blog.views',
    url(r'^$', HomePage.as_view(), name='blog_HomePage'),
    url(r'^newpost/$', NewPost.as_view(), name='blog_NewPost'),
    url(r'^post/(?P<slug>[\w-]+)$', SinglePost.as_view(), name='blog_SinglePost'),
    url(r'^edit/(?P<id>[0-9]+)$', EditPost.as_view(), name='blog_EditPost'),
    url(r'^delete$', DeletePost.as_view(), name='blog_DeletePost'),
)
Exemplo n.º 4
0
from blog.views import BlogView, SinglePost, AddComment
#from blog.models import BlogPost
from django.conf.urls import patterns, include, url
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns(
    '',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', BlogView.as_view(template_name='list.html'), name='blogview'),
    url(r'^(?P<pk>\d+)/$',
        SinglePost.as_view(template_name='post_detail.html'),
        name='singlepost'),
    #url(r'^(?P<pk>\d+)/comment', AddComment.as_view(template_name='comment_form.html'), name='commenturl'),
)