J
J
Jekson2019-09-09 11:44:10
Django
Jekson, 2019-09-09 11:44:10

How to open html file in google docs?

There is a logic that generates the final document depending on the transferred file format (html, json, docx)

class CvView(AuthorizedMixin, View):
    """Employee CV view."""

    def get(self, request, employee_id, format_):
        """Returns employee's CV in format which is equal to `format_`
        parameter."""

        employee = get_object_or_404(Employee, pk=employee_id)
        user = request.user
        content_type, data = Cv(employee, format_, user).get()

        if isinstance(data, BytesIO):
            return FileResponse(
                data, as_attachment=True, filename=f'cv.{format_}',
                content_type=content_type)
        return HttpResponse(data, content_type=content_type)

I'm interested in the html format. variable data from
return HttpResponse(data, content_type=content_type)
contains the html code of the template that opens on a new browser page according to the url
path('cv/<int:employee_id>/<str:format_>/', CvView.as_view(), name='cv'),

Is it possible to redirect the opening of this file directly to a Google Document?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Keofaste, 2019-09-09
@Keofaste

Alternatively, create a Google Doc and redirect to it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question