def _post_response(self, user, data): url = reverse('gallery:categories') request = self.factory.post(url, data) store = _create_session() request.session = store request.user = user messages = FallbackStorage(request) request._messages = messages view = CategoryListView.as_view() return view(request)
from django.conf import settings from django.conf.urls import url from gallery.views import category_detail_view, CategoryListView, CategoryUpdateView, gallery_menu_view, view_gallery urlpatterns = [ url(r"^$", gallery_menu_view, name="gallery"), url(r"^album/(?P<slug>[\w-]+)$", category_detail_view, name="category"), ##### VIEWS FOR STAFF USER ONLY ##### # Category list view, show all categories in list, allow for edit of # name and delete of entire category, add new category, links to category # detail views url(r"^albums/$", CategoryListView.as_view(), name="categories"), # Category detail view, show all images for edit/delete/add url(r"^albums/(?P<pk>\d+)$", CategoryUpdateView.as_view(), name="edit_category"), ] if settings.TESTING: urlpatterns.append(url(r"^alternative_view$", view_gallery, name="alternative"))
from django.conf.urls import url from gallery.views import CategoryListView, ImageListView urlpatterns = [ url(r'^categories/$', CategoryListView.as_view(), name='gallery_categories'), url(r'^images/(?P<category>[^/]*)$', ImageListView.as_view(), name='gallery_imgaes'), url(r'^images/$', ImageListView.as_view(), name='gallery_imgaes'), ]
def _get_response(self, user): url = reverse('gallery:categories') request = self.factory.get(url) request.user = user view = CategoryListView.as_view() return view(request)
from django.conf import settings from django.urls import path from gallery.views import category_detail_view, CategoryListView, \ CategoryUpdateView, gallery_menu_view, view_gallery, gallery_website_view app_name = 'gallery' urlpatterns = [ # path('', gallery_menu_view, name='gallery'), path('', gallery_website_view, name='gallery'), path('album/<slug:slug>/', category_detail_view, name='category'), ##### VIEWS FOR STAFF USER ONLY ##### # Category list view, show all categories in list, allow for edit of # name and delete of entire category, add new category, links to category # detail views path('albums/', CategoryListView.as_view(), name='categories'), # Category detail view, show all images for edit/delete/add path('albums/<int:pk>/', CategoryUpdateView.as_view(), name='edit_category') ] if settings.TESTING: urlpatterns.append( path('alternative_view/', view_gallery, name='alternative'))
from django.conf.urls import url from gallery.views import GalleryView, MotionView, CategoryListView, ImageListView urlpatterns = [ url(r'^categories/$', CategoryListView.as_view(), name='gallery_categories'), url(r'^images/$', ImageListView.as_view(), name='gallery_imgaes'), url(r'^cn/$', GalleryView.as_view(template_name='gallery_cn.html'), name='gallery_view'), url(r'^cn/motion/$', MotionView.as_view(template_name='motion_cn.html'), name='gallery_view'), url(r'^cn/(?P<category>[\w ]+)/$', GalleryView.as_view(template_name='gallery_cn.html'), name='gallery_view'), url(r'^$', GalleryView.as_view(), name='gallery_view'), url(r'^motion/$', MotionView.as_view(), name='motion_view'), url(r'^(?P<category>[\w ]+)/$', GalleryView.as_view(), name='gallery_view') ]