Fix topological sort

Fixes https://github.com/django/django/pull/3525
I'd like to keep the deconstruct implementation here and add a deprecation warning for deprecated in 1.8 and removed in 2.0. This would then follow the regular deprecation path but keeps backwards compatibility. (keep `__new__`, `__eq__` and `__ne__` methods around as well)

You might also need to touch the operations in `django.contrib.postgres.operations`.