Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 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)

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 3 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.