Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (19.9k points)

Is that possible to see extended dynamic content((link.nameOne,link.nameTwo)) from home.html page on next.html page on By using following code:

home.html

<!doctype html>

<html lang="en">

<head>

</head>

<body>

  <header>

      <ul>

          {% for link in links.all %}

          <li>

            <a href="{{ link.nameOne }}">{{ link.nameTwo }}</a>

          </li>

          {% endfor %}

      </ul>

  </header>

  {% block content %} 

  {% endblock %}

  <footer>

  </footer>

  </html>

nextPage.html

{% extends 'home.html' %}

{% block content %}

  Hello world!

{% endblock %}

1 Answer

0 votes
by (25.1k points)

Yes, it's possible but you have to send context info to the template with same names.

see an example below

def some_view(request):

    context = {'links': links_queryset}

    return render(request, 'nextPage.html', context)

Browse Categories

...