#25494: db_table option doesn't work in ManyToMany fields which using through
option
----------------------------+--------------------------------
     Reporter:  mehranakk   |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Migrations  |    Version:  1.8
     Severity:  Normal      |   Keywords:  db_table migration
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------------------
 I have a model which contains a ManyToMany field using the through option.
 I wanted to change the name of the many to many table, so I added db_table
 in Meta class of through model. After running makemigrations and migrate
 commands, I have a tables with default names.


 {{{
 class MyModel(models.Model):
     my_field = models.ManyToManyField(AnotherModel,
 through='IntermediateModel')

 class IntermediateModel(models.Model):
     class Meta:
          db_table = 'my_intermediate_name'
      my_model = models.ForeignKey(MyModel)
      another_model = models.ForeignKey(AnotherModel)
 }}}

 I run these commands:


 {{{
 python manage.py makemigrations
 python manage.py migrate
 }}}

 I'm using postgresql 9.4.4

--
Ticket URL: <https://code.djangoproject.com/ticket/25494>
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/052.7e0204ac07bcb6fec5da3acf5be7168b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to