#12810: ManyToManyField.db_table
-------------------------------+--------------------------------------------
Reporter: strelnikovdmitrij | Owner: nobody
Status: new | Milestone:
Component: Documentation | Version: SVN
Keywords: ManyToManyField | Stage: Unreviewed
Has_patch: 0 |
-------------------------------+--------------------------------------------
Originally from documentation.
ManyToManyField.db_table
The name of the table to create for storing the many-to-many data. If this
is not provided, Django will assume a default name based upon the names of
the two tables being joined.
It is a little bit unclear, cause if db_table is not provided, Django will
create table with name based on the name of the model (table that has the
ManyToManyField), and field name that contain this ManyToManyField.
class Product(models.Model):
color = models.ManyToManyField('ProductColor', null=True, blank=True)
class Meta:
db_table = 'eshop_product'
class ProductColor(models.Model):
name = ...
class Meta:
db_table = 'eshop_product_color'
running syncdb
after the creation of 'eshop_product' table Django will create
'eshop_product_color' table that holds relation between Product and
ProductColor. The table for ProductColor will never create.
--
Ticket URL: <http://code.djangoproject.com/ticket/12810>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.