If I had a field in the model that has primary_key=True and a default function that can return ids with collisions, what happens on save?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Same as with any other unique constraint: the database would refuse to insert the new record, and Django would report an
IntegrityError.Which is why you should always use an autoincrementing integer field for your primary key, which is what the default
idfield does anyway.