Hi there, I’m very new to Django, and following through Django for beginners.
What is confusing me currently is the template system, and how to link classes to urls.
I think it would clear up if I could see some code where there is a simple one page website with different sections filled in by different classes, i.e. header, content, and footer.
For example, one thing I can’t get my head around is how to stick into the header some information from a class…for example, a title, which is not linked to a model.
Like I say, newbie here.
Does anybody have any links I could visit?
Templates are rendered using a
context. Whatever data you put into the
context is available to the template. The
context is built in your
view. So, your view accesses whatever data it wants rendered in the page, puts it into the
context, and then renders the template.
Yes, most of the examples you see generally demonstrate rendering a template with one object. Adding more data to the context doesn’t change anything else.
Thanks for the reply, let me digest that…I’ll check that nugget out
Every example I’m working through currently has its own page (which I kind of understand)…but I might be missing something subtle, and maybe need to go over the examples more.