- Microblog:
-
Home
-
Explore
+
+
+
+
+ {% if title %}
+
{{ title }} - Microblog
+ {% else %}
+
Welcome to Microblog
+ {% endif %}
+
+
+
+
+
+ {% with messages = get_flashed_messages() %}
+ {% if messages %}
+ {% for message in messages %}
+
{{ message }}
+ {% endfor %}
+ {% endif %}
+ {% endwith %}
+ {% block content %}{% endblock %}
+
+
diff --git a/app/templates/bootstrap_wtf.html b/app/templates/bootstrap_wtf.html
new file mode 100644
index 0000000..6bc02b9
--- /dev/null
+++ b/app/templates/bootstrap_wtf.html
@@ -0,0 +1,70 @@
+{% macro form_field(field, autofocus) %}
+ {%- if field.type == 'BooleanField' %}
+
+ {{ field(class='form-check-input') }}
+ {{ field.label(class='form-check-label') }}
+
+ {%- elif field.type == 'RadioField' %}
+ {{ field.label(class='form-label') }}
+ {%- for item in field %}
+
+ {{ item(class='form-check-input') }}
+ {{ item.label(class='form-check-label') }}
+
+ {%- endfor %}
+ {%- elif field.type == 'SelectField' %}
+ {{ field.label(class='form-label') }}
+ {{ field(class='form-select mb-3') }}
+ {%- elif field.type == 'TextAreaField' %}
+
+ {{ field.label(class='form-label') }}
+ {% if autofocus %}
+ {{ field(class='form-control' + (' is-invalid' if field.errors else ''), autofocus=True) }}
+ {% else %}
+ {{ field(class='form-control' + (' is-invalid' if field.errors else '')) }}
+ {% endif %}
+ {%- for error in field.errors %}
+
{{ error }}
+ {%- endfor %}
+
+ {%- elif field.type == 'SubmitField' %}
+ {{ field(class='btn btn-primary mb-3') }}
+ {%- else %}
+
+ {{ field.label(class='form-label') }}
+ {% if autofocus %}
+ {{ field(class='form-control' + (' is-invalid' if field.errors else ''), autofocus=True) }}
+ {% else %}
+ {{ field(class='form-control' + (' is-invalid' if field.errors else '')) }}
+ {% endif %}
+ {%- for error in field.errors %}
+
{{ error }}
+ {%- endfor %}
+
+ {%- endif %}
+{% endmacro %}
+
+{% macro quick_form(form, action="", method="post", id="", novalidate=False) %}
+
+{% endmacro %}
diff --git a/app/templates/edit_profile.html b/app/templates/edit_profile.html
index e2471ac..ef7ca75 100644
--- a/app/templates/edit_profile.html
+++ b/app/templates/edit_profile.html
@@ -1,23 +1,7 @@
{% extends "base.html" %}
+{% import "bootstrap_wtf.html" as wtf %}
{% block content %}
Edit Profile
-
+ {{ wtf.quick_form(form) }}
{% endblock %}
diff --git a/app/templates/index.html b/app/templates/index.html
index eb3f876..047f33f 100644
--- a/app/templates/index.html
+++ b/app/templates/index.html
@@ -1,27 +1,26 @@
{% extends "base.html" %}
+{% import "bootstrap_wtf.html" as wtf %}
{% block content %}
Hi, {{ current_user.username }}!
{% if form %}
-
+ {{ wtf.quick_form(form) }}
{% endif %}
{% for post in posts %}
{% include '_post.html' %}
{% endfor %}
- {% if prev_url %}
-
Newer posts
- {% endif %}
- {% if next_url %}
-
Older posts
- {% endif %}
+
{% endblock %}
diff --git a/app/templates/login.html b/app/templates/login.html
index 2a54187..63439b5 100644
--- a/app/templates/login.html
+++ b/app/templates/login.html
@@ -1,26 +1,9 @@
-{% extends "base.html" %}
+{% extends 'base.html' %}
+{% import "bootstrap_wtf.html" as wtf %}
{% block content %}
Sign In
-
+ {{ wtf.quick_form(form) }}
New User? Click to Register!
Forgot Your Password?
diff --git a/app/templates/register.html b/app/templates/register.html
index 37b7ac5..26db864 100644
--- a/app/templates/register.html
+++ b/app/templates/register.html
@@ -1,37 +1,7 @@
{% extends "base.html" %}
+{% import "bootstrap_wtf.html" as wtf %}
{% block content %}
Register
-
+ {{ wtf.quick_form(form) }}
{% endblock %}
diff --git a/app/templates/reset_password.html b/app/templates/reset_password.html
index 92f0c8e..bd5ccc2 100644
--- a/app/templates/reset_password.html
+++ b/app/templates/reset_password.html
@@ -1,23 +1,7 @@
{% extends "base.html" %}
+{% import "bootstrap_wtf.html" as wtf %}
{% block content %}
Reset Your Password
-
+ {{ wtf.quick_form(form) }}
{% endblock %}
diff --git a/app/templates/reset_password_request.html b/app/templates/reset_password_request.html
index 18bb0ae..d60b1b5 100644
--- a/app/templates/reset_password_request.html
+++ b/app/templates/reset_password_request.html
@@ -1,16 +1,7 @@
{% extends "base.html" %}
+{% import "bootstrap_wtf.html" as wtf %}
{% block content %}
Reset Password
-
+ {{ wtf.quick_form(form) }}
{% endblock %}
diff --git a/app/templates/user.html b/app/templates/user.html
index af77ea2..a48e7c3 100644
--- a/app/templates/user.html
+++ b/app/templates/user.html
@@ -1,9 +1,9 @@
{% extends "base.html" %}
{% block content %}
-
-
- |
+
+
+ |
User: {{ user.username }}
{% if user.about_me %}{{ user.about_me }} {% endif %}
@@ -15,28 +15,35 @@
{% else %}
{% endif %}
|
-
{% for post in posts %}
{% include '_post.html' %}
{% endfor %}
- {% if prev_url %}
- Newer posts
- {% endif %}
- {% if next_url %}
- Older posts
- {% endif %}
+
{% endblock %}