#24102: BaseDatabaseSchemaEditor.create_model: allow unique_together constraint
name
-------------------------------+--------------------------------------
Reporter: dnozay | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by dnozay):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
In `BaseDatabaseSchemaEditor.create_model` there are currently no names
for `unique_together` constraints.
possible fix:
{{{#!python
class BaseDatabaseSchemaEditor(object):
# Overrideable SQL templates
sql_create_table_unique = "UNIQUE %(name)s (%(columns)s)"
}}}
`create_model` should have:
{{{#!python
# Add any unique_togethers
for fields in model._meta.unique_together:
columns = [model._meta.get_field(field).column for field in
fields]
column_sqls.append(self.sql_create_table_unique % {
"name": self.quote_name(self._create_index_name(model,
columns, suffix="_uniq")),
"columns": ", ".join(self.quote_name(column) for column in
columns),
})
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24102#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.262c722f83e9214e32a38cc9bc3d1395%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.