On May 6, 3:56 pm, Felix <vitramar...@googlemail.com> wrote:
> I have the next models:
>
> class Place(models.Model):
>     currency = models.CharField(_('currency'), max_length=128,
> blank=True, null=True)
>     language = models.CharField(_('official language'),
> max_length=128, blank=True, null=True)
>     class Meta:
>        abstract= True
>
> class Country(Place):
>     country = models.CharField(_('country'), max_length = 100)
>     continent = models.CharField(_('continent'),
> choices=CONTINENT_CHOICES, max_length = 2, blank = True, null=True)
>     president = models.CharField(_('president'), max_length = 100,
> blank = True, null=True)
>
> class City(Place):
>     city = models.CharField(_('city'), max_length=100)
>     country = models.ForeignKey(Country)
>     language = ??
>
> How can I set language of the to the language of its country's
> language by default?
> Thanks for reading

why won't you use non-abstract inheritance? that way all your cities
would inherit all the properties of the respective country instance,
language including

V
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to