mirror of
https://github.com/rmontanana/microblog.git
synced 2025-08-16 07:45:51 +00:00
Chapter 12
This commit is contained in:
@@ -7,6 +7,7 @@ from flask_sqlalchemy import SQLAlchemy
|
|||||||
from flask_migrate import Migrate
|
from flask_migrate import Migrate
|
||||||
from flask_login import LoginManager
|
from flask_login import LoginManager
|
||||||
from flask_bootstrap import Bootstrap
|
from flask_bootstrap import Bootstrap
|
||||||
|
from flask_moment import Moment
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_object(Config)
|
app.config.from_object(Config)
|
||||||
@@ -20,6 +21,7 @@ login = LoginManager(app)
|
|||||||
# sets de default login view
|
# sets de default login view
|
||||||
login.login_view = "login"
|
login.login_view = "login"
|
||||||
bootstrap = Bootstrap(app)
|
bootstrap = Bootstrap(app)
|
||||||
|
moment = Moment(app)
|
||||||
|
|
||||||
if not app.debug:
|
if not app.debug:
|
||||||
if app.config["MAIL_SERVER"]:
|
if app.config["MAIL_SERVER"]:
|
||||||
|
@@ -6,12 +6,12 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ url_for('user', username=post.author.username) }}">
|
<a href="{{ url_for('user', username=post.author.username) }}">
|
||||||
{{ post.author.username }}
|
{{ post.author.username }}
|
||||||
</a>
|
</a>
|
||||||
says:
|
said {{ moment(post.timestamp).fromNow() }}:
|
||||||
<br>
|
<br>
|
||||||
{{ post.body }}
|
{{ post.body }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@@ -47,4 +47,9 @@
|
|||||||
{# application content needs to be provided in the app_content block #}
|
{# application content needs to be provided in the app_content block #}
|
||||||
{% block app_content %}{% endblock %}
|
{% block app_content %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
{{ super() }}
|
||||||
|
{{ moment.include_moment() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
@@ -7,7 +7,9 @@
|
|||||||
<td>
|
<td>
|
||||||
<h1>User: {{ user.username }}</h1>
|
<h1>User: {{ user.username }}</h1>
|
||||||
{% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
|
{% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
|
||||||
{% if user.last_seen %}<p>Last seen on: {{ user.last_seen }}</p>{% endif %}
|
{% if user.last_seen %}
|
||||||
|
<p>Last seen on: {{ moment(user.last_seen).format('LLL') }}</p>
|
||||||
|
{% endif %}
|
||||||
<p>{{ user.followers.count() }} followers, {{ user.followed.count() }} following.</p>
|
<p>{{ user.followers.count() }} followers, {{ user.followed.count() }} following.</p>
|
||||||
{% if user == current_user %}
|
{% if user == current_user %}
|
||||||
<p><a href="{{ url_for('edit_profile') }}">Edit your profile</a></p>
|
<p><a href="{{ url_for('edit_profile') }}">Edit your profile</a></p>
|
||||||
|
Reference in New Issue
Block a user