Skip to content

madeofstars0/django18bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django 1.8 Postgres ArrayField Bug

I found an issue when upgrading to Django 1.8 and using the new ArrayField. The code here is setup to show the problems. I have reproduced this problem on OSX 10.10 with Postgresql 9.4 and in the provided Vagrant environment (Ubuntu 14.04, Postgresql 9.3).

Take a look at the tests.

An instance method on a model - This doesn't work

def add_to_array(self, item):
    if item not in self.array_field:
        self.array_field.append(item)

This workaround 'works'

def add_to_array(self, item):
    existing = self.array_field

    if item not in self.array_field:
        self.array_field = existing + [item]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published