This is a very common misconception. With bankruptcy, you don't get a completely clean slate. In fact, a bankruptcy stays on your credit reports for 10 years, which will hinder you from getting credit. Additionally, child support, government student loans and tax liens are not relieved and discharged in bankruptcy.
This is no excuse for poor spending habits and shows great irresponsibility. Once a person files bankruptcy, the care of personal finances and spending habits must change, because there are rare instances where the same people can file twice. Take care of your spending habits now to avoid bankruptcy all together.