mirror of
https://github.com/rmontanana/microblog.git
synced 2025-08-17 00:05:51 +00:00
Chapter 4
This commit is contained in:
29
app/templates/base.html
Normal file
29
app/templates/base.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
{% if title %}
|
||||
<title>{{ title }} - microblog</title>
|
||||
{% else %}
|
||||
<title>microblog</title>
|
||||
{% endif %}
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
Microblog:
|
||||
<a href="{{ url_for('index') }}">Home</a>
|
||||
<a href="{{ url_for('login') }}">Login</a>
|
||||
</div>
|
||||
<hr />
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul>
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% block content %}
|
||||
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
8
app/templates/index.html
Normal file
8
app/templates/index.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Hi, {{ user.username }}!</h1>
|
||||
{% for post in posts %}
|
||||
<div><p>{{ post.author.username }} says: <b>{{ post.body }}</b></p></div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
24
app/templates/login.html
Normal file
24
app/templates/login.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Sign In</h1>
|
||||
<form action="" method="post" novalidate>
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.username.label }}<br />
|
||||
{{ form.username(size = 32) }}<br />
|
||||
{% for error in form.username.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.password.label }}<br />
|
||||
{{ form.password(size = 32) }}<br />
|
||||
{% for error in form.password.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.remember_me() }} {{ form.remember_me.label }}</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user