Skip to main content

Posts

Showing posts from March, 2022

What is extends in Django? How to create standard template design in Django

  It is used to provide the extendibility of parent template or base template to child template. If we want to create a master-child template in the Django application then we use extends operation in Django. Child pages inherit the complete functionality of the base template. Syntax of base template or master template <html> <head> </head> <body> <div id="container"> <header> </header> <section> {% block blockame %}     Content Place Holder   {% endblock %} </section> <footer> </footer> </div> </body> </html> Syntax of child page:- {% extends 'appname/parentpage.html' %} {% block blockname %}     hello {% endblock %} Now I am providing the code of the base.html or master.html file:- <!DOCTYPE html> <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="/static/style.css"> </head> <body...