from rest_framework import generics
from rest_framework import permissions

from dry_rest_permissions.generics import DRYPermissions

from .permissions import CanCreateReview, CanUpdateReview
from .models import Review
from .serializers import ReviewSerializer


class Review(generics.CreateAPIView):
  model = Review
  serializer_class = ReviewSerializer
  permission_classes = (CanCreateReview, DRYPermissions)

  # override
  def create(self, request, *args, **kwargs):
  	# force the user id (since one could spoof the POST body)
  	request.data.__setitem__('author', request.user.id)
  	
  	print(request.data)
  	return super(Review, self).create(request, *args, **kwargs)

class ReviewDetail(generics.RetrieveUpdateDestroyAPIView):
    model = Review
    serializer_class = ReviewSerializer
    permission_classes = [
        CanUpdateReview
    ]
ad1e1c651bd964c0cf6baf787e847092bc310350
<mask token>


class ReviewDetail(generics.RetrieveUpdateDestroyAPIView):
    model = Review
    serializer_class = ReviewSerializer
    permission_classes = [CanUpdateReview]

<mask token>


class Review(generics.CreateAPIView):
    <mask token>
    <mask token>
    <mask token>

    def create(self, request, *args, **kwargs):
        request.data.__setitem__('author', request.user.id)
        print(request.data)
        return super(Review, self).create(request, *args, **kwargs)


class ReviewDetail(generics.RetrieveUpdateDestroyAPIView):
    model = Review
    serializer_class = ReviewSerializer
    permission_classes = [CanUpdateReview]

<mask token>


class Review(generics.CreateAPIView):
    model = Review
    serializer_class = ReviewSerializer
    permission_classes = CanCreateReview, DRYPermissions

    def create(self, request, *args, **kwargs):
        request.data.__setitem__('author', request.user.id)
        print(request.data)
        return super(Review, self).create(request, *args, **kwargs)


class ReviewDetail(generics.RetrieveUpdateDestroyAPIView):
    model = Review
    serializer_class = ReviewSerializer
    permission_classes = [CanUpdateReview]

from rest_framework import generics
from rest_framework import permissions
from dry_rest_permissions.generics import DRYPermissions
from .permissions import CanCreateReview, CanUpdateReview
from .models import Review
from .serializers import ReviewSerializer


class Review(generics.CreateAPIView):
    model = Review
    serializer_class = ReviewSerializer
    permission_classes = CanCreateReview, DRYPermissions

    def create(self, request, *args, **kwargs):
        request.data.__setitem__('author', request.user.id)
        print(request.data)
        return super(Review, self).create(request, *args, **kwargs)


class ReviewDetail(generics.RetrieveUpdateDestroyAPIView):
    model = Review
    serializer_class = ReviewSerializer
    permission_classes = [CanUpdateReview]

from rest_framework import generics
from rest_framework import permissions

from dry_rest_permissions.generics import DRYPermissions

from .permissions import CanCreateReview, CanUpdateReview
from .models import Review
from .serializers import ReviewSerializer


class Review(generics.CreateAPIView):
  model = Review
  serializer_class = ReviewSerializer
  permission_classes = (CanCreateReview, DRYPermissions)

  # override
  def create(self, request, *args, **kwargs):
  	# force the user id (since one could spoof the POST body)
  	request.data.__setitem__('author', request.user.id)
  	
  	print(request.data)
  	return super(Review, self).create(request, *args, **kwargs)

class ReviewDetail(generics.RetrieveUpdateDestroyAPIView):
    model = Review
    serializer_class = ReviewSerializer
    permission_classes = [
        CanUpdateReview
    ]