vvv Typo: read "context" instead of "content" vvv
On Monday, November 12, 2018 at 5:26:48 AM UTC-8, Cuneyt Mertayak wrote:
>
> The content for the `render` method is supposed to be a dictionary:
> https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#optional-
The content for the `render` method is supposed to be a
dictionary:
https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#optional-arguments
So change it to this render(requset, "FrounterWeb/body.html",{'tank': tank})
Also in the template file you want to display the properties of the OR
It is going to be like following.
In HTML (doesn't have to be div of course any HTML tag can get data
attribute:
...
Then in JS:
var dataElement = document.getElementById('backend-to-js-name');
var name = dataElement.dataset.name;
console.log(name);
Check it out "data" attributes
here:
https:
As you can guess this is general problem for all backend languages for
passing data to JS.
AFAIK the standard practice is attaching the value to a DOM element as
"data" property and using fetching the value from that element in your JS.
If it is a primitive value it is easy to do so, if it is
It will be a bit generic help: To understand what's going wrong with your
code when you expect other type of behavior you can use debugging tools
like: pdb or (if you use an IDE like pycharm) build-in IDE debugger
(https://www.jetbrains.com/help/pycharm/debugging-django-templates.html,
https://
5 matches
Mail list logo