Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#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)

Change History (2)

comment:1 Changed 5 years ago by Russell Keith-Magee

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: invalid
Status: newclosed

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):
    pass

If I've missed something here, feel free to reopen and elaborate on what it is you're trying to achieve.

comment:2 Changed 5 years ago by Jacob

milestone: 1.4

Milestone 1.4 deleted

Note: See TracTickets for help on using tickets.
Back to Top