Answer the question
In order to leave comments, you need to log in
Why was the field removed from the table corresponding to the model when changing the field type to ChainedManyToManyField()?
Good evening.
When using the Django-smart-selects application to implement related selects, I try to change the fields of the models according to the example from the Django-smart-selects description, namely the example for the ManyToMany binding:
from smart_selects.db_fields import ChainedManyToManyField
class Publication(models.Model):
name = models.CharField(max_length=255)
class Writer(models.Model):
name = models.CharField(max_length=255)
publications = models.ManyToManyField('Publication', blank=True, null=True)
class Book(models.Model):
publication = models.ForeignKey(Publication)
writer = ChainedManyToManyField(
Writer,
chained_field="publication",
chained_model_field="publications", verbose_name='publication',db_column='publication'
)
name = models.CharField(max_length=255)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question