Skip to content

Instantly share code, notes, and snippets.

View mullerivan's full-sized avatar

Ivan Muller mullerivan

View GitHub Profile
@dnozay
dnozay / named_indices__models.py
Created January 8, 2015 18:49
django custom unique_together constraint name.
# named_indices/models.py
from django.db.backends.schema import BaseDatabaseSchemaEditor
old_create_index_name = BaseDatabaseSchemaEditor._create_index_name
if not hasattr(BaseDatabaseSchemaEditor, '_old_create_index_name'):
setattr(BaseDatabaseSchemaEditor, '_old_create_index_name', old_create_index_name)
def _create_index_name(self, model, column_names, suffix=""):
try: