Exemplo n.º 1
0
 def _get_request_view_and_content(self, rf):
     request = rf.get("/")
     request.user = UserFactory()
     content = ContentFactory(author=request.user.profile)
     view = ContentDeleteView(request=request, kwargs={"pk": content.id})
     view.object = content
     return request, view, content
Exemplo n.º 2
0
 def _get_request_view_and_content(self, rf, next=False):
     if next:
         request = rf.get("/?next=/foobar")
     else:
         request = rf.get("/")
     request.user = UserFactory()
     content = ContentFactory(author=request.user.profile)
     view = ContentDeleteView(request=request, kwargs={"pk": content.id})
     view.object = content
     return request, view, content
Exemplo n.º 3
0
from django.conf.urls import url

from socialhome.content.views import ContentCreateView, ContentUpdateView, ContentDeleteView, ContentView

urlpatterns = [
    url(r"^create/$", ContentCreateView.as_view(), name="create"),
    url(r"^(?P<pk>[0-9]+)/~edit/$", ContentUpdateView.as_view(),
        name="update"),
    url(r"^(?P<pk>[0-9]+)/~delete/$",
        ContentDeleteView.as_view(),
        name="delete"),

    # Content detail works with three different versions
    # /content/123/  # pk
    # /content/123/slug/  # pk + slug
    # /content/abcd-edfg-ffff-aaaa/  # guid
    url(r"^(?P<pk>[0-9]+)/$", ContentView.as_view(), name="view"),
    url(r"^(?P<pk>[0-9]+)/(?P<slug>[-\w]+)/$",
        ContentView.as_view(),
        name="view-by-slug"),
    url(r"^(?P<guid>[^/]+)/$", ContentView.as_view(), name="view-by-guid"),
]
Exemplo n.º 4
0
from django.conf.urls import url

from socialhome.content.views import ContentCreateView, ContentUpdateView, ContentDeleteView

urlpatterns = [
    url(r"^create/$", ContentCreateView.as_view(), name="create"),
    url(r"^edit/(?P<pk>[0-9]+)$", ContentUpdateView.as_view(), name="update"),
    url(r"^delete/(?P<pk>[0-9]+)$", ContentDeleteView.as_view(),
        name="delete"),
]