diff --git a/django_forms/README.md b/django_forms/README.md index 1688d7f82a7..9d68485c9db 100644 --- a/django_forms/README.md +++ b/django_forms/README.md @@ -39,7 +39,7 @@ So once again we will create: a link to the page, a URL, a view and a template. ## Link to a page with the form -It's time to open `mysite/templates/mysite/base.html`. We will add a link in `div` named `page-header`: +It's time to open `blog/templates/blog/base.html`. We will add a link in `div` named `page-header`: @@ -123,7 +123,7 @@ We need to create a file `post_edit.html` in the `blog/templates/blog` directory Ok, so let's see how the HTML in `post_edit.html` should look: - {% extends 'mysite/base.html' %} + {% extends 'blog/base.html' %} {% block content %}

New post

@@ -232,7 +232,7 @@ Open `blog/post_detail.html` and add this line: so that the template will look like: - {% extends 'mysite/base.html' %} + {% extends 'blog/base.html' %} {% block content %}
diff --git a/django_models/README.md b/django_models/README.md index def5cb93016..2ad61c9ee11 100644 --- a/django_models/README.md +++ b/django_models/README.md @@ -79,7 +79,7 @@ You will notice that a new `blog` directory is created and it contains a number tests.py views.py -After creating an application we also need to tell Django that it should use it. We do that in the file `mysite/settings.py`. We need to find `INSTALLED_APPS` and add two lines: `'mysite',` and `'blog',` just above `)`. So the final product should look like this: +After creating an application we also need to tell Django that it should use it. We do that in the file `mysite/settings.py`. We need to find `INSTALLED_APPS` and add a line containing `'blog',` just above `)`. So the final product should look like this: INSTALLED_APPS = ( 'django.contrib.admin', @@ -88,7 +88,6 @@ After creating an application we also need to tell Django that it should use it. 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'mysite', 'blog', ) diff --git a/extend_your_application/README.md b/extend_your_application/README.md index e360aea25fc..d4e7868aebc 100644 --- a/extend_your_application/README.md +++ b/extend_your_application/README.md @@ -12,7 +12,7 @@ We already have a `Post` model, so we don't need to add anything to `models.py`. We will start with adding a link inside `blog/templates/blog/post_list.html` file. So far it should look like: - {% extends 'mysite/base.html' %} + {% extends 'blog/base.html' %} {% block content %} {% for post in posts %} @@ -121,7 +121,7 @@ We will create a file in `blog/templates/blog` called `post_detail.html`. It will look like this: - {% extends 'mysite/base.html' %} + {% extends 'blog/base.html' %} {% block content %}
diff --git a/template_extending/README.md b/template_extending/README.md index b8d6af4ee43..cf384f82d02 100644 --- a/template_extending/README.md +++ b/template_extending/README.md @@ -8,12 +8,13 @@ This way you don't have to repeat yourself in every file, when you want to use t A base template is the most basic template that you extend on every page of your website. -Create a `templates/mysite/base.html` file. You also need to create `templates` and `mysite` directories, but you probably have noticed this pattern already :) +Let's create a `base.html` file in `blog/templates/blog/`: - mysite + blog └───templates - └───mysite - └───base.html + └───blog + base.html + post_list.html Then open it up and copy everything from `post_list.html` to `base.html` file, like this: @@ -83,11 +84,11 @@ Now save it, and open your `blog/templates/blog/post_list.html` again. Delete ev And now add this line to the beginning of the file: - {% extends 'mysite/base.html' %} + {% extends 'blog/base.html' %} It means that we're now extending `base.html` template in `post_list.html`. Only one thing left: put everything (except the line we just added) between `{% block content %}` and `{% endblock content %}`. Like this: - {% extends 'mysite/base.html' %} + {% extends 'blog/base.html' %} {% block content %} {% for post in posts %} @@ -101,4 +102,4 @@ It means that we're now extending `base.html` template in `post_list.html`. Only That's it! Check if your website is still working properly :) -> If you have an error `TemplateDoesNotExists` that says that there is no `mysite/base.html` file and you have `runserver` running in the console, try to stop it (by pressing Ctrl+C - Control and C buttons together) and restart it by running a `python manage.py runserver` command. +> If you have an error `TemplateDoesNotExists` that says that there is no `blog/base.html` file and you have `runserver` running in the console, try to stop it (by pressing Ctrl+C - Control and C buttons together) and restart it by running a `python manage.py runserver` command.