コード例 #1
0
 def _get_request_and_view(self, rf):
     request = rf.get("/")
     request.user = UserFactory()
     view = ContentCreateView(request=request)
     return request, view
コード例 #2
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"),
]
コード例 #3
0
ファイル: urls.py プロジェクト: reevadere-codes/socialhome
    # User management
    url(r"", include("socialhome.users.urls", namespace="users")),
    url(r"^accounts/", include("allauth.urls")),

    # Markdownx
    # Use our own upload view based on the MarkdownX view
    url(r"^markdownx/upload/$",
        MarkdownXImageUploadView.as_view(),
        name="markdownx_upload"),
    url(r"^markdownx/", include("markdownx.urls")),

    # Content
    url(r"^content/", include("socialhome.content.urls", namespace="content")),
    # Fallback for bookmarklet route for cross-project support
    url(r"^bookmarklet/", ContentCreateView.as_view(), name="bookmarklet"),

    # JavaScript translations
    path("jsi18n/",
         JavaScriptCatalog.as_view(packages=['socialhome']),
         name="javascript-catalog"),

    # Django URLs in JS
    url(r"^jsreverse/$", urls_js, name="js_reverse"),

    # Admin pages
    url(settings.ADMIN_URL, admin.site.urls),
    url(r"^django-rq/", include("django_rq.urls")),

    # API
    url(r'^swagger(?P<format>\.json|\.yaml)$',