Alex_Dublin
Alex_Dublin

Reputation: 11

What does "render" mean in Django?

What does it mean to "render a template" or to "render a form" in Django? Example 1: "Generally a view retrieves data according to the parameters, loads a template and renders the template with the retrieved data.

Example 2: "Rendering a form in a template involves nearly the same work as rendering any other kind of object"

Would the meaning of render in the above two examples be to "provide" or give"?

Upvotes: 0

Views: 1026

Answers (3)

AKX
AKX

Reputation: 168967

These etymologies given on Wiktionary stand:

(transitive) To interpret, give an interpretation or rendition of.

(transitive) To translate into another language.

(transitive, computer graphics) To transform (a model) into a display on the screen or other media.

That is, the code describing your form, or the template describing your page, is rendered into the final HTML form.

Upvotes: 2

maic0L
maic0L

Reputation: 45

Rendering a template is indeed always about producing content, but for a slightly wider description of content. It could be a chunk of html, for example an ajax call to get new items might produce some html describing the new items, but it doesn't have to be.

creds. Frederick Cheung

Upvotes: 1

404pio
404pio

Reputation: 1032

You are looking for generic term "templating": https://wiki.python.org/moin/Templating

TLDR; It's common practice to split View and Models. In this case View is templates, e.g. html file.

Upvotes: 0

Related Questions