Attempt to get predictable attachment ordering
authorMagnus Hagander <magnus@hagander.net>
Fri, 16 Oct 2015 08:25:47 +0000 (10:25 +0200)
committerMagnus Hagander <magnus@hagander.net>
Fri, 16 Oct 2015 08:25:47 +0000 (10:25 +0200)
Ordering becomes the same as the attachments are inserted in the db, which
should be the same order they were attached in the original email.

django/archives/mailarchives/models.py

index c857a74590b169313d73876a6c22b713846410fd..e57423e62c884ebac137d953df8abb16e45e36b5 100644 (file)
@@ -89,6 +89,8 @@ class Attachment(models.Model):
 
        class Meta:
                db_table = 'attachments'
+               # Predictable same-as-insert order
+               ordering = ('id',)
 
        def inlineable(self):
                # Return True if this image should be inlined