From d21b4193ce6e58216d66f449cfeaf79ab0da2dc3 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 16 Nov 2016 09:45:39 +0100 Subject: [PATCH] Fixing API attachments order and deprecated --- taiga/projects/attachments/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/taiga/projects/attachments/utils.py b/taiga/projects/attachments/utils.py index 5103fccb..b1f6b08e 100644 --- a/taiga/projects/attachments/utils.py +++ b/taiga/projects/attachments/utils.py @@ -37,8 +37,10 @@ def attach_basic_attachments(queryset, as_field="attachments_attr"): attachments_attachment.id, attachments_attachment.attached_file FROM attachments_attachment - WHERE attachments_attachment.object_id = {tbl}.id AND attachments_attachment.content_type_id = {type_id} - ORDER BY attachments_attachment.order, attachments_attachment.id) t""" + WHERE attachments_attachment.object_id = {tbl}.id + AND attachments_attachment.content_type_id = {type_id} + AND attachments_attachment.is_deprecated = False + ORDER BY attachments_attachment.order, attachments_attachment.created_date, attachments_attachment.id) t""" sql = sql.format(tbl=model._meta.db_table, type_id=type.id) queryset = queryset.extra(select={as_field: sql})