Fixed `update_permissions` on django 1.7. Added a test.