diff options
author | Jonathan DeMasi <jrdemasi@gmail.com> | 2020-03-03 19:58:28 -0700 |
---|---|---|
committer | Jonathan DeMasi <jrdemasi@gmail.com> | 2020-03-03 19:58:28 -0700 |
commit | 2f0a68673015a596f6e42e19917981db7ed7f263 (patch) | |
tree | 1e3c92c75743269beca028ebf5445fa0dc409a37 /blog | |
parent | 6a9a5e123b18d7b95c20b3ba80c4eae59768c1c0 (diff) | |
download | jthanio-2f0a68673015a596f6e42e19917981db7ed7f263.tar jthanio-2f0a68673015a596f6e42e19917981db7ed7f263.tar.gz jthanio-2f0a68673015a596f6e42e19917981db7ed7f263.tar.bz2 jthanio-2f0a68673015a596f6e42e19917981db7ed7f263.tar.lz jthanio-2f0a68673015a596f6e42e19917981db7ed7f263.tar.xz jthanio-2f0a68673015a596f6e42e19917981db7ed7f263.tar.zst jthanio-2f0a68673015a596f6e42e19917981db7ed7f263.zip |
blog index fixed
Diffstat (limited to 'blog')
-rw-r--r-- | blog/migrations/0006_auto_20200304_0226.py | 18 | ||||
-rw-r--r-- | blog/models.py | 3 | ||||
-rw-r--r-- | blog/templates/blog/blog_index_page.html | 62 |
3 files changed, 73 insertions, 10 deletions
diff --git a/blog/migrations/0006_auto_20200304_0226.py b/blog/migrations/0006_auto_20200304_0226.py new file mode 100644 index 0000000..5a82a76 --- /dev/null +++ b/blog/migrations/0006_auto_20200304_0226.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.3 on 2020-03-04 02:26 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0005_blogpost_categories'), + ] + + operations = [ + migrations.AlterField( + model_name='blogindexpage', + name='intro', + field=models.CharField(max_length=500), + ), + ] diff --git a/blog/models.py b/blog/models.py index 1848e0e..50210e7 100644 --- a/blog/models.py +++ b/blog/models.py @@ -11,7 +11,8 @@ from taggit.models import TaggedItemBase from wagtail.snippets.models import register_snippet class BlogIndexPage(Page): - intro = RichTextField(blank=True) + intro = models.CharField(max_length=500) + def get_context(self, request): # Update context to include only published posts, ordered by reverse-chron diff --git a/blog/templates/blog/blog_index_page.html b/blog/templates/blog/blog_index_page.html index 0e9c56e..043539f 100644 --- a/blog/templates/blog/blog_index_page.html +++ b/blog/templates/blog/blog_index_page.html @@ -5,16 +5,60 @@ {% block body_class %}template-blogindexpage{% endblock %} {% block content %} - <h1>{{ page.title }}</h1> +<div class="container"> - <div class="intro">{{ page.intro|richtext }}</div> + <div class="row"> - {% for post in blogpages %} - {% with post=post.specific %} - <h2><a href="{% pageurl post %}">{{ post.title }}</a></h2> - <p>{{ post.intro }}</p> - {{ post.body|richtext }} - {% endwith %} -{% endfor %} + <!-- Blog Entries Column --> + <div class="col-md-8"> + <h1 class="my-4">{{ page.title }} + <small>{{ page.intro }}</small> + </h1> + <hr> + + {% for post in blogpages %} + {% with post=post.specific %} + + <!-- Blog Post --> + <div class="card mb-4"> + <img class="card-img-top" src="http://placehold.it/750x300" alt="Card image cap"> + <div class="card-body"> + <h2 class="card-title">{{ post.title }}</h2> + <p class="card-text">{{ post.intro }}</p> + <a href="{% pageurl post %}" class="btn btn-primary">Read More</a> + </div> + <div class="card-footer text-muted"> + Posted on {{ post.date }} + </div> + </div> + {% endwith %} + {% endfor %} + + <!-- Pagination --> + <ul class="pagination justify-content-center mb-4"> + <li class="page-item"> + <a class="page-link" href="#">← Older</a> + </li> + <li class="page-item disabled"> + <a class="page-link" href="#">Newer →</a> + </li> + </ul> + + </div> + + <!-- Sidebar Widgets Column --> + <div class="col-md-4"> + + {% include "search.html" %} + + + </div> + + </div> + <!-- /.row --> + + </div> + + </div> {% endblock %}
\ No newline at end of file |