#-*- coding: utf-8 -*-
__author__ = 'daviddetena'

# -*- coding: utf-8 -*-
from django.conf.urls import url
from blogs.views import HomeView, BlogListView, BlogDetailView, PostDetailView, CreateView

urlpatterns = [
    # Blogs URLs
    url(r'^$', HomeView.as_view(), name='home'),
    url(r'^blogs/$', BlogListView.as_view(), name='blog_list'),
    url(r'^blogs/(?P<username>[a-z]+)$', BlogDetailView.as_view(), name='blog_detail'),
    url(r'^blogs/(?P<username>[a-z]+)/(?P<pk>[0-9]+)', PostDetailView.as_view(), name='post_detail'),
    url(r'^new-post/$', CreateView.as_view(), name='post_create'),
]
예제 #2
0
from django.contrib import admin

from blogs.api import BlogsAPI, PostsAPI, PostDetailAPI, UserBlogAPI
from blogs.views import LatestPostsView, BlogsView, UserBlogView, PostDetailView, NewPostView
from users.api import UsersAPI, UserDetailAPI
from users.views import LoginView, SignupView, logout

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', LatestPostsView.as_view(), name='index'),
    url(r'^blogs/$', BlogsView.as_view(), name='blogs'),
    url(r'^blogs/(?P<username>[0-9a-zA-Z_-]+)/$',
        UserBlogView.as_view(),
        name='user_blog'),
    url(r'^blogs/(?P<username>[0-9a-zA-Z_-]+)/(?P<pk>[0-9]+)/$',
        PostDetailView.as_view(),
        name='post_detail'),
    url(r'^new-post/$', NewPostView.as_view(), name='new_post'),
    url(r'^login/$', LoginView.as_view(), name='login'),
    url(r'^signup/$', SignupView.as_view(), name='signup'),
    url(r'^logout/$', logout, name='logout'),

    # API Users
    url(r'^api/1.0/users/$', UsersAPI.as_view(), name='users_api'),
    url(r'^api/1.0/users/(?P<pk>[0-9]+)/$',
        UserDetailAPI.as_view(),
        name='user_detail_api'),

    # API Blogs
    url(r'^api/1.0/blogs/$', BlogsAPI.as_view(), name='blogs_api'),
    url(r'^api/1.0/blogs/(?P<pk>[0-9]+)/$',
예제 #3
0
urlpatterns = patterns('',
    url(
        regex=r'^tagged/(?P<tag_slug>[-\w]+)/$',
        view=TagDetailView.as_view(),
        name='tags_detail',
    ),
    url(
        regex=r'^$',
        view=PostListView.as_view(),
        name='posts_list',
    ),
    url(
        regex=r'^(?P<year>\d{4})/(?P<month>\d{1,2})/'
               '(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$',
        view=PostDetailView.as_view(),
        name='posts_detail',
    ),
    url(
        regex=r'^(?P<year>\d{4})/$',
        view=PostYearArchiveView.as_view(),
        name='posts_archive_year',
    ),
    url(
        regex=r'^(?P<year>\d{4})/(?P<month>\d{1,2})/$',
        view=PostMonthArchiveView.as_view(),
        name='posts_archive_month',
    ),
    url(
        regex=r'^(?P<year>\d{4})/(?P<month>\d{1,2})/'
               '(?P<day>\d{1,2})/$',
예제 #4
0
파일: urls.py 프로젝트: walnow78/wordplese
from django.contrib.auth.decorators import login_required

# APIRouter

router = DefaultRouter()

router.register(r'api/1.0/users', UserViewSet, base_name='user')

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', HomeView.as_view(), name='home'),

    # Blogs
    url(r'^blogs/$', BlogListView.as_view(), name='blogs_list'),
    url(r'^blogs/(?P<user>[A-Za-z0-9]+)$', BlogListDetailView.as_view(), name='blog_user'),
    url(r'^blogs/(?P<user>[A-Za-z0-9]+)/(?P<pk>[0-9]+)$', PostDetailView.as_view(), name='post_detail'),

    # Posts
    url(r'^new-post$', CreatePostView.as_view(), name='new_post'),

    # Blogs API
    url(r'^api/1.0/blogs/$', BlogListAPI.as_view(), name='post_list_api'),
    url(r'^api/1.0/blogs/(?P<user>[A-Za-z0-9]+)$', PostListAPI.as_view(), name='blog_user_api'),
    url(r'^api/1.0/blogs/(?P<user>[A-Za-z0-9]+)/(?P<pk>[0-9]+)$', PostDetailAPI.as_view(), name='post_detail_api'),

    url(r'^api/1.0/post/new-post$', CreatePostViewSet, name='new_post_api'),

    # Users URL
    url(r'^login$', LoginView.as_view(), name='user_login'),
    url(r'^logout$', LogoutView.as_view(), name='user_logout'),
    url(r'^signup$', SignupView.as_view(), name='user_signup'),
예제 #5
0
router = SimpleRouter()
router.register(r'blogs', BlogViewSet, basename='blogs_api')
router.register(r'blogs-detail', BlogDetailViewSet, basename='blogs_detail_api')
router.register(r'users', UsersViewSet, basename='users_api')
router.register(r'posts', PostAPIViewSet, basename='posts_api')


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

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

    # auth
    path('login', LoginView.as_view(), name="login"),
    path('logout', LogoutView.as_view(), name="logout"),
    path('sign-up', SignUpView.as_view(), name="sign_up"),

    # blogs
    path('blogs/', BlogsListView.as_view(), name="blogs"),
    path('blogs/<str:username>/', BlogDetailView.as_view(), name="blog_detail"),
    path('blogs/<str:username>/<int:pk>', PostDetailView.as_view(), name="post_detail"),

    # posts
    path('new-post', NewPostView.as_view(), name="new_post"),

    # home
    path('', LatestPostsView.as_view(), name="home"),

]
from django.conf.urls.static import static
from rest_framework.routers import SimpleRouter

from blogs.api import BlogsViewSet, BlogDetailViewSet, PostViewSet
from blogs.views import SignUpView, PostDetailView, home, CreatePostView, user_posts_list, blogs_list, search_categories
from users.api import UsersViewSet
from users.views import logout, LoginView

#  Router for the API
router = SimpleRouter()
router.register('users', UsersViewSet)
router.register('blogs/detail', BlogDetailViewSet)
router.register('blogs', BlogsViewSet),
router.register('post', PostViewSet)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('login/', LoginView.as_view(), name="login_page"),
    path('logout/', logout, name="logout_page"),
    path('signup/', SignUpView.as_view(), name="signup_page"),
    path('search/', search_categories),
    path('', home, name="home_page"),
    path('create-post/', CreatePostView.as_view(), name="create_post_page"),
    path('blogs/', blogs_list, name="blogs_list__page"),
    path('blogs/<nombre_usuario>', user_posts_list, name="posts_user_page"),
    path('posts/<int:pk>', PostDetailView.as_view(), name="post_detail_page"),

    # API de usuarios
    path('api/1.0/', include(router.urls))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
예제 #7
0
from django.urls import path
from . import views
from blogs.views import PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView

urlpatterns = [
    path('', PostListView.as_view(), name='blogs-home'),
    path('posts/new/', PostCreateView.as_view(), name='blogs-create'),
    path('posts/<int:pk>', PostDetailView.as_view(), name='blogs-detail'),
    path('posts/<int:pk>/update',
         PostUpdateView.as_view(),
         name='blogs-update'),
    path('posts/<int:pk>/delete',
         PostDeleteView.as_view(),
         name='blogs-delete'),
    path('about/', views.about, name='blogs-about'),
]
예제 #8
0
 path('post/', PostListView.as_view(), name='blog-home'),
 path('pdf/', list_pdf, name='list_pdf'),
 path('pdf/upload/', upload_pdf, name='upload_pdf'),
 path('pdf/<int:pk>/', delete_pdf, name='delete_pdf'),
 path('pdf/<str:pdf_cat>', category_list_pdf, name='category_list_pdf'),
 path('contact/', contactView, name='contact'),
 path('contact_success/', successView, name='contact_success'),
 path('calendar/', CalendarView, name='calendar'),
 path('', include('sendemail.urls')),
 path('user/<str:username>/', UserPostListView.as_view(),
      name='user-posts'),
 path('subscribe/', email_list_signup, name='subscribe'),
 path('categories/<str:categories>/',
      CategoryPostListView.as_view(),
      name='categories-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('comment/list', CommentListView.as_view(), name='comment-list'),
 path('comment/<str:blogpost_connected>/',
      CommentDetailView.as_view(),
      name='comment-detail'),
 path('comment/<int:pk>/',
      CommentDetailView.as_view(),
      name='comment-detail-pk'),
 path('comment/<int:pk>/delete/',
      CommentDeleteView.as_view(),
      name='comment-delete'),
 path('post/new/', PostCreateView.as_view(), name='post-create'),
예제 #9
0
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView

from blogs.views import PostCreationView
from blogs.views import PostDetailView
from blogs.views import PostUpdateView
from blogs.views import PostListView
from blogs.views import PostDeleteView

urlpatterns = patterns('',
    url(r'^new/?$', PostCreationView.as_view(), name='posts-create'),
    url(r'^/?$', PostListView.as_view(), name='posts-list'),
    url(r'^post/(?P<slug>.*?)/?$', PostDetailView.as_view(), name='posts-detail'),
    url(r'^update/(?P<slug>.*?)/?$', PostUpdateView.as_view(), name='posts-update'),
    url(r'^delete/(?P<slug>.*?)/?$', PostDeleteView.as_view(), name='posts-delete'),
)
예제 #10
0
파일: urls.py 프로젝트: deanusama/botmood
from django.urls import path, include

from blogs import views
from blogs.views import PostDetailView

urlpatterns = [
    # path('', PostListView.as_view(), name='blog-list'),
    path('<slug:slug>/', PostDetailView.as_view(), name='blog-detail'),
    path('hitcount/', include(('hitcount.urls', 'hitcount'), namespace='hitcount')),
    # path('blog/', BlogList.as_view(), name='blog-list'),
    path('', views.blog, name='blog-list'),
    # path('<slug:slug>/', views.detail, name='blog-detail'),
    path('category/<str:id>/', views.category_page, name='cate-page'),
    path('search', views.search, name='search')

]
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from blogs.views import HomeView, NewPostView, BlogListView, BlogDetailView, PostDetailView

urlpatterns = [
    #Blogs URLs
    url(r'^$', HomeView.as_view(), name='blogs_home'),
    url(r'^new-post/$', login_required(NewPostView.as_view()), name='create_post'),
    url(r'^blogs/$', BlogListView.as_view(), name='blogs_list'),
    url(r'^blogs/(?P<username>[a-z0-9_-]{3,16})$', BlogDetailView.as_view(), name='blog_detail'),
    url(r'^blogs/(?P<username>[a-z0-9_-]{3,16})/(?P<pk>[0-9]+)$', PostDetailView.as_view(), name='post_detail')
]
예제 #12
0
from django.urls import path

from blogs.api import BlogListAPI, PostListAPI, PostDetailAPI
from blogs.views import LatestPostsView, BlogListView, PostListByAuthorView, PostDetailView, CreatePostView
from users.api import UserListAPI, UserDetailAPI
from users.views import LoginView, LogoutView, SignUpView

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

    path('login/', LoginView.as_view(), name="login_page"),
    path('logout/', LogoutView.as_view(), name="logout_page"),
    path('singup/', SignUpView.as_view(), name="signup_page"),

    path('new-post/', CreatePostView.as_view(), name="create_post_page"),

    path('blogs/<str:author>/<int:pk>', PostDetailView.as_view(), name="post_detail_page"),
    path('blogs/<str:author>/', PostListByAuthorView.as_view(), name="list_posts_page"),
    path('blogs/', BlogListView.as_view(), name="list_blogs_page"),
    path('', LatestPostsView.as_view(), name="home_page"),

    # API REST
    path('api/1.0/users/<int:pk>', UserDetailAPI.as_view(), name="api_user_detail"),
    path('api/1.0/users/', UserListAPI.as_view(), name="api_users_list"),

    path('api/1.0/blogs/<str:author>/<int:pk>', PostDetailAPI.as_view(), name="api_post_detail"),
    path('api/1.0/blogs/<str:author>/', PostListAPI.as_view(), name="api_blogs_author"),
    path('api/1.0/blogs/', BlogListAPI.as_view(), name="api_blogs_list")
]