Commit 4002e438 authored by Javi Ng's avatar Javi Ng

added comments to html, css and model files

parent ed5ebb70
Pipeline #2963 failed with stages
......@@ -15,6 +15,7 @@ class Author (models.Model):
def __str__(self):
return self.first_name + " " + self.last_name
# getting url for detail page
def get_absolute_url(self):
return(reverse('authordetail', kwargs={'pk' : self.pk}))
......@@ -28,5 +29,6 @@ class Book (models.Model):
ISBN = models.IntegerField()
blurb = models.TextField(max_length = 200)
# getting url for detail page
def get_absolute_url(self):
return(reverse('bookdetail', kwargs={'pk' : self.pk}))
\ No newline at end of file
{% extends 'base.html' %}
{# title only uses object, as object call returns string of firstname lastname #}
{% block title %} {{ object }} {% endblock %}
{% block content %}
......@@ -7,6 +9,7 @@
<b>Nationality:</b> {{ object.nationality }} <br>
<b>Biography:</b> {{ object.bio }} <br> <br>
{# iterate through set of related books (related_name is booklist) #}
<b>Books by {{ object }} I love:</b>
<ul>
{% for book in object.booklist.all %}
......@@ -20,6 +23,7 @@
{% endblock %}
{# navigation bar block #}
{% block table %}
<td><a href = '../../home'>Home</a></td>
<td><a href = '../../books'>Books</a></td>
......
{% extends 'base.html' %}
{% block title %} My Favorite Authors {% endblock %}
{% block content %}
<h1>Javi's Favorite Authors:</h1>
{# Iterate through authors passed, use url method to link to detail pages #}
<ul>
{% for author in author_list %}
<li>
......@@ -15,6 +18,7 @@
{% endblock %}
{# navigation bar block #}
{% block table %}
<td><a href = '../home'>Home</a></td>
<td><a href = '../books'>Books</a></td>
......
{% extends 'base.html' %}
{% block title %} {{ object.title }} {% endblock %}
{% block content %}
......@@ -15,6 +16,7 @@
{% endblock %}
{# navigation bar block #}
{% block table %}
<td><a href = '../../home'>Home</a></td>
<td><a href = '../../books'>Books</a></td>
......
{% extends 'base.html' %}
{% block title %} My Favorite Books {% endblock %}
{% block content %}
<h1>Javi's Favorite Books:</h1>
{# Iterate through books in book_list, also with urls #}
<ul>
{% for book in book_list %}
<li>
......@@ -14,7 +17,8 @@
</ul>
{% endblock %}
{# navigation bar block #}
{% block table %}
<td><a href = '../home'>Home</a></td>
<td><a href = '../authors'>Authors</a></td>
......
......@@ -7,6 +7,7 @@
I like to think that the jokes are also reflective of my personality though.
{% endblock %}
{# navigation bar block #}
{% block table %}
<td><a href = '../books'>Books</a></td>
<td><a href = '../authors'>Authors</a></td>
......
/* Change font of headers */
h1 {
font-family: 'Courier New';
}
/* Make table spread across screen, beige bg color, double border */
table {
width: 100%;
background-color: bisque;
border: 2px solid;
}
/* Give table some padding space, align links to center */
td {
text-align: center;
padding: 5px;
border: 2px solid;
}
/* Make bullet points into my face */
ul {
list-style-image: url('bulletpoint.png');
}
/* Make background image also my face but just in the corner, rest of background is offwhite */
body {
background-image: url(background.png);
background-color: ivory;
background-position: right bottom;
background-repeat: no-repeat;
}
\ No newline at end of file
<html lang="en">
{% load static %}
<head>
{# calling stylesheet, block for page title #}
<link rel="stylesheet" href=" {% static '/style.css' %} ">
<title>{% block title %}My Favorite Books and Authors{% endblock %}</title>
......@@ -10,12 +11,14 @@
<body>
{# block for content #}
<div id="content">
{% block content %}{% endblock %}
</div>
<br>
{# block for navigation bar, app pages simply put table data for needed links #}
<table> <tr>
{% block table %}{% endblock %}
</table> </tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment