Пример #1
0
 def _post_response(self, user, category_id, data):
     url = reverse('gallery:edit_category', args=[category_id])
     request = self.factory.post(url, data, follow=True)
     store = _create_session()
     request.session = store
     request.user = user
     messages = FallbackStorage(request)
     request._messages = messages
     view = CategoryUpdateView.as_view()
     return view(request, pk=category_id)
Пример #2
0
 def _post_response(self, user, category_id, data):
     url = reverse('gallery:edit_category', args=[category_id])
     request = self.factory.post(url, data, follow=True)
     store = _create_session()
     request.session = store
     request.user = user
     messages = FallbackStorage(request)
     request._messages = messages
     view = CategoryUpdateView.as_view()
     return view(request, pk=category_id)
Пример #3
0
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"))
Пример #4
0
 def _get_response(self, user, category_id):
     url = reverse('gallery:edit_category', args=[category_id])
     request = self.factory.get(url)
     request.user = user
     view = CategoryUpdateView.as_view()
     return view(request, pk=category_id)
Пример #5
0
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'))
Пример #6
0
 def _get_response(self, user, category_id):
     url = reverse('gallery:edit_category', args=[category_id])
     request = self.factory.get(url)
     request.user = user
     view = CategoryUpdateView.as_view()
     return view(request, pk=category_id)