def post(self, request, format=None):

        userid = request.user.id
        username = request.user.username
        create_value = request.data

        userdetail = {unicode('user'): unicode(userid),
                      unicode('created_by'): unicode(username)}
        create_value.update(userdetail)
        serializer = BucketlistSerializer(data=create_value)

        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
    def post(self, request, format=None):
        """
        Create a bucketlist for the current user
        ---
        parameters:
            - name: name
              description: name of bucketlist to be created
              required: true
              type: string
              paramType: form
        """

        serializer = BucketlistSerializer(data=request.data)
        if serializer.is_valid():
            serializer.save(created_by=self.request.user)
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
    def put(self, request, bucket_id, format=None):
        """
        Edit a single bucket of the authenticated user
         ---
        parameters:
            - name: name
              description: name of bucketlist to be edited
              required: true
              type: string
              paramType: form
        """
        bucketlist = self.get_bucket_object(bucket_id)
        serializer = BucketlistSerializer(bucketlist, request.data)

        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
    def put(self, request, pk, format=None):
        bucketlist = self.get_object(pk)

        userid = request.user.id
        username = request.user.username
        update_bucketist_value = request.data

        userdetail = {
            unicode('user'): unicode(userid),
            unicode('created_by'): unicode(username)
        }
        update_bucketist_value.update(userdetail)

        serializer = BucketlistSerializer(
            bucketlist,
            data=update_bucketist_value
        )
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)