 Challenge: Write your View
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 theSubmit Taskbutton to solve this task.
Swipe to start coding
Implement the index view:
- Define the htmlvariable that should contain Docstring.
- Docstring should represent the HTML code for page, where you need to:
- define the <body>tag with the CSS propertybackground-colorwith valuelightblue;
- write the first header (<h1>tag) with the contentDjango;
- define the second header (<h2>tag) with the contentPython in Web.
- define the paragraph (<p>) with thePython allows us to create web applications.content.
 
- define the 
- Return the HttpResponseobject by passing thehtmlvariable to this object.
Connect the index view to the urlpatterns:
- The URL endpoint should be named home.
- Pass the indexview to thepathfunction as the second argument.
- This URL pattern should be named home-pageusing thenamekeyword.
Once you've completed this task, click the button below the code to check your solution.
Løsning
Takk for tilbakemeldingene dine!
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Oppsummer dette kapittelet
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 3.45 Challenge: Write your View
Challenge: Write your View
Sveip for å vise menyen
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 theSubmit Taskbutton to solve this task.
Swipe to start coding
Implement the index view:
- Define the htmlvariable that should contain Docstring.
- Docstring should represent the HTML code for page, where you need to:
- define the <body>tag with the CSS propertybackground-colorwith valuelightblue;
- write the first header (<h1>tag) with the contentDjango;
- define the second header (<h2>tag) with the contentPython in Web.
- define the paragraph (<p>) with thePython allows us to create web applications.content.
 
- define the 
- Return the HttpResponseobject by passing thehtmlvariable to this object.
Connect the index view to the urlpatterns:
- The URL endpoint should be named home.
- Pass the indexview to thepathfunction as the second argument.
- This URL pattern should be named home-pageusing thenamekeyword.
Once you've completed this task, click the button below the code to check your solution.
Løsning
Takk for tilbakemeldingene dine!
single