#32330: Inheritance for already existing models will throw an exception
----------------------------------+--------------------------------------
     Reporter:  Vadim Fabrichnov  |                    Owner:  nobody
         Type:  Bug               |                   Status:  closed
    Component:  Migrations        |                  Version:  3.1
     Severity:  Normal            |               Resolution:  worksforme
     Keywords:                    |             Triage Stage:  Unreviewed
    Has patch:  0                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => worksforme


Comment:

 Replying to [ticket:32330 Vadim Fabrichnov]:
 > You will get an exception:
 >
 > {{{
 > django.core.exceptions.FieldError: Local field 'id' in class 'B' clashes
 with field of the same name from base class 'A'.
 > }}}

 I cannot reproduce this issue,  after changing inheritance
 `makemigrations` creates (as expected) two operations:

 - `Remove field id from b`
 - `Add field a_ptr to b`

 > btw, if you have more than one model in bases, you will get the error
 also, even if it's a freshly created model.

 This is a [https://docs.djangoproject.com/en/3.1/topics/db/models
 /#multiple-inheritance documented behavior].

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32330#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.ae6be82b0b5419450e233f45f76d537b%40djangoproject.com.

Reply via email to