I assume you mean a fancy variation on if/then to swap the order of those two actions? If you made the query parameter logic a function, you could probably setup a tuple of generators that yield the fucntion results and call using reversed() depending on which branch of the if/else statement you take, but I don't think that gets us much in terms of readability.

If you're talking about detecting which actions need to go in that list, it's probably good enough to just move the list to actions.py with an comment and a meaningful name (I realize you wrote this before your refactor). We might be able to do some direct parsing of the url itself to make sure we're always inserting before any url parameters, but that may just be fragile in another way if there are other cases we're not thinking of.