Your template inheritance cannot be index.html make it base.html and put whatever you want to be display in all pages on it then extends it in index page and other page
On Wed, Nov 2, 2022 at 10:26 AM FLAVIEN HERI <flavien.h...@gmail.com> wrote: > can it be the problem of the first block content which is empty.in > index.html, try to delete the empty block content, leave the second > one and see what happen > > On 10/31/22, Ammar Mohammed <amarben1...@gmail.com> wrote: > > Hello dear > > There is a little mistake in your code : > > You should put the {%block block_name %} in your base template with no > code > > and the put the code you want to be displayed in your child template file > > Here is an example : > > > > // file.html : > > > > {% extends "index.html" %} > > > > {% block content %} > > <h1>Hello, this is a test.</h1> > > <p>Help me.</p> > > {% endblock %} > > > > //index.html: > > <html lang="en"> > > <head> > > <meta charset="UTF-8"> > > <meta http-equiv="X-UA-Compatible" content="IE=edge"> > > <meta name="viewport" content="width=device-width, > initial-scale=1.0"> > > <title>Document</title> > > </head> > > <body> > > {% block content %} > > > > {% endblock %} > > </body> > > </html> > > > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to django-users+unsubscr...@googlegroups.com. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com > > < > https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer > > > > . > > > > > > On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatr...@gmail.com> > wrote: > > > >> I have been trying to get my templates to work but they have been > >> ineffective. here is my code: > >> {% extends "index.html" %} > >> > >> <html lang="en"> > >> <head> > >> <meta charset="UTF-8"> > >> <meta http-equiv="X-UA-Compatible" content="IE=edge"> > >> <meta name="viewport" content="width=device-width, > >> initial-scale=1.0"> > >> <title>Document</title> > >> </head> > >> <body> > >> <div> > >> {% block content %} > >> > >> > >> {% endblock %} > >> </div> > >> </body> > >> </html> > >> > >> //index.html: > >> > >> <html lang="en"> > >> <head> > >> <meta charset="UTF-8"> > >> <meta http-equiv="X-UA-Compatible" content="IE=edge"> > >> <meta name="viewport" content="width=device-width, > >> initial-scale=1.0"> > >> <title>Document</title> > >> </head> > >> <body> > >> {% block content %} > >> <h1>Hello, this is a test.</h1> > >> <p>Help me.</p> > >> {% endblock %} > >> </body> > >> </html> > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Django users" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to django-users+unsubscr...@googlegroups.com. > >> To view this discussion on the web visit > >> > https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com > >> < > https://groups.google.com/d/msgid/django-users/CAFGN%3DGjpkAW6NBXLZ%3DYL7eXy3FXmJ6DqWfNMh%2BikMrp7om361Q%40mail.gmail.com?utm_medium=email&utm_source=footer > > > >> . > >> > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to django-users+unsubscr...@googlegroups.com. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/django-users/CAHs1H7sS6tndz4j8wiK_Dfpwqnb7sUcrc814Zp3eTndDJ%2B5Ewg%40mail.gmail.com > . > > > > > -- > FLAVIEN HERI > > *Information management AscociateUNHCR-Kinshasa* > Tél:+243978587009 > Skype: flavien.heri1 > Facebook: flavien semi > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAG3GEnzUyDRz-a2BmmuV%3DgatN-3UY7SmxO36yryaZFybVqc7Tg%40mail.gmail.com > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJBAA1KVYP16RYzo1sQmbAkSnSgvwiYSj_%3Dn3oZiywQYJWU5eg%40mail.gmail.com.