Fix order
This commit is contained in:
parent
bb1a2a1cd3
commit
21f6083248
2 changed files with 3 additions and 3 deletions
|
@ -47,7 +47,7 @@ class LiveblogInterface(models.Model):
|
|||
items.extend(
|
||||
model.objects.filter(placeholder=self.placeholder).values('pk', 'post_date')
|
||||
)
|
||||
order = [item['pk'] for item in sorted(items, key=itemgetter('post_date'))]
|
||||
order = reversed([item['pk'] for item in sorted(items, key=itemgetter('post_date'))])
|
||||
reorder_plugins(self.placeholder, None, self.language, order)
|
||||
|
||||
@property
|
||||
|
|
|
@ -210,11 +210,11 @@ try:
|
|||
post.liveblog, 'LiveblogPlugin', language='en', body='plugin 3', publish=True,
|
||||
post_date=current_date - timedelta(seconds=10)
|
||||
)
|
||||
self.assertTrue(Liveblog.objects.all().order_by('position').values_list('pk', flat=True), [3, 2, 1])
|
||||
self.assertEqual(list(Liveblog.objects.all().order_by('position').values_list('pk', flat=True)), [1, 2, 3])
|
||||
|
||||
plugin.post_date = current_date - timedelta(seconds=20)
|
||||
plugin.save()
|
||||
self.assertTrue(Liveblog.objects.all().order_by('position').values_list('pk', flat=True), [1, 3, 2])
|
||||
self.assertEqual(list(Liveblog.objects.all().order_by('position').values_list('pk', flat=True)), [2, 3, 1])
|
||||
|
||||
except ImportError: # pragma: no cover
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue