class Person():
def __init__(self, Newname, Newage, Newtype):
self. type = Newtype,self.name = Newname,self. age = Newage,
This is the wrong way to write, not on the same line!
# def __init__(self, Newname,Newage,Newtype):
# self.name = Newname,
# self. age = Newage,
# self. type = Newtype,
from django. http import HttpResponse
from django. template import Template ,Context
import datetime
from HelloDjango.Model. Person import *
def Hello(request , offset ):
tempStr = “{{person.name}} {{person. age}} {{person. type}}”
tempAnswer = {“person” : Person(“hjc”, “11”, “man”)}
#
# tempStr = “{{person.name}} {{person. age}} {{person. type}}”
# tempAnswer = {“person” : Person(‘hjc’ , ’11’ ,’man’)}
t = Template(tempStr)
c = Context(tempAnswer)
return HttpResponse(t.render(c))