Unfortunately, I think this problem is going to get worse before it gets better. The attack itself was relatively minor and no group claimed responsibility, which indicates that this was a trial balloon. It's almost inevitable that other attacks are going to be bolder.
I used to think that these terrorism problems were endemic and that nothing short of comprehensive economic development and total societal reform could address them. While that might be necessary long term, there's a much better model for this that applies to Pakistan in particular: post-Arab Spring Egypt. Both Egypt and Pakistan are military-run countries; both have weak and corrupt political systems (at least in the Mubarak period in Egypt); both have problems with Islamist terrorists.
The difference is the Arab Spring swept away Mubarak's inept and corrupt government, and then in 2013 another revolution swept away the terrorist Muslim Brotherhood government. Thinks were looking very bad in the period from 2011 to 2013 - Egypt was mired in sectarian violence, the economy was collapsing, Hamas and other terrorists were roaming free and attacking whomever they wished. In short, Egypt was on its way to becoming Afghanistan.
What changed was Sisi. One general decided that enough was enough and the changes were nearly miraculous. The terrorists were hunted down and executed by the baker's dozen; there was a time when Egyptian courts were handing out death sentences like speeding tickets. New development projects were initiated the pulled Egypt's economy from the doldrums and it's been a standout among developing countries since.
There are a lot of lessons for Pakistan here, chief among them is that Pakistan needs a general who thinks Pakistan is worth saving.