55502f40dc8b7c769880b10874abc9d0

When i combine this way, records that have sticky flag comes unordered. I need them(items that have sticky=1) on top of queryset, any suggestions?
i <3 refactormycode :)

entries         = BlogEntry.objects.filter(status=True,sticky=False,control_tags=controlTag)[offset:(offset+limit)]
sticky_entries  = BlogEntry.objects.filter(status=True,sticky=True,control_tags=controlTag)

entries         = sticky_entries | entries

Refactorings

No refactoring yet !

3fb9cd29b758d6188283dbc27fae2ec6

Matt Wilson

April 10, 2010, April 10, 2010 09:12, permalink

No rating. Login to rate!
# from http://www.djangosnippets.org/snippets/1103/ import MultiQuerySet

entries = MultiQuerySet(sticky_entries, entries)

Your refactoring





Format Copy from initial code

or Cancel