class XSSDemoView(View): def get(self, request): # WARNING: This code is insecure and prone to XSS attacks # *** Do not use it!!! *** if 'q' in request.GET: return HttpResponse("Searched for: {}".format( request.GET['q'])) else: return HttpResponse("""<form method="get"> <input type="text" name="q" placeholder="Search" value=""> <button type="submit">Go</button> </form>""") The preceding code is a View class that shows a search form when accessed without any GET parameters. If the
...more