Ejemplo n.º 1
0
# -*- coding: utf-8 -*-
from django.conf.urls import url

from blog.views import PostsView

urlpatterns = [url(r"^posts/$", PostsView.as_view(), name="posts")]
Ejemplo n.º 2
0
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"),
    path('monthly/<int:year>/<int:month>/',
         ArticleMonthArchiveView.as_view(month_format='%m'),
         name="archive_month_numeric"),
    path('<int:year>/week/<int:week>/',
         ArticleWeekArchiveView.as_view(),
         name="archive_week"),
    path('show_month/', ShowMonthly.as_view(), name='show_month'),
Ejemplo n.º 3
0
from django.urls import path
from blog.views import (PostView, PostsView, CategoryView, AddPostView,
                        EditPostView, add_comment, like_comment, get_comments)
from .api import PostViewSet, CategoryViewSet, CommentViewSet
from core.urls import router

router.register(r'post_viewset', PostViewSet)
router.register(r'category_viewset', CategoryViewSet)
router.register(r'comment_viewset', CommentViewSet)

app_name = 'blog'

urlpatterns = [
    path('', PostsView.as_view(), name='home'),
    path('post/<slug:slug>/', PostView.as_view(), name='post'),
    path('category/<str:cat>/', CategoryView.as_view(), name='category'),
    path('add_post/', AddPostView.as_view(), name='add_post'),
    path('edit_post/<slug:slug>/', EditPostView.as_view(), name='edit_post'),
    path('add_comment/', add_comment, name='add_comment'),
    path('comment_like/', like_comment, name='like_comment'),
    path('get_comments/<slug:slug>/', get_comments, name='comments'),
]
Ejemplo n.º 4
0
from settings import MEDIA_ROOT

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

from blog.views import PostsView, PostDetailView, EditPostView, CreatePostView, LoginView

urlpatterns = patterns('',
    url(r"^admin/doc/", include("django.contrib.admindocs.urls")),
    url(r"^admin/", include(admin.site.urls)),
    url(r"^static/(?P<path>.*)$", "django.views.static.serve",
            { "document_root": MEDIA_ROOT }),
    url(r"^$", PostsView.as_view(), name='main'),
    url(r"^post/(?P<slug>[-\w]+)/$", PostDetailView.as_view(), name='post'),
    url(r"^update/(?P<slug>[-\w]+)/$", EditPostView.as_view(), name='update'),
    url(r"^create/$", CreatePostView.as_view(), name='create'),
    url(r'^login/$', LoginView.as_view(), name="login"),
)
Ejemplo n.º 5
0
from django.conf.urls import url

from blog.views import PostsView

urlpatterns = [
    url(r'^post/$', PostsView.as_view(), name='posts'),
    url(r'^post/(?P<pk>[0-9]+|)/$', PostsView.as_view(), name='posts'),
]
Ejemplo n.º 6
0
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from blog.views import PostsView

urlpatterns = [
    url(r'^$', PostsView.as_view(), name='home'),
    url(r'^admin/', include(admin.site.urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\
  + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)