Order labels by name

fixes:
https://todo.sr.ht/~sircmpwn/todo.sr.ht/160
This commit is contained in:
Ivan Habunek 2019-05-21 13:47:17 +02:00 committed by Drew DeVault
parent 8841a12b6e
commit e7c801b46a
2 changed files with 5 additions and 2 deletions

View File

@ -12,7 +12,8 @@ class Label(Base):
sa.ForeignKey("tracker.id", ondelete="CASCADE"),
nullable=False)
tracker = sa.orm.relationship("Tracker",
backref=sa.orm.backref("labels", cascade="all, delete-orphan"))
backref=sa.orm.backref(
"labels", cascade="all, delete-orphan", order_by="Label.name"))
name = sa.Column(sa.Text, nullable=False)
color = sa.Column(sa.Text, nullable=False)

View File

@ -56,7 +56,9 @@ class Ticket(Base):
"""Permissions granted to anonymous (non-logged in) users"""
view_list = sa.orm.relationship("TicketSeen")
labels = sa.orm.relationship("Label", secondary="ticket_label")
labels = sa.orm.relationship("Label",
secondary="ticket_label", order_by="Label.name")
assigned_users = sa.orm.relationship("User",
secondary="ticket_assignee",