From 59ae0a4c9a9b363306f2172e08dcec750dc40607 Mon Sep 17 00:00:00 2001 From: rr- Date: Wed, 11 May 2016 18:32:53 +0200 Subject: [PATCH] server/db: maintain order of tag aliases First alias has a special meaning in certain contexts, such as post serialization, where only one alias is chosen to show to the client. --- server/szurubooru/db/tag.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/szurubooru/db/tag.py b/server/szurubooru/db/tag.py index 90cb0e4..3188739 100644 --- a/server/szurubooru/db/tag.py +++ b/server/szurubooru/db/tag.py @@ -48,7 +48,11 @@ class Tag(Base): last_edit_time = Column('last_edit_time', DateTime) category = relationship('TagCategory', lazy='joined') - names = relationship('TagName', cascade='all, delete-orphan', lazy='joined') + names = relationship( + 'TagName', + cascade='all,delete-orphan', + lazy='joined', + order_by='TagName.tag_name_id') suggestions = relationship( 'Tag', secondary='tag_suggestion',