Opened 12 years ago

Closed 12 years ago

#19465 closed Bug (duplicate)

Virtual Base Classes Not Implemented

Reported by: steven_ganz Owned by: nobody
Component: Uncategorized Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This model involving the standard "diamond" multiple inheritance hierarchy:

from django.db import models

class A(models.Model):
    name = models.CharField(max_length=256)
    class Meta:
        abstract = True

class B(A):
    class Meta:
        abstract = True

class C(A):
    class Meta:
        abstract = True

class D(B, C):
    pass

generates the sql:

BEGIN;
CREATE TABLE `teamBuilderWebVersion_d` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(256) NOT NULL,
    `name` varchar(256) NOT NULL
)
;
COMMIT;

which triggers the error:

django.db.utils.DatabaseError: (1060, "Duplicate column name 'name'")

So it seems that although python considers there to be only one instance of a base class inherited twice, django considers there to be two.

Change History (1)

comment:1 by Preston Holmes, 12 years ago

Resolution: duplicate
Status: newclosed

This appears to be a more straightforward version of #15279 as that ticket demonstrated the same bug, but with related fields - your issue demonstrates it is with any field

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