Q:

Get unique together constraint name in db in Django

How can I get the name of a unique together constraint in Django?
It seems to be generated quite randomly to e.g. book_membership_collection_id_order_c52e778f_uniq, and I need to programatically get this name to do something with RunSQL

A:

I found it was possible via
connection.schema_editor()._constraint_names(MYModel, ['col1', 'col2'], unique=True)

