Patrick J. Anderson wrote:

        class MyModel(models.Model):
                text_en = TextField()
                text_pt-br = TextField()

Django complains with a SyntaxError: can't assign to operator on
"text_pt-br = TextField()" line

This just what I did in my models, but perhaps there's a clean way to go
about doing it right.

class MyModel(Model):
   text_en = TextField()
   text_pt_br = TextField()

   def get_text(self):
       text_field = "text_%s" %
translation.get_language().replace("-", "_")
       return getattr(self, text_field)

--
Maxime Biais


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to