I have this Django query where I get some information from different databases, which I want to expose to the front end:
specifics = PageData.objects.filter(page_id__in=page_ids).values('page_id'). \
annotate(views=Count('page_id')). \
values('views', 'page__title', 'page__content_size')
that gives me in turn a list of dictionaries - the prompt is for list(specifics)
:
[
{'page__content_size': 19438L,
'page__title': u'Bosch Tassimo Charmy anmeldelse. Positivt: Bryggehastighed. Negativt: Placering af vandtanken. | 96 Grader',
'views': 5},
[…]
{'page__content_size': 19395L,
'page__title': u'Banwood First Go Balance Bike - studiominishop.com',
'views': 1}
]
I would like to be able to arrange the order of the keys in each dictionary, that means in a required and specific order I am provided. The order would always be the same for each element in the list.
Is there any way to do it in Django or in Python?