Hi!
I need a model to complete a combo in my app. The models have only code and
name, but I need to translate this name.
I think about do something similar to this:
class ComboFill(models.Model):
code = models.CharField...
language = models.CharField...
name = models.CharField...
And after this filter by language, but I think that it's not the best way to
do that, or is it?
Anyway I have a model Languages defines as this:
class Language(models.Model):
code = models.CharField(max_length=12, primary_key=True, blank=False,
help_text=_('Example: en, es...'))
name = models.CharField(max_length=64, blank=False, help_text=_('The
real name.'))
Can I accept only codes defined in Language model? Because I can use a
ForeignField as this:
class ComboFill(models.Model):
code = models.CharField...
language = models.ForeignField(Language)
name = models.CharField...
But If I do that I need to retrieve the entire object language to push it in
ComboFill model. I like to wirte only, for example, 'es' as the code and if
it's in the Language model ok, otherway error. I can do it overriding the
save() method but it's a good way?
Thanks! And excuse my english :p
--
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.