How to show data in redirected html template from a function

I am trying to redirect to a custom html template on a form submission. On that redirected html template I want to show data from doctype, but when the template is redirected on a form submission I get error as:

my success.py is like:
import frappe
def get_context(context):
context.details = frappe.get_list(“Register”, fields=[“firstname”,“email”])

Please help.