#5 Django tutorials Django Template Language DTL

Channel Avatar
Comment
X
Share
#5 Django tutorials Django Template Language DTL
#5 Django tutorials Django Template Language DTL
In this lecture we are discussing about:
#1 DTL (Django Template Language)
a) use of DTL in Django
b) use dynamic content in Django
#2 use of Jinja template example in Django.

— in views.py you can use html tag inside HttpResponse
def home(request):
— it work fine to use tag inside HttpResponse
— but if you want a big page then you need to create a template
— and this has a dynamic page

#1 DTL (Django Template Language)
we have concept of DTL (Django Template Language)
— other option in django is jinja template
–generally you created the app outside the app
— and then you can use it in your project
— you can create a folder with name templates outside the app folder

Now in templates folder you can create a html file
— home.html

Now you go to telusko folder inside change the settings.py
— in templates
— in DIRS change the path [os.path.join(BASE_DIR,’templates’)],
— now you can use the template in your views.py

a) Now you need to change the views.py
— from django.shortcuts import render
— from django.http import HttpResponse
— def home(request):
— return render(request,’home.html’)

b) now you get dynamic content
— now you want to pass some dynamic value from views.py
inside this home function add JSON data
— def home(request):
— return render(request,’home.html'{‘name’,’Navin’})

— go to templates and next to home.html
— changing content in json file will change the content in html file

#2 use of Jinja template example in Django.
— this curly braces {{name}} simply means jinja templates or pattern
— we can do operation in jinja templates
— you can use jinja templates instead of DTL
— but DTL is by default in django

Python Tutorials for beginner : https://bit.ly/2qfhUCp
Django Tutorials : https://www.youtube.com/watch?vSIyxjRJ8VNY&listPLsyeobzWxl7r2ukVgTqIQcl-1T0C2mzau

Django is a high-level Python-based free and open-source web framework, which follows the model-view-template (MVT) architectural pattern.
It is maintained by the Django Software Foundation (DSF).
Django’s primary goal is to ease the creation of complex, database-driven websites.
Some well-known sites that use Django include the Public Broadcasting Service, Instagram, Mozilla, The Washington Times, Disqus, Bitbucket, and Nextdoor.

In this video we will see:
Django Tempalte Language
Including HTML tags in a program
Create Django Template to create dynamic webpage
Editing settings.py file

Github :- https://github.com/navinreddy20/Python-

Editing Machines & Monitors :
https://amzn.to/2HA6ra8
https://amzn.to/2VMBBPw
https://amzn.to/2RfKWgL
https://amzn.to/2Q665JW
https://amzn.to/2OUP21a.

Check out our website: www.telusko.com
courses.telusko.com

Instagram : https://www.instagram.com/navinreddy20
Twitter : https://twitter.com/navinreddy20
Facebook:
Telusko : https://www.facebook.com/teluskolearn…
Navin Reddy : https://www.facebook.com/navintelusko

Subscribe to our other channel:
Navin Reddy : https://www.youtube.com/channel/UCxmkk8bMSOF-UBF43z-pdGQ
Telusko Hindi : https://www.youtube.com/channel/UCitzw4ROeTVGRRLnCPws-cw

Donation & Support:
Indian Payment : https://www.instamojo.com/@NavinReddy/
PayPal Id : navinreddy20
Patreon : navinreddy20

Take the opportunity to connect and share this video with your friends and family if you find it useful.

Keywords: telusko, navin, reddy, tutorial, java, python, django, template, language, dynamic, webpage, dtl, html

Read Also

Leave a Reply

Your email address will not be published. Required fields are marked *