Political party affiliations are set during voter registration, which in some states can occur at the same time as getting a driver's license. (Setting a party affiliation gets you a ballot for that party's primaries.) So it'd all be in the same DMV form and the end result is a drivers license and registered voter. Party affiliation is generally public information (search for it).