When unique=True is set on a model field, what happens during save, and how is this different from the database enforcing uniqueness?
It raises an IntegrityError if a duplicate is saved and the database also enforces this through a unique constraint created during migrations
It checks only during form submission and the database still allows duplicates if a rollback occurs
It automatically generates a unique value and overwrites duplicates without errors
It applies only within the app and global uniqueness must be configured in settings.py
This question is part of this quiz :
Python | Django Models