0

models.py:

from django.contrib.postgres.fields import ArrayField

class AdDO(models.Model):
    ...
    tags_name = ArrayField(models.CharField(max_length=40,
                           blank=True, null=True),
                           blank=True, null=True)

class Tag(models.Model):
    ...
    name = models.CharField(max_length=40, db_index=True)

How do multi autocomplete for the field AdDO.tags_name from Tag.name?
The AdDO.tags_name needs to get the character field, for example: "watermelon red, green leaf, black stone" (Tag.name values separated by commas)

Evgeniy_Burdin
  • 627
  • 5
  • 14
  • I have never seen ArrayField before, but it looks interesting. Get rid of it. You probably need it to be a ManyToManyField to the Tag model. – Bobort Mar 10 '16 at 16:08
  • I do not need referential integrity between tables, so do not use ManyToMany. I just need to adjust the values for `tags_name` of `Tag.name` – Evgeniy_Burdin Mar 10 '16 at 21:12

0 Answers0