On 5 jan, 19:25, "Tiago S." <tsera...@gmail.com> wrote: > Hi, > > I'm porting a app from GAE, which uses the StringList[1] property to > store choices(simple strings) in the Poll model. > > I've read the django tutorial and there they make use of two models > with a relationship between Choices and Polls.
This is the recommended way to use a relational database. > With my app, I don't > see the need of an extra model, as a simple list within the Poll model > would suffice. Then how do you store the number of votes per choice ? > I've also checked the docs, this group and djangosnippets, and I > couldn't find any reference to something similar to what I need. > > Maybe I didn't do the right search... So I decided to ask here first > instead of writing a custom Model Field and maybe reinvent the wheel. > > Does anyone have some clue on how to achieve that? Maybe I should > piclke the list, or that would be a overkill? Overkill, nope. But how are you going to use this with a non-python client program? I've seen this (serialized arrays in a db field) in quite a few php apps, and I can tell you it always ended being a PITA. A SQL database is not a dumb bits bucket, so if you use one, better to use it properly IMHO. Note that Google storage is *not* relational - by design - so trying to forcefit Google storage concepts in a relational database may not be a good idea, quite on the contrary - you'll just get the worst of both worlds.... Now if you really insist on giving up on normalization, at least use a cross-language serialisation format like json. At least you'll have a chance to make the data accessible to non-python programs. My 2 cents --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---