diff --git a/app.db b/app.db index 8ba4b97..2b7c11b 100644 Binary files a/app.db and b/app.db differ diff --git a/app/__init__.py b/app/__init__.py index 7fe7ba8..42cdefd 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -7,6 +7,7 @@ from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate from flask_login import LoginManager from flask_bootstrap import Bootstrap +from flask_moment import Moment app = Flask(__name__) app.config.from_object(Config) @@ -20,6 +21,7 @@ login = LoginManager(app) # sets de default login view login.login_view = "login" bootstrap = Bootstrap(app) +moment = Moment(app) if not app.debug: if app.config["MAIL_SERVER"]: diff --git a/app/templates/_post.html b/app/templates/_post.html index 30d18db..aac3058 100644 --- a/app/templates/_post.html +++ b/app/templates/_post.html @@ -6,12 +6,12 @@ - - {{ post.author.username }} - - says: -
- {{ post.body }} + + {{ post.author.username }} + + said {{ moment(post.timestamp).fromNow() }}: +
+ {{ post.body }} diff --git a/app/templates/base.html b/app/templates/base.html index 01b8d2a..645241e 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -47,4 +47,9 @@ {# application content needs to be provided in the app_content block #} {% block app_content %}{% endblock %} +{% endblock %} + +{% block scripts %} + {{ super() }} + {{ moment.include_moment() }} {% endblock %} \ No newline at end of file diff --git a/app/templates/user.html b/app/templates/user.html index 0658a3d..09e0990 100644 --- a/app/templates/user.html +++ b/app/templates/user.html @@ -7,7 +7,9 @@

User: {{ user.username }}

{% if user.about_me %}

{{ user.about_me }}

{% endif %} - {% if user.last_seen %}

Last seen on: {{ user.last_seen }}

{% endif %} + {% if user.last_seen %} +

Last seen on: {{ moment(user.last_seen).format('LLL') }}

+ {% endif %}

{{ user.followers.count() }} followers, {{ user.followed.count() }} following.

{% if user == current_user %}

Edit your profile