'Handle creation. This is directly called by the @action on AppViewSet,
allowing the URL to depend on the app id. AppViewSet passes this method
a Webapp instance in kwargs[\'app\'] (optionally raising a 404 if the
app in the URL doesn\'t exist, or a 403 if the app belongs to someone
else).
Note: this method is called \'_create\' and not \'create\' because DRF
would automatically make an \'app-preview-list\' url name if this
method was called \'create\', which we don\'t want - the app-preview-list
url name needs to be generated by AppViewSet\'s @action to include the
app pk.'

def _create(self, request, *args, **kwargs):

    app = kwargs['app']
    data_form = PreviewJSONForm(request.data)
    if (not data_form.is_valid()):
        return Response(data_form.errors, status=HTTP_400_BAD_REQUEST)
    form = PreviewForm(data_form.cleaned_data)
    if (not form.is_valid()):
        return Response(data_form.errors, status=HTTP_400_BAD_REQUEST)
    form.save(app)
    log.info(('Preview    created:    %s' % form.instance))
    serializer = self.get_serializer(form.instance)
    return Response(serializer.data, status=HTTP_201_CREATED)
