messing around with flask tutorial

index.html 904B

1234567891011121314151617181920212223242526272829
  1. {% extends 'base.html' %}
  2. {% block header %}
  3. <h1>{% block title %}Posts{% endblock %}</h1>
  4. {% if g.user %}
  5. <a class="action" href="{{ url_for('blog.create') }}">New</a>
  6. {% endif %}
  7. {% endblock %}
  8. {% block content %}
  9. {% for post in posts %}
  10. <article class="post">
  11. <header>
  12. <div>
  13. <h1>{{ post['title'] }} </h1>
  14. <div class="about">by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}</div>
  15. </div>
  16. {% if g.user['id'] == post['author_id'] %}
  17. <a class="action" href="{{ url_for('blog.update', id=post['id']) }}">Edit</a>
  18. {% endif %}
  19. </header>
  20. <p class="body">{{ post['body'] }}</p>
  21. </article>
  22. {% if not loop.last %}
  23. <hr>
  24. {% endif %}
  25. {% endfor %}
  26. {% endblock %}