in my views, if I import the itertools module:
from itertools import chain
and I associate some objects with it:
franktags = Frank.objects.order_by('date_added').reverse().filter(topic__exact='art')
amytags = Amy.objects.order_by('date_added').reverse().filter(topic__exact='art')
timtags = Tim.objects.order_by('date_added').reverse().filter(topic__exact='art')
erictags = Eric.objects.order_by('date_added').reverse().filter(topic__exact='art')
ourtags = list(chain(franktags, amytags, timtags, erictags))
how do I order ourtags with date_added then?
not surpisingly
ourtags = list(chain(franktags, amytags, timtags, erictags)).order_by('date_added')
returns a "list" object, does not have the "order_by" attribute. Mistake.
kjarsenal
source
share