Is it possible for a model to inherit from an abstract model, which in
turn inherits from a non-abstract model?
Here's an example. In this case, the reason for using multi-table
inheritance rather than an explicit one-to-one relation would be that
the office addresses would be editable via office child model inlines
from the Business model's admin screen (i.e. not requiring the
currently-impossible nested inlines.)
Would this work, or blow up in my face (in subtle-or-not ways)?
class Address(models.Model):
line_1 = models.Char_field(max_length=128)
...
class Business(models.Model):
name = models.CharField(max_length=50)
...
class Office(Address):
business = models.ForeignKey(Business, related_name='<something or
other>')
phone = models.CharField(max_length=30)
...
class Meta:
abstract = True
class DataCenter(Office):
bandwidth = models.PositiveIntegerField()
...
class CorporateOffice(Office):
office_manager = models.ForeignKey('Employee')
...
class Employee(models.Model):
employer = models.ForeignKey(Business)
home_address = models.ForeignKey(Address)
--
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.