Templates all in one

Ting
Dec 2, 2020

{% extends %}, {% block %} , {% endblock %}

  1. Create base.html
just put the common part of job_list.html, job_detail.html, jobs_with_type.html

2. Use base.html with { % block %}

job/job_detail.html: add

3. do this for rest three html files

4. Global templates directory:

creates ‘templates’ directory for global templates

/Users/ting/Desktop/dev/seuback/django_seu/SeuBackend/SeuBackend/settings.py-> TEMPLATES:

base root
add templates path
move base.html from job/templates -> global templates

5. if you hope to reuse app, then save app’s html file in app’s own templates directory; or you can move them all into global ‘templates’:

6. change the path of methods in job/views.py

job/….

--

--