views:

489

answers:

2

What is the best way to store an array of integers in a django database?

+3  A: 

CommaSeparatedIntegerField comes to mind instantly. It is implemented as VARCHAR on most database backends. To be sure though, you may want to skim through django/db/backends/*.

ayaz
That basically means that I have to convert the string back into integers myself?
Christian
+1  A: 

See this answer for a description of a possible alternative version of CommaSeparatedIntegerField that would do more of the work for you (converting from list to string and back). Maybe you could check in with that guy about whether he wrote it already :-)

Carl Meyer