Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Django Render Example


view.py
def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")
def hello(request):
   return render(request, 'hello.html', {'name':'namenamenamenamename'})

#make sure to keep the templates in the templates folder(you need to make it)
#the name variable is below as you can see
templates/hello.html
<b>fdsfdsfldsjflkdsjkflksja;fdsfdsfldsjflkdsjkflksjasdfkldsjflkdsjfds</b>
{{name}}
<b>>fdlksjfdsljfldsjflkds</b>
Source by docs.djangoproject.com #
 
PREVIOUS NEXT
Tagged: #Django #Render #Example
ADD COMMENT
Topic
Name
4+5 =