0

I am using Flask, sqlalchemy with postgres:

I have some code in Flask to query result in my models.

the first one can be:

campaignpage =  campaignpages.filter_by(folder=folder)

And i have a list of IDs like:

cps_selected = [1,2,3,4,5,9,10]

i created cps_selecteds = [1,2,3,4,5,9,10, ...]

I have tried to get all campaigns from cps_selected and campaignpage.

campaignpage = DBInboundCampaign.query.filter(DBInboundCampaign.id.in_(cps_selecteds))

and make paginate:

campaignpage = campaignpage.paginate(page, per_page=50)

But the order of the campaign is changed, and i want to order cps_selected campaigns first in my paginate

I have tried several thread in google but no luck.

Ilja Everilä
  • 50,538
  • 7
  • 126
  • 127
voipmanvn
  • 45
  • 1
  • 6

0 Answers0