I'm trying to create a list in PostgreSQL of filenames and update the list on the fly.
my model(Package):
completed_uploads=ArrayField(models.TextField(blank=True), null=True, default=list)
creating the list:
Package.create(...,
completed_uploads = [])
my update code:
packageInstance = Package.objects.get(id=packageId)
completed_uploads = packageInstance.completed_uploads.append(request.data['filepath'])
Package.objects.filter(id=packageId).update(node = request.data['node'], completed_uploads=completed_uploads, prefix=request.data['prefix'] )
edit I changed the above to list instead of list() --- now I get the error:
'NoneType' object has no attribute 'append'
on the second time the function is called. when I check my database the field 'completed_uploads' is null