1

i have model which containing a list, i want to append value in all instances from this model

class model(models.Model):
    title = models.CharField(max_length=255)
    roles = ArrayField(base_field=models.TextField(choices=ModelRoles.choices()), default=list)

my update statement is

model.objects.all.update(roles=roles.append("new role")) 
Marox587
  • 35
  • 6
  • Do you want to update all row's in your table or you want to update specific row? From where you're getting `roles.append("new role")` please provide that too. To use `ArrayField` you've to use Postgre database. – Ankit Tiwari Feb 21 '22 at 10:52
  • 1
    Does this answer your question? [Django 1.8 ArrayField append & extend](https://stackoverflow.com/questions/29014966/django-1-8-arrayfield-append-extend) – Ankit Tiwari Feb 21 '22 at 10:56

0 Answers0