I'm using SeparatedValuesField to keep track of a list of strings as explained by http://davidcramer.posterous.com/code/181/custom-fields-in-django.html and many posts here on SO that recommend this as the right way to store a list of strings.
class UserProfile(models.Model):
user = models.OneToOneField(User)
device_ids = SeparatedValuesField(blank=True, null=True, default=[])
It is working fine in my application, I can add device ids and view them in the admin interface as expected.
user_profile.device_ids = ['666666-D849-524F-6984-7E9B2D768546']
But the problem is in the admin interface, when I open up the detail page for a UserProfile object, the admin interface itself is adding extra values to my device_ids field.
For example, my application inserts a value into the field, and when I view it in the admin interface it looks like this:
[u'666666-D849-524F-6984-7E9B2D768546']
Then I change some other random property on my UserProfile object and save it using the built in django admin interface save button.
When I open the UserProfile object detail page up again for my object, that value now looks like this:
[u"[u'666666-D849-524F-6984-7E9B2D768546']"]
If I repeat this process of just hitting save then opening up this detail page, it will continue nesting the actual value with u"[ ] characters.
Is there something I can do to change this functionality? Should I be storing the list of strings in a different way?