[Django] #29993: Bug trying to add two fields with the same name in two models

2 views
Skip to first unread message

Django

unread,
Nov 28, 2018, 11:28:36 AM11/28/18
to django-...@googlegroups.com
#29993: Bug trying to add two fields with the same name in two models
----------------------------------------------+------------------------
Reporter: César García Tapia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------------+------------------------
We have two models in the same application:

{{{
class ModelA(models.Model):
one_field = models.CharField(...)

class ModelB(models.Model):
another_field = models.CharField(...)
}}}

If we try to add a new field to both of them with the same name (doesn't
have to be of the same type), makemigrations only detects one of them:

{{{
class ModelA(models.Model):
one_field = models.CharField(...)
repeated_field = models.CharField(...)

class ModelB(models.Model):
another_field = models.CharField(...)
repeated_field = models.BooleanField()
}}}

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

Django

unread,
Nov 28, 2018, 11:35:34 AM11/28/18
to django-...@googlegroups.com
#29993: Bug trying to add two fields with the same name in two models
------------------------------------+--------------------------------------

Reporter: César García Tapia | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 2.0
Severity: Normal | Resolution: invalid

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 César García Tapia):

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


Comment:

I'm sorry, it was my fault, not django's. I had a @property in the model
with the same name, and that's why it wasn't detected by makemigrations.

Sorry for the noise. :-(

--
Ticket URL: <https://code.djangoproject.com/ticket/29993#comment:1>

Reply all
Reply to author
Forward
0 new messages