Hand-check unique_together constraints with null values.

Review Request #5274 — Created Jan. 17, 2014 and submitted — Latest diff uploaded

Information

Review Board
release-1.7.x

Reviewers

Hand-check unique_together constraints with null values.

Django has a bug where unique_together constraints for foreign keys aren't
enforced properly when one of the foreign keys is null (well, technically it's
a database bug). This meant that users who weren't using local sites could
create Groups or Repositories that had conflicting names and paths.

This change implements the clean() method for the Group and Repository
models. This method is automatically called from ModelForms, which means the
admin site is fixed automatically.

The web API has a similar issue, but only for repositories. The Group
create/update methods had an implementation which already checked for these
sorts of problems. I haven't implemented a unit test for the repository API
changes because this change is currently on 1.7.x, but I'll add it to the to-do
list for master.

  • Tried to create a Group with a conflicting name from the admin UI.
  • Tried to create a Repository with a conflicting path from the admin UI.
  • Tried to create a Repository with a conflicting name from the admin UI.
  • Tried to create a Repository with a conflicting path from the web API.
  • Tried to create a Repository with a conflicting name from the web API.
  • Ran unit tests.