Beispiel #1
0
 def test_no_posts_in_context(self):
     request = self.factory.get('/')
     request.user = UserFactory(password=random_string_generator())
     response = PostList.as_view()(request)
     self.assertEqual(
         list(response.context_data['latest']),
         [],
     )
Beispiel #2
0
 def test_posts_in_context(self):
     request = self.factory.get('/')
     post = PostFactory()
     request.user = post.user
     response = PostList.as_view()(request)
     self.assertEqual(
         list(response.context_data['latest']),
         [post],
     )
Beispiel #3
0
from django.urls import path

from post.views import PostList, PostDetail

urlpatterns = [
    path('posts', PostList.as_view()),
    path('posts/<int:pk>', PostDetail.as_view())
]
Beispiel #4
0
from django.urls import path

from rest_framework.urlpatterns import format_suffix_patterns

from personal_website.urls import ROUTER
from post.views import PostCreate, PostDelete, PostDetail, PostList, PostUpdate, PostViewSet

app_name = 'post'

ROUTER.register('posts', PostViewSet, base_name='post')

urlpatterns = [
    path('', PostList.as_view(), name='list'),
    path('create/', PostCreate.as_view(), name='create'),
    path('<slug:slug>/', PostDetail.as_view(), name='detail'),
    path('<slug:slug>/update/', PostUpdate.as_view(), name='update'),
    path('<slug:slug>/delete/', PostDelete.as_view(), name='delete'),
]

urlpatterns = format_suffix_patterns(urlpatterns)

# TODO: Add RSS/Atom
from django.conf.urls import url
from post.views import PostList, Post

urlpatterns = [
    url(r'^list/$', PostList.as_view(), name="post list api"),
    url(r'^detail/(?P<pk>[0-9]+)/$', Post.as_view(), name="post detail api"),
]
Beispiel #6
0
from django.urls import path
from post.views import (PostUp, PostList, PostListAll, AddComment, GetComments,
                        AddLikeToPost)

urlpatterns = [
    path('/postUp', PostUp.as_view()),
    path('/postList', PostList.as_view()),
    path('/postListAll', PostListAll.as_view()),
    path('/addComment', AddComment.as_view()),
    path('/getComments', GetComments.as_view()),
    path('/addLikeToPost', AddLikeToPost.as_view()),
]
Beispiel #7
0
from django.conf.urls import url
from django.contrib import admin
from rest_framework.urlpatterns import format_suffix_patterns
from main import views
from post.views import Post_responseList, PostList, PostLocationList, Post_UserIdList, Post_UserList, Status\
    , Response_postList, payment,passbookList

urlpatterns = (
    url(r'^admin/', admin.site.urls),
    url(r'^user/$', views.SignupList.as_view()),
    url(r'^profile/(?P<pk>[0-9]+)/$', views.UserList.as_view()),
    url(r'^login/$', views.LoginList.as_view()),
    url(r'^email/$', views.EmailList.as_view()),
    url(r'^reset/$', views.ResetList.as_view()),
    url(r'^post/$', PostList.as_view()),
    url(r'^postuserid/(?P<user_id>[0-9]+)/(?P<pk>[0-9]+)/$',
        Post_UserIdList.as_view()),
    url(r'^post_response/(?P<post_id>[0-9]+)/$', Post_responseList.as_view()),
    url(r'^response_post/(?P<user_id>[0-9]+)/$', Response_postList.as_view()),
    url(r'^userlocation/(?P<user_id>[0-9]+)/$',
        views.UserLocationList.as_view()),
    url(r'^nearby/(?P<pk>[0-9]+)/$', PostLocationList.as_view()),
    url(r'^postuser/(?P<user_id>[0-9]+)/$', Post_UserList.as_view()),
    url(r'^passbook/(?P<user_id>[0-9]+)/$', passbookList.as_view()),
    # url(r'^notification/(?P<title>[A-Za-z]+)/(?P<message>[A-Za-z]+)/(?P<resgistration_id>[A-Za-z]+)/$', views.notifications),
    url(r'^status/(?P<res_id>[0-9]+)/$', Status.as_view()),
    url(r'^payment/(?P<res_id>[0-9]+)/$', payment),
)

urlpatterns = format_suffix_patterns(urlpatterns)
Beispiel #8
0
from django.conf.urls import patterns, url, include
from rest_framework.urlpatterns import format_suffix_patterns
from post.views import index, post, PostList, PostDetail

urlpatterns = patterns('',
        url(r'^(?P<post_id>\d+)/$', post),
        url(r'^api/$', PostList.as_view()),
        url(r'^api/(?P<pk>[0-9]+)/$', PostDetail.as_view()),
        url(r'^', index),
        )

urlpatterns = format_suffix_patterns(urlpatterns)
Beispiel #9
0
from django.conf.urls import url

from post.views import PostList, PostDetail, PostAdd

urlpatterns = [
    url(r'^post/$', PostList.as_view(), name='post_list'),
    url(r'^post/(?P<pk>[0-9]+)/', PostDetail.as_view(), name='post_detail'),
    url(r'^post/add/$', PostAdd.as_view(), name='post_add')
]
Beispiel #10
0
from django.urls import path
from post.views import PostList, PostDetail, PostListView, PostAddView, PostEditView, PostListByAuthor, PostListByYear, PostListByMonth, PostListByDay
from home.views import HomeView
from about.views import AboutView
from contact.views import ContactAdd
from sitesetting.views import SiteSettingEdit
from djadmin.views import Dashboard
from django.contrib.auth.views import LoginView, LogoutView
from django.contrib.auth.decorators import login_required

urlpatterns = [
    path('', HomeView.as_view(), name="home-page"),
    path('about/', AboutView.as_view(), name="about-page"),
    path('admin/', admin.site.urls),
    path('contact/', ContactAdd.as_view(), name="contact-page"),
    path('posts/', PostList.as_view(), name='post-list'),
    path('posts/author/<username>/',
         PostListByAuthor.as_view(),
         name='post-author'),
    path('posts/<int:year>/<int:month>/<int:day>/<slug:slug>/',
         PostDetail.as_view(),
         name='post-detail'),
    path('posts/<int:year>/<int:month>/<int:day>/',
         PostListByDay.as_view(),
         name='post-detail'),
    path('posts/<int:year>/<int:month>/',
         PostListByMonth.as_view(),
         name='post-detail'),
    path('posts/<int:year>/', PostListByYear.as_view(), name='post-detail'),
    path('dj-admin/',
         login_required(Dashboard.as_view()),
Beispiel #11
0
from django.urls import path, include

from post.views import PostList, PostCreate, PostUpdate, PersonalPostList, CollectionPostList
from post.views import post_comment, post_saved, post_unsaved, post_like, post_dislike
from post.tag import TagList, TagPostList

urlpatterns = [
    path('', include([
        path('', PostList.as_view(), name='index'),
    ])),
    path(
        'post/',
        include([
            path('create/', PostCreate.as_view(), name='post_create'),
            path('update/<slug:slug>',
                 PostUpdate.as_view(),
                 name='post_update'),
            path('detail/<slug:slug>', post_comment, name='post_detail'),
            path('saved/<slug:slug>', post_saved, name='post_saved'),
            path('unsaved/<slug:slug>', post_unsaved, name='post_unsaved'),
            path('like/<slug:slug>', post_like, name='post_like'),
            path('dislike/<slug:slug>', post_dislike, name='post_dislike'),
            path('personal/',
                 PersonalPostList.as_view(),
                 name='personal_posts'),
            path('collections/',
                 CollectionPostList.as_view(),
                 name='collection_posts'),
        ])),
    path(
        'tag/',
Beispiel #12
0
"""djangostagram URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include

from post.views import PostCreate, PostList, post_detail

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', PostList.as_view(), name='timeline'),
    path('user/', include('dsuser.urls')),
    path('upload/', PostCreate.as_view(), name='upload'),
    path('post/<int:pk>/', post_detail, name='post'),
]
Beispiel #13
0
Examples:
Function views
    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 django.conf.urls import url, include, patterns
from django.contrib import admin
from django.contrib.auth.views import login, logout

import post
from gallery.views import GalleryList
from post.views import PostList

urlpatterns = [
    url(r'^admin/', admin.site.urls),

    url(r'^post/', include('post.urls', namespace="post")),
    url(r'^posts/$', PostList.as_view(), name="post_list"),
    url(r'^gallery/', include('gallery.urls', namespace="gallery")),
    url(r'^galleries/$', GalleryList.as_view(), name="gallery_list"),
    url(r'^login/', login, {'template_name': 'core/login.html'}, name="login"),
    url(r'^logout/', logout, {'template_name': 'core/logout.html'}, name="logout"),
    url(r'^search-form/', 'post.views.search_form'),

]