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