Ticket #12132: patch.diff

File patch.diff, 588 bytes (added by Mark, 6 years ago)

Proposed fix

  • django/db/models/base.py

     
    641641        # the list of checks. Again, skip empty fields and any that did not validate.
    642642        for f in self._meta.fields:
    643643            name = f.name
    644             if f.unique:
     644            if f.unique and not f.primary_key:
    645645                unique_checks.append((name,))
    646646            if f.unique_for_date:
    647647                date_checks.append(('date', name, f.unique_for_date))
Back to Top