diff options
-rw-r--r-- | app/books/migrations/0009_book_afflink.py | 18 | ||||
-rw-r--r-- | app/books/models.py | 1 | ||||
-rw-r--r-- | design/templates/details/book.html | 7 |
3 files changed, 24 insertions, 2 deletions
diff --git a/app/books/migrations/0009_book_afflink.py b/app/books/migrations/0009_book_afflink.py new file mode 100644 index 0000000..6130807 --- /dev/null +++ b/app/books/migrations/0009_book_afflink.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-02-22 21:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('books', '0008_auto_20190222_2140'), + ] + + operations = [ + migrations.AddField( + model_name='book', + name='afflink', + field=models.CharField(blank=True, max_length=400, null=True), + ), + ] diff --git a/app/books/models.py b/app/books/models.py index 5df74f1..00c0bdf 100644 --- a/app/books/models.py +++ b/app/books/models.py @@ -32,6 +32,7 @@ class Book(models.Model): publish_date = models.CharField(max_length=40, blank=True, null=True) publish_place = models.CharField(max_length=100, blank=True, null=True) openlib_url = models.CharField(max_length=400, blank=True, null=True) + afflink = models.CharField(max_length=400, blank=True, null=True) RATINGS = ( ('1', "1 Star"), ('2', "2 Stars"), diff --git a/design/templates/details/book.html b/design/templates/details/book.html index dd57d0a..3c08214 100644 --- a/design/templates/details/book.html +++ b/design/templates/details/book.html @@ -6,19 +6,22 @@ <li><a href="/books/" title="books" itemprop="url"><span itemprop="title">books</span></a> → </li> </ul> <main itemprop="mainEntity" itemscope itemtype="http://schema.org/Book"> + <header class="tight"> <h1 class="post-title book-title" itemprop="name">{{object.title|smartypants|widont|safe}}</h1> + <h2 class="post-subtitle">by {{object.author_name}}</h2> + </header> <div class="book-cover-wrapper"> <img src="{{object.get_image_url}}" alt="{{object.title}} cover" /> </div> <div class="meta-cover"> <dl class="book-metadata"> - <dt>Author</dt> - <dd>{{object.author_name}}</dd> {% if object.publish_date %}<dt>Published</dt> <dd>{%if object.publish_place%}{{object.publish_place}}, {%endif%}{{object.publish_date}}</dd>{%endif%} {% if object.pages %}<dt>Pages</dt> <dd>{{object.pages}}</dd>{%endif%} {% if object.isbn %}<dt>ISBN</dt> + {% if object.afflink %}<dt>Buy</dt> + <dd><a href="{{object.afflink}}" title="buy {{object.title}} at Amazon">Amzn</a></dd>{%endif%} <dd>{{object.isbn}}</dd>{%endif%} {% if object.isbn %}<dt>Borrow</dt> <dd><a href="http://worldcat.org/isbn/{{object.isbn}}" title="find {{object.title}} in your local library">WorldCat</a></dd>{%endif%} |