California Elections Code Section 2151

At the time of registering and of transferring registration, each elector may declare the name of the political party with which he or she intends to affiliate at the ensuing primary election. The name of that political party shall be stated in the affidavit of registration and the index. The voter registration card shall inform the affiant that any elector may decline to state a political affiliation, but no person shall be entitled to vote the ballot of any political party at any primary election unless he or she has stated the name of the party with which he or she intends to affiliate or unless he or she has declined to state a party affiliation and the political party, by party rule duly noticed to the Secretary of State, authorizes a person who has declined to state a party affiliation to vote the ballot of that political party. The voter registration card shall include a listing of all qualified political parties. No person shall be permitted to vote the ballot of any party or for any delegates to the convention of any party other than the party designated in his or her registration, except as provided by Section 2152 or unless he or she has declined to state a party affiliation and the party, by party rule duly noticed to the Secretary of State, authorizes a person who has declined to state a party affiliation to vote the party ballot or for delegates to the party convention.