How can I have a same view for all pages/template

Hello

I am starting with Django and I understand I can apply a view with a template and target a link to a view.

If I have a simple web site with 5 pages, I could create a view for each page.
Actually I have a base.html template and my 5 pages have a view whoch import the base.html template
I have an application which use weather station in several fields. All of this devises are save into a database. Then I can extract the information of the fields.

I would like to know, how can I create a view, which queries the fields from my MySQL database and show the result in all pages, as a menu?

Is there a dedicated view which can be applied to all templates, as I could do for a menu?

Thanks

A url is defined to be mapped to a view.

A view receives the request to that URL and returns a response.

How that view determines what that response should look like is entirely up to you.

Is there a “dedicated view” for this? Yes, you can build this by extending TemplateView or DetailView.

You have to add to the context of your view the results of the queryset . If you will use it in all the views of the site you should use a context processo