#16740 closed New feature (invalid)
"Derived Class"
| Reported by: | anonymous | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.3 |
| Severity: | Normal | Keywords: | Derived class, models |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
A feature you can create derived classes.
For example:
Class ClassA(models.Model):
name = models.CharField()
age = models.IntergerField()
class ClassB(models.Model):
serial = models.CharField()
class DerivedClass(models.Model):
class Meta:
derived = (ClassA, ClassB)
name = models.CharField(derived = ClassA, attr = name)
serial = models.CharField(derived = ClassB, attr = serial)
Note:
See TracTickets
for help on using tickets.
It seems to me that you've come up with a very complex notation as an alternative to model inheritance (which is already supported in Django):
class ClassA(models.Model): name = models.CharField() age = models.IntergerField() class ClassB(models.Model): serial = models.CharField() class DerivedClass(ClassA, ClassB): passIf I've missed something here, feel free to reopen and elaborate on what it is you're trying to achieve.