-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabaseshome.html
More file actions
38 lines (32 loc) · 2.21 KB
/
databaseshome.html
File metadata and controls
38 lines (32 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{% extends 'base.html'%}<!-- this is used, so that the child templates can inherit values from the base template-->
{% block title %}Homepage{% endblock %}
{% block content %}<!-- put all the html in between this and 'endblock' into a single block-->
{{ super() }}
<h1>Hello {{name}}, you are on the home page!</h1>
<!-- Database presentation -->
<!-- Creating a loop to loop over the items in the database-->
<h1> Database Results! </h1>
{% for item in results %}
<h2> ID: {{item.id}} Name: {{item.name}} Location: {{item.location}} </h2><!-- here we type in the statements to showcase all the items from the current database that we are looping over-->
{% endfor%}
<!-- Entering conditional statements to html-->
{% if display %} <!-- to begin a conditional statement we use a single bracket with percentage "%" at both ends to signify a logic statement that has to be excecuted -->
<h2> This is being displayed </h2>
{% else %}<!-- else statement-->
<h2> This is not being displayed </h2>
{% endif %}<!-- the statement that is used to close the logical function-->
<!--Loops-->
{% for x in nlist %}<!-- to initiate a for loop-->
<h3>{{x}}</h3><!-- the value that is to be displayed is the values of nlist from the program and not just the letter x, that is why we use double curly brackets, so as to get the variable -->
{% endfor %}<!-- end for loop-->
{% for x in nlistofdict %}<!-- to initiate a for loop-->
<h4>{{x.name}}</h4><!-- to get the values from the dictionary and no the dictionary itself we have use 'x.name', to pull values from within the dictionary-->
{% endfor %}<!-- end for loop-->
<!-- Static files -->
<img src="{{url_for('static',filename='images/guilliman.png')}}">
<!-- if the particular file is in a child directory just show the path of the file as given above-->
<!-- here 'static', is directory for all the static files to be used in the project, by specifying the file name that file can be imported-->
<!--in the case of using static files, the above given code snippet is the how you would showcase any static files on the website-->
{% include 'includedemo.html' %}
<!-- the 'include function is used to inject objects of the another html into a different one'-->
{% endblock %}