edx/edx-ora — pull request #134 by VikParuchuri (2013-09-06 16:49:45+00:00)
Title: Fix/vik/calibration 500

Stanford was getting 500 errors when students when trying to calibrate.

This occurred because django get_or_create can, in certain cases (race conditions?) create multiple records. Calling a get after this will result in an error because the rows are no longer unique.

To fix this, a unique_together constraint was added to the CalibrationHistory table.

While I was at it, I also added reasonable constraints to other tables.

In order to add these constraints to the database, the database first needs to be free of duplicate entries. The delete_duplicates management command allows for duplicate entries to be first viewed and then optionally deleted. This needs to be done before upgrading to this version and running the migrations (migrations will fail otherwise).