|Reported by:||strelnikovdmitrij||Owned by:||nobody|
|Component:||Core (Management commands)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by Alex)
Originally from documentation.
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'
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.
Change History (10)
comment:1 Changed 4 years ago by Alex
- Description modified (diff)
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 4 years ago by russellm
- Component changed from Documentation to django-admin.py
- milestone set to 1.2
- Triage Stage changed from Unreviewed to Accepted