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))
Read More:
- [Solved] PyInstaller Error: ValueError: too many values to unpack
- ValueError: Found array with dim 4. Estimator expected and ValueError: Expected 2D array, got 1D array i
- How to Solve Python Xlwt ValueError: More than 4094 XFs (styles)
- [Solved] ValueError: only one element tensors can be converted to Python scalars
- [Solved] ValueError: Error when checking input: expected conv2d_input to have 4 dimensions
- Python RarFile unpack RAR package Error Rarfile.RarCannotExec: Cannot find Working Tool
- Python Valueerror: cannot index with vector containing Na / Nan values
- Python ValueError: only 2 non-keyword arguments accepted
- [resolution] str.contains() problem] valueerror: cannot index with vector containing Na/Nan values
- Pandas Error: ValueError: setting an array element with a sequence.
- Python 3.X error: valueerror: data type must provide an itemsize
- Pytorch ValueError: Expected more than 1 value per channel when training, got input size [1, 768
- [Solved] ValueError: check_hostname requires server_hostname
- [Solved] ValueError: row index was 65536, not allowed by .xls format
- [Solved] ValueError: Connection error, and we cannot find the requested files in the cached path…
- Plt.acorr() Function Error: ValueError: object too deep for desired array
- Python errors: valueerror: if using all scalar values, you must pass an index (four solutions)
- Python Error: ValueError: invalid literal for int() with base 16: ‘ ‘
- [Solved] python Error: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.
- [Solved] Pandas rename Error: ValueError: operands could not be broadcast together with shapes (1,2) (3,) (1,2)