Exemple #1
0
 def _post_response(self, user, review_slug, data):
     url = reverse('reviews:edit_review', kwargs={'slug': review_slug})
     request = self.factory.post(url, data)
     store = _create_session()
     request.session = store
     request.user = user
     messages = FallbackStorage(request)
     request._messages = messages
     view = ReviewUpdateView.as_view()
     return view(request, slug=review_slug)
Exemple #2
0
 def _post_response(self, user, review_slug, data):
     url = reverse('reviews:edit_review', kwargs={'slug': review_slug})
     request = self.factory.post(url, data)
     store = _create_session()
     request.session = store
     request.user = user
     messages = FallbackStorage(request)
     request._messages = messages
     view = ReviewUpdateView.as_view()
     return view(request, slug=review_slug)
Exemple #3
0
 def _get_response(self, user, review_slug):
     url = reverse('reviews:edit_review', kwargs={'slug': review_slug})
     request = self.factory.get(url)
     request.user = user
     view = ReviewUpdateView.as_view()
     return view(request, slug=review_slug)
Exemple #4
0
 def _get_response(self, user, review_slug):
     url = reverse('reviews:edit_review', kwargs={'slug': review_slug})
     request = self.factory.get(url)
     request.user = user
     view = ReviewUpdateView.as_view()
     return view(request, slug=review_slug)
Exemple #5
0
from django.urls import path

from reviews.views import ReviewListView, ReviewCreateView, \
    ReviewUpdateView, StaffReviewListView

app_name = 'reviews'

urlpatterns = [
    path('', ReviewListView.as_view(), name='reviews'),
    ##### VIEWS FOR LOGGED IN USER ONLY #####
    # add a review
    path('add/', ReviewCreateView.as_view(), name='add_review'),
    # edit review (allow users to edit their own reviews)
    path('<slug:slug>/edit/', ReviewUpdateView.as_view(), name='edit_review'),
    ##### VIEWS FOR STAFF USER ONLY #####
    # listview for all reviews, button to publish/reject
    path('staff-review/', StaffReviewListView.as_view(), name='staff_reviews')
]