You lock the door from the inside before you pull on the door to latch it (thus leaving it locked). It is a bathroom doorknob with a key instead of the tiny hole to release the push button.
It's pretty easy to have only a doorknob (like for closets) with no locking mechanism on the doorknob, but one that secures the door with a deadbolt right above it. I've seen that at a number of apartment complexes. The important part is that you engage the deadbolt with a key from the outside, not with a push button (and invariably forgetting your keys inside).
Then again, I have proper door locks and deadbolts, but I still have a combination device that holds my spare key. I cannot get locked out of my place.