Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Post List View | Templates
Django: First Dive
course content

Course Content

Django: First Dive

Post List View

Now, let's create the post_list.html file inside the template folder.

For now, the HTML file should be the following structure:

We implemented the post_list view function:

Note

The presented code for the task is part of the framework and cannot work separately, so errors will be received when you try to Run Code. Use the Submit Task button to solve this task.

Task

  1. Rewrite the post_list function using the render() function. The render function should:
    • Receive the request as the first argument.
    • Receive the post_list.html template name as the second argument.
    • Receive the context dictionary as the third argument.
  2. The context dictionary should contain the "post" key with the iterable QuerySet of posts.

Task

  1. Rewrite the post_list function using the render() function. The render function should:
    • Receive the request as the first argument.
    • Receive the post_list.html template name as the second argument.
    • Receive the context dictionary as the third argument.
  2. The context dictionary should contain the "post" key with the iterable QuerySet of posts.

Everything was clear?

Section 5. Chapter 3
toggle bottom row

Post List View

Now, let's create the post_list.html file inside the template folder.

For now, the HTML file should be the following structure:

We implemented the post_list view function:

Note

The presented code for the task is part of the framework and cannot work separately, so errors will be received when you try to Run Code. Use the Submit Task button to solve this task.

Task

  1. Rewrite the post_list function using the render() function. The render function should:
    • Receive the request as the first argument.
    • Receive the post_list.html template name as the second argument.
    • Receive the context dictionary as the third argument.
  2. The context dictionary should contain the "post" key with the iterable QuerySet of posts.

Task

  1. Rewrite the post_list function using the render() function. The render function should:
    • Receive the request as the first argument.
    • Receive the post_list.html template name as the second argument.
    • Receive the context dictionary as the third argument.
  2. The context dictionary should contain the "post" key with the iterable QuerySet of posts.

Everything was clear?

Section 5. Chapter 3
toggle bottom row

Post List View

Now, let's create the post_list.html file inside the template folder.

For now, the HTML file should be the following structure:

We implemented the post_list view function:

Note

The presented code for the task is part of the framework and cannot work separately, so errors will be received when you try to Run Code. Use the Submit Task button to solve this task.

Task

  1. Rewrite the post_list function using the render() function. The render function should:
    • Receive the request as the first argument.
    • Receive the post_list.html template name as the second argument.
    • Receive the context dictionary as the third argument.
  2. The context dictionary should contain the "post" key with the iterable QuerySet of posts.

Task

  1. Rewrite the post_list function using the render() function. The render function should:
    • Receive the request as the first argument.
    • Receive the post_list.html template name as the second argument.
    • Receive the context dictionary as the third argument.
  2. The context dictionary should contain the "post" key with the iterable QuerySet of posts.

Everything was clear?

Now, let's create the post_list.html file inside the template folder.

For now, the HTML file should be the following structure:

We implemented the post_list view function:

Note

The presented code for the task is part of the framework and cannot work separately, so errors will be received when you try to Run Code. Use the Submit Task button to solve this task.

Task

  1. Rewrite the post_list function using the render() function. The render function should:
    • Receive the request as the first argument.
    • Receive the post_list.html template name as the second argument.
    • Receive the context dictionary as the third argument.
  2. The context dictionary should contain the "post" key with the iterable QuerySet of posts.

Section 5. Chapter 3
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt