from django.conf.urls import patterns, url
from blog.views import post, post_edit, post_new, post_delete
from api.views import PostList, PostDetail

urlpatterns = patterns(
    "",
    url(r"^blog/$", PostList.as_view(), name="post-list"),
    url(r"^blog/(?P<pk>\d+)$", PostDetail.as_view(), name="post-detail"),
)
Exemple #2
0
# Additionally, we include login URLs for the browsable API.

users_urls = [
    url(r'^$', UserList.as_view(), name='user-list'),
    url(r'^(?P<username>[0-9a-zA-Z_-]+)/$',
        UserDetail.as_view(),
        name='user-detail'),
    url(r'^(?P<username>[0-9a-zA-Z_-]+)/posts/$',
        UserPostList.as_view(),
        name='userpost-list'),
]

posts_urls = [
    url(r'^$', PostList.as_view(), name='post-list'),
    url(r'^(?P<pk>\d+)/photos/$',
        PostPhotoList.as_view(),
        name='postphoto-list'),
    url(r'^(?P<pk>\d+)/$', PostDetail.as_view(), name='post-detail'),
]

photos_urls = [
    url(r'^(?P<pk>\d+)/$', PhotoDetail.as_view(), name='photo-detail'),
    url(r'^$', PhotoList.as_view(), name='photo-list'),
]

urlpatterns = [
    url(r'^users/', include(users_urls)),
    url(r'^posts/', include(posts_urls)),
    url(r'^photos/', include(photos_urls)),
]
Exemple #3
0
from rest_framework.urlpatterns import format_suffix_patterns
from api.views import PostList, PostDetail, PublicPostDetail, ProfileDetail
admin.autodiscover()

if settings.DEBUG:
	urlpatterns = patterns('django.views.static',
		url(r'^static/(?P<path>.*)$',  'serve', {'document_root': '/tmp/shortdiary-static/', 'show_indexes': True }),
		url(r'^asset/(?P<path>.*)$',  'serve', {'document_root': '/tmp/shortdiary-asset/', 'show_indexes': True }),
	)
else:
	urlpatterns = patterns('')


api_patterns= format_suffix_patterns(patterns('',
	url(r'^posts/$', PostList.as_view(), name="api-post-list"),
 	url(r'^posts/(?P<pk>\d+)/$', PostDetail.as_view(), name='api-post-detail'),
 	url(r'^public/$', PublicPostDetail.as_view(), name='api-public-post'),
	url(r'^profile$', ProfileDetail.as_view(), name='api-profile-detail'),
), allowed=["json", "html"])

urlpatterns += patterns('',
	url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
	url(r'^admin/', include(admin.site.urls)),

	url(r'^i18n/setlang/(?P<language>[a-z]+)', 'diary.views.switch_language'),

	url(r'^accounts/login/$', 'diary.views.login'),
	url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}),
	url(r'^accounts/signup/$', 'diary.views.sign_up'),
	url(r'^accounts/settings/$', 'diary.views.account_settings'),
from django.conf.urls import url, include

from api.views import UserList, PostDetail, PostList, UserPostList, UserDetail, PostPhotoList, PhotoList, PhotoDetail

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.

users_urls = [
    url(r'^$', UserList.as_view(), name='user-list'),
    url(r'^(?P<username>[0-9a-zA-Z_-]+)/$', UserDetail.as_view(), name='user-detail'),
    url(r'^(?P<username>[0-9a-zA-Z_-]+)/posts/$', UserPostList.as_view(), name='userpost-list'),
]

posts_urls = [
    url(r'^$', PostList.as_view(), name='post-list'),
    url(r'^(?P<pk>\d+)/photos/$', PostPhotoList.as_view(), name='postphoto-list'),
    url(r'^(?P<pk>\d+)/$', PostDetail.as_view(), name='post-detail'),
]

photos_urls = [
    url(r'^(?P<pk>\d+)/$', PhotoDetail.as_view(), name='photo-detail'),
    url(r'^$', PhotoList.as_view(), name='photo-list'),
]

urlpatterns = [
    url(r'^users/', include(users_urls)),
    url(r'^posts/', include(posts_urls)),
    url(r'^photos/', include(photos_urls)),
]
Exemple #5
0
from django.conf.urls import include, url
from django.urls import path
from rest_framework import routers
from api.views import PostList, PostDetail
from api.viewsets import PostViewSet
router = routers.DefaultRouter()
router.register('postviewset', PostViewSet, 'posts')
app_name = 'api'

urlpatterns = [
    path('', include(router.urls)),
    url(r'posts/$', PostList.as_view()),
    url(r'^posts/(?P<pk>[0-9]+)/$', PostDetail.as_view()),
]
Exemple #6
0
from django.conf.urls import include, url
from api.views import PostList, PostDetail

urlpatterns = [
    url(r'^posts/$', PostList.as_view(), name='post_list_page'),
    url(r'^posts/(?P<pk>[0-9]+)$', PostDetail.as_view(), name='post_detail_page'),
    url(r'^auth/', include('rest_framework.urls', namespace='rest_framework'))
]
from django.conf.urls import patterns, url
from blog.views import post, post_edit, post_new, post_delete
from api.views import PostList, PostDetail


urlpatterns = patterns("",
                       url(r"^blog/$", PostList.as_view(),
                           name="post-list"),
                       url(r"^blog/(?P<pk>\d+)$",
                           PostDetail.as_view(), name="post-detail"),
                       )
Exemple #8
0
from django.conf.urls import url

from api.views import UserList, UserDetail, PostDetail, PostList, CartrigesList, CartridgieDetail, DispatchList, \
    DispatchDetail

urlpatterns=[
    url(r'^users/$', UserList.as_view(), name='user-list'),
    url(r'^users/(?P<pk>\d+)/$', UserDetail.as_view(), name='user-detail'),
    url(r'^post-offices/$', PostList.as_view(), name='postoficce-list'),
    url(r'^post-offices/(?P<index>\d+)/$', PostDetail.as_view(), name='postoficce-detail'),
    url(r'^cartridgies/$', CartrigesList.as_view(), name='cartridgie-list'),
    url(r'^cartridgies/(?P<model>\d+)/$', CartridgieDetail.as_view(), name='cartridgie-detail'),
    url(r'^dispatchs/$', DispatchList.as_view(), name='dispatch-list'),
    url(r'^dispatchs/(?P<pk>\d+)/$', DispatchDetail.as_view(), name='dispatch-detail'),
]
Exemple #9
0
from django.urls import path

from api.views import PostList, PostDetail

urlpatterns = [
    path('', PostList.as_view(), name='userpost'),
    path('<int:pk>', PostDetail.as_view(), name='userpost-home')
]
Exemple #10
0
from django.urls import path

from api.views import PostList, PostDetail

urlpatterns = [
    path('', PostList.as_view(), name='post_list'),
    path('<int:pk>/', PostDetail.as_view(), name='post_detail')
]
Exemple #11
0
from django.urls import path

from api.views import PostCreate, PostList, PostDetail

urlpatterns = [
    path('blog/', PostList.as_view(), name='page_list'),
    path('blog/<int:pk>', PostDetail.as_view(), name='page_detail'),
    path('blog/new', PostCreate.as_view(), name='new_page'),
]
from django.urls import path
from api.views import Index, UserCreate, PostList, PostListAuthorPosts, PostCreate, PostDetail, CreateComment
from rest_framework.authtoken import views

urlpatterns = [
    path("", Index.as_view(), name='index'),
    path("posts/", PostList.as_view(), name='posts'),
    path("author-posts/", PostListAuthorPosts.as_view(), name='author-posts'),
    path("post-create/", PostCreate.as_view(), name='post-create'),
    path("post-detail/<int:pk>/", PostDetail.as_view(), name="post-detail" ),
    path("create-comment/<int:pk>/", CreateComment.as_view(), name="create-comment"),
    path("create-user/", UserCreate.as_view(), name='create user'),
    path('login/', views.obtain_auth_token, name='login'),
]