how to create an empty queryset and to add objects manually in django -
i need create queryset , add manually objects i've got different queries results in order display in table. uses xx=set() doesn't job.
you can in 1 of following ways:
from itertools import chain #compute list dynamically here: my_obj_list = list(obj1, obj2, ...) #and none_qs = mymodel.objects.none() qs = list(chain(none_qs, my_obj_list))
you do:
none_qs = mymodel.objects.none() qs = none_qs | sub_qs_1 | sub_qs_2
however, not work sliced querysets
Comments
Post a Comment