Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Write your View | Write the First Page
Django: First Dive
course content

Зміст курсу

Django: First Dive

Django: First Dive

1. Get Started
2. Write the First Page
3. Models
4. Working with Database
5. Templates
6. Request Handling

Challenge: Write your View

Note

  • For convenience, let's make the first view in one file with URL addresses (urls.py).
  • 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.

Завдання

Implement the index view:

  1. Define the html variable that should contain Docstring.
  2. Docstring should represent the HTML code for page, where you need to:
    • define the <body> tag with the CSS property background-color with value lightblue;
    • write the first header (<h1> tag) with the content Django;
    • define the second header (<h2> tag) with the content Python in Web.
    • define the paragraph (<p>) with the Python allows us to create web applications. content.
  3. Return the HttpResponse object by passing the html variable to this object.

Connect the index view to the urlpatterns:

  1. The URL endpoint should be named home.
  2. Pass the index view to the path function as the second argument.
  3. This URL pattern should be named home-page using the name keyword.

Once you've completed this task, click the button below the code to check your solution.

Завдання

Implement the index view:

  1. Define the html variable that should contain Docstring.
  2. Docstring should represent the HTML code for page, where you need to:
    • define the <body> tag with the CSS property background-color with value lightblue;
    • write the first header (<h1> tag) with the content Django;
    • define the second header (<h2> tag) with the content Python in Web.
    • define the paragraph (<p>) with the Python allows us to create web applications. content.
  3. Return the HttpResponse object by passing the html variable to this object.

Connect the index view to the urlpatterns:

  1. The URL endpoint should be named home.
  2. Pass the index view to the path function as the second argument.
  3. This URL pattern should be named home-page using the name keyword.

Once you've completed this task, click the button below the code to check your solution.

Все було зрозуміло?

Секція 2. Розділ 4
toggle bottom row

Challenge: Write your View

Note

  • For convenience, let's make the first view in one file with URL addresses (urls.py).
  • 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.

Завдання

Implement the index view:

  1. Define the html variable that should contain Docstring.
  2. Docstring should represent the HTML code for page, where you need to:
    • define the <body> tag with the CSS property background-color with value lightblue;
    • write the first header (<h1> tag) with the content Django;
    • define the second header (<h2> tag) with the content Python in Web.
    • define the paragraph (<p>) with the Python allows us to create web applications. content.
  3. Return the HttpResponse object by passing the html variable to this object.

Connect the index view to the urlpatterns:

  1. The URL endpoint should be named home.
  2. Pass the index view to the path function as the second argument.
  3. This URL pattern should be named home-page using the name keyword.

Once you've completed this task, click the button below the code to check your solution.

Завдання

Implement the index view:

  1. Define the html variable that should contain Docstring.
  2. Docstring should represent the HTML code for page, where you need to:
    • define the <body> tag with the CSS property background-color with value lightblue;
    • write the first header (<h1> tag) with the content Django;
    • define the second header (<h2> tag) with the content Python in Web.
    • define the paragraph (<p>) with the Python allows us to create web applications. content.
  3. Return the HttpResponse object by passing the html variable to this object.

Connect the index view to the urlpatterns:

  1. The URL endpoint should be named home.
  2. Pass the index view to the path function as the second argument.
  3. This URL pattern should be named home-page using the name keyword.

Once you've completed this task, click the button below the code to check your solution.

Все було зрозуміло?

Секція 2. Розділ 4
toggle bottom row

Challenge: Write your View

Note

  • For convenience, let's make the first view in one file with URL addresses (urls.py).
  • 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.

Завдання

Implement the index view:

  1. Define the html variable that should contain Docstring.
  2. Docstring should represent the HTML code for page, where you need to:
    • define the <body> tag with the CSS property background-color with value lightblue;
    • write the first header (<h1> tag) with the content Django;
    • define the second header (<h2> tag) with the content Python in Web.
    • define the paragraph (<p>) with the Python allows us to create web applications. content.
  3. Return the HttpResponse object by passing the html variable to this object.

Connect the index view to the urlpatterns:

  1. The URL endpoint should be named home.
  2. Pass the index view to the path function as the second argument.
  3. This URL pattern should be named home-page using the name keyword.

Once you've completed this task, click the button below the code to check your solution.

Завдання

Implement the index view:

  1. Define the html variable that should contain Docstring.
  2. Docstring should represent the HTML code for page, where you need to:
    • define the <body> tag with the CSS property background-color with value lightblue;
    • write the first header (<h1> tag) with the content Django;
    • define the second header (<h2> tag) with the content Python in Web.
    • define the paragraph (<p>) with the Python allows us to create web applications. content.
  3. Return the HttpResponse object by passing the html variable to this object.

Connect the index view to the urlpatterns:

  1. The URL endpoint should be named home.
  2. Pass the index view to the path function as the second argument.
  3. This URL pattern should be named home-page using the name keyword.

Once you've completed this task, click the button below the code to check your solution.

Все було зрозуміло?

Note

  • For convenience, let's make the first view in one file with URL addresses (urls.py).
  • 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.

Завдання

Implement the index view:

  1. Define the html variable that should contain Docstring.
  2. Docstring should represent the HTML code for page, where you need to:
    • define the <body> tag with the CSS property background-color with value lightblue;
    • write the first header (<h1> tag) with the content Django;
    • define the second header (<h2> tag) with the content Python in Web.
    • define the paragraph (<p>) with the Python allows us to create web applications. content.
  3. Return the HttpResponse object by passing the html variable to this object.

Connect the index view to the urlpatterns:

  1. The URL endpoint should be named home.
  2. Pass the index view to the path function as the second argument.
  3. This URL pattern should be named home-page using the name keyword.

Once you've completed this task, click the button below the code to check your solution.

Секція 2. Розділ 4
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt