On 28 jan, 23:09, Mirat Can Bayrak <miratcanbay...@gmail.com> wrote: > Can you look at these, can they work? > > i tried that one but not worked, is there way to make it working? (nope, > there was no error messages, only strings are not shown at admin panel) > > LANGUAGE_OPTIONS = (('en_GB', '(British) English'), ('tr', 'Turkish'), ('es', > 'Spanish')) > class ShortDescription(models.Model): > strings = dict() > product = models.ForeignKey(Product) > for language in LANGUAGE_OPTIONS: > strings[language[0]] = models.CharField(max_length=300)
Nope, this won't work - not that way at least. And I won't tell you how this _could_ be made to work, because AFAICT, it's a a very wrong design anyway. If what you want is to have per-language description of a same product, better do it the right way (wrt/ the relational model), that is using one record per product/language, ie: LANGUAGE_OPTIONS = (('en_GB', '(British) English'), ('tr', 'Turkish'), ('es', 'Spanish')) class ShortDescription(models.Model): product = models.ForeignKey(Product) language = models.CharField(choices=LANGUAGE_OPTIONS, max_length=4) text = models.TextField() 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 -~----------~----~----~----~------~----~------~--~---