Stop double-bookings in Django: explicit slots, a review step, and a tight confirm
Two people open the same 16:30 slot. Both see it as free. Both type a name and a mobile number. Both click Confirm. If your booking app is even slightly careful about money, reputation or a real waiting room, that race is the bug that matters.
I built this flow for a small clinic-style appointment app: one location, a handful of practitioners, bilingual pages, and a reception desk that has to trust the list on the screen. The patterns below are generic Django. They are not a dump of a private codebase, and they do not assume a particular clinic. They are the rules I would start with again.
The goal is simple. A slot is bookable by at most one active appointment. Confirm is the only step that writes the booking. Everything before that is a draft the user can abandon.
1. Materialize the slots
An open range such as "Tuesday, 16:00 to 19:00, every 30 minutes" is a scheduling idea, not a bookable row.…