mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-10 01:23:48 +01:00
Sort notifications in reverse order
This commit is contained in:
parent
64a180ba8f
commit
b3bd7ac615
@ -23,6 +23,7 @@ from flask import url_for
|
||||
from flask_login import UserMixin
|
||||
from flask_migrate import Migrate
|
||||
from flask_sqlalchemy import SQLAlchemy, BaseQuery
|
||||
from sqlalchemy import desc, text
|
||||
from sqlalchemy_searchable import SearchQueryMixin, make_searchable
|
||||
from sqlalchemy_utils.types import TSVectorType
|
||||
|
||||
@ -166,7 +167,7 @@ class User(db.Model, UserMixin):
|
||||
|
||||
# Content
|
||||
notifications = db.relationship("Notification", primaryjoin="User.id==Notification.user_id",
|
||||
order_by="Notification.created_at")
|
||||
order_by=desc(text("Notification.created_at")))
|
||||
|
||||
notification_preferences = db.relationship("UserNotificationPreferences", uselist=False, back_populates="user")
|
||||
|
||||
|
@ -14,6 +14,12 @@ Notifications
|
||||
|
||||
<h1>Notifications</h1>
|
||||
|
||||
{% if current_user.notifications %}
|
||||
<p>
|
||||
Newest first.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<div class="list-group mt-3">
|
||||
{% for n in current_user.notifications %}
|
||||
<a class="list-group-item list-group-item-action" href="{{ n.url }}">
|
||||
|
Loading…
Reference in New Issue
Block a user