Saturday, November 19, 2022

Re: Template inheritance not working

Hi

On Sat, Nov 19, 2022 at 5:53 PM Chukwudi Onwusa <chukswest72@gmail.com> wrote:
On WhatsApp 

On Sat, Nov 19, 2022, 17:14 Alec Delaney <96alecpatrick@gmail.com> wrote:
Hello, would you be available for zoom?


On Fri, Nov 18, 2022 at 10:04 PM Chukwudi Onwusa <chukswest72@gmail.com> wrote:
What error is it showing you?
Please send a picture of it. Remember you can save your base with your desired name, but you should also not that you should register your templates directory in settings template list as [BASE_DIRS/ "templates"] and Incase your template files are in an embedded directory inside your templates directory, kindly do well to correct it as "embeddedDirectory/baseName.html" and also correct your views for other templates references too if need be.
Thanks.
Best Regards.

On Fri, Nov 18, 2022, 22:01 David Emanuel Sandoval <davidemanuelsandoval@gmail.com> wrote:
The base template contains the default content, and blocks with default contents in it. Then, in the child template, you can override those blocks.

El vie, 18 nov 2022 17:54, Alec Delaney <96alecpatrick@gmail.com> escribió:
Hello. How are you? Can I see another example of template inheritance?

On Mon, Oct 31, 2022 at 2:34 PM Ammar Mohammed <amarben1000@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+unsubscribe@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.


On Mon, 31 Oct 2022, 8:09 PM Alec Delaney, <96alecpatrick@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+unsubscribe@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.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHs1H7sS6tndz4j8wiK_Dfpwqnb7sUcrc814Zp3eTndDJ%2B5Ewg%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFGN%3DGitQmZVFG_v1kKOk5s5r53NYCYKEGFZ1Pdi%2Bm%2BiMAFRig%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHUWMCY_ftGaikC3Sie91CZmdm4Rbs%3DfQrHDPftGqju-PmxPCA%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGoV8n%3DZo6xUDv4EYLeO9kkpFy91d%2Bub9TE-ednCqhor85Z2sg%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFGN%3DGiZkBLP7utDr4KzU1dOcMHchYQpBSoe4zeQFj2CE2PNNg%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGoV8nm1hidB9i_wS36fw%2BYjqHVK0AS3w2CU0xDZ-Pu_HCSCJA%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJnMy6fwmaQ3ydj%2BaP%2Bx4ZfC9Yiy1vfjnCENcbrGgroK1gLLXA%40mail.gmail.com.

No comments:

Post a Comment