Opened 5 years ago

Closed 5 years ago

#29993 closed Bug (invalid)

Bug trying to add two fields with the same name in two models

Reported by: César García Tapia Owned by: nobody
Component: Migrations Version: 2.0
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

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

Change History (1)

comment:1 by César García Tapia, 5 years ago

Resolution: invalid
Status: newclosed

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. :-(

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