So I was making this Django website and it does just what I want. But now I need to output the HTML code with indentation to an HTML page. I have used bs4
`s .prettify()
method but it only shows the indented code on the console. This is my views.py
main function
from django.shortcuts import render
import requests
from bs4 import BeautifulSoup as soup
from . forms import InForm
def main(request):
if request.method == 'POST':
form = InForm(request.POST)
if form.is_valid():
you = form.cleaned_data.get('you')
htm = requests.get(you)
dat = soup(htm.content, 'html.parser').prettify()
print(dat)
return render(request, 'main.html', {'dat':dat})
else:
form = InForm()
return render(request, 'main.html', {'form':form})
the output I get:
I`m using an android emulator for the project