Orange County Lettings uses Django’s template engine with six HTML templates stored in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/OpenClassrooms-Student-Center/Python-OC-Lettings-FR/llms.txt
Use this file to discover all available pages before exploring further.
/templates/ directory. All pages extend base.html, which provides the shared navbar, footer, and static file loading.
Template inheritance
Every page template starts with{% extends "base.html" %} and fills in two named blocks defined by the base layout:
{% block title %}— sets the<title>element in<head>.{% block content %}— renders the main page body between the navbar and footer.
base.html — Master layout
base.html is the root template from which all other templates inherit.
base.html:
- Loads static files with
{% load static %}and references local CSS and the site logo via{% static %}. - Includes Bootstrap 5.1.3 from CDN for layout and component styling.
- Includes the AOS (Animate On Scroll) library, initialised with
duration: 600andonce: true. - Navbar contains named-URL links to the Profiles and Lettings index pages.
- Footer displays the copyright notice: “Orange County Lettings 2023”.
- Defines
{% block title %}and{% block content %}for child templates to override.
index.html — Home page
- Extends
base.html. - Sets the page title to
"Holiday Homes". - Displays a
"Welcome to Holiday Homes"heading. - Renders two call-to-action buttons linking to the Profiles and Lettings index pages.
- Receives no context variables from the view —
views.indexcallsrender(request, 'index.html')with no context.
lettings_index.html — Lettings list
- Extends
base.html. - Renders the
lettings_listcontext variable — a queryset of allLettingobjects. - Iterates over the list; each item links to its detail page using
{% url 'letting' letting_id=letting.id %}. - Displays
"No lettings are available."when the queryset is empty.
letting.html — Letting detail
- Extends
base.html. - Uses the
titlecontext variable for both the<title>element and the page heading. - Uses the
addresscontext variable to display all address fields: number, street, city, state, zip code, and country ISO code.
profiles_index.html — Profiles list
- Extends
base.html. - Renders the
profiles_listcontext variable — a queryset of allProfileobjects. - Each item links to the profile detail page using
{% url 'profile' username=profile.user.username %}. - Displays
"No profiles are available."when the queryset is empty.
profile.html — Profile detail
- Extends
base.html. - Uses
{{ profile.user.username }}for both the page title and the heading. - Displays fields from both the
Profilemodel (favorite_city) and the related DjangoUsermodel (first_name,last_name,email).
Context variables: views to templates
Each view constructs acontext dictionary and passes it to render(). Template variables map directly to dictionary keys.
letting.html, {{ title }} resolves to letting.title and {{ address.number }} resolves to letting.address.number — Django’s template engine traverses attribute lookups automatically.
The table below summarises the context variables provided by each view:
| Template | View | Context variables |
|---|---|---|
index.html | views.index | (none) |
lettings_index.html | views.lettings_index | lettings_list — queryset of all Letting objects |
letting.html | views.letting | title — the letting’s title; address — the linked Address object |
profiles_index.html | views.profiles_index | profiles_list — queryset of all Profile objects |
profile.html | views.profile | profile — the matched Profile object (with related user) |