Reputation: 46979
In my views i have pointed my code to login.html >But the alert in the ready function or the content so f the body are not seen on the UI.What am i doing wrong here
{% extends "base/base.html" %}
<script>
$(document).ready(function() {
alert('1');
});
</script>
some code here
some code here
some code here
some code here
some code here
some code here
<b>{{response_dict.yes}} testing and testing and testinf</b>
<b>{{a}}</b>
<form action="/logon/" method="post" name="myform">
{% csrf_token %}
<b>Username</b><input type="text" name="username" id="username"></input>
<br><b>Password</b><input type="password" name="password" id="password"></input>
<b></b><input type="submit" value="Submit"></input>
<img src="/media/img/hi.png" alt="Hi!" /> <!-- This is working dude -->
<img alt="Hi!" src="/opt/labs/lab_site/media/img/hi.png">
</form>
Upvotes: 0
Views: 1012
Reputation: 8502
When you extend a template, you need to specify in which block of your base template this markup will be rendered. Just add this into base/base.html
:
{% block login %}{% endblock %}
in the place where the login form should be rendered, and then in login.html
you'll have:
{% extends "base/base.html" %}
{% block login %}
<script>
$(document).ready(function() {
.....
<img src="/media/img/hi.png" alt="Hi!" /> <!-- This is working dude -->
<img alt="Hi!" src="/opt/labs/lab_site/media/img/hi.png">
</form>
{% endblock %}
Upvotes: 2