contractions after birth?

I just read your contractions don't stop right after you give birth and it's your bodies way of preventing major blood loss. I never really thought about it before! How long do they last? Do they still hurt badly after birth? Any information on this would be great!!