[Django] #32731: makemigrations reports "No changes detected" if a property exists with the same name

19 views
Skip to first unread message

Django

unread,
May 9, 2021, 5:52:21 PM5/9/21
to django-...@googlegroups.com
#32731: makemigrations reports "No changes detected" if a property exists with the
same name
-----------------------------------------+--------------------------
Reporter: jej | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 3.2
Severity: Normal | Keywords: annoying
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+--------------------------
I turned around few time trying to add a new field in my model (FK).
makemigrations reported "No changes detected". I dropped the database and
after migrations files cleanup, the field was still not created. The
reason was I had a @property method with the same name in the model.
Logically I wanted to replace this calculated field by a db field, but
didn't think about to check it was here already as a property.

I would prefer that django report the problem when two properties are
conflicting or may conflict in case the field is created.

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

Django

unread,
May 10, 2021, 1:05:21 AM5/10/21
to django-...@googlegroups.com
#32731: makemigrations reports "No changes detected" if a property exists with the
same name
-------------------------------+--------------------------------------
Reporter: Jej | Owner: nobody
Type: Uncategorized | Status: closed
Component: Migrations | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: annoying | 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: => invalid


Comment:

I don't think there is much Django can do in such cases. It's an issue in
your code.

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

Django

unread,
May 10, 2021, 1:38:30 PM5/10/21
to django-...@googlegroups.com
#32731: makemigrations reports "No changes detected" if a property exists with the
same name
-------------------------------+--------------------------------------
Reporter: Jej | Owner: nobody
Type: Uncategorized | Status: closed
Component: Migrations | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: annoying | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Jej):

Of course it's an issue in my code. But django warn about a lot of issues
in user code. Why not this one and just silently does nothing?!!

--
Ticket URL: <https://code.djangoproject.com/ticket/32731#comment:2>

Django

unread,
May 10, 2021, 1:40:20 PM5/10/21
to django-...@googlegroups.com
#32731: makemigrations reports "No changes detected" if a property exists with the
same field name
-------------------------------+--------------------------------------
Reporter: Jej | Owner: nobody
Type: Uncategorized | Status: closed
Component: Migrations | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: annoying | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/32731#comment:3>

Django

unread,
May 10, 2021, 2:29:38 PM5/10/21
to django-...@googlegroups.com
#32731: makemigrations reports "No changes detected" if a property exists with the
same field name
-------------------------------+--------------------------------------
Reporter: Jej | Owner: nobody
Type: Uncategorized | Status: closed
Component: Migrations | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: annoying | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:2 Jej]:
> Django warn about a lot of issues in user code. Why not this one and
just silently does nothing? Why a field in the model would be ignored
without notice?

Because you override it in your own code, so it's not a model field
anymore. I'm happy to review a patch if you know how to check easily that
a property overrides a model field in the same class.

--
Ticket URL: <https://code.djangoproject.com/ticket/32731#comment:4>

Django

unread,
May 11, 2021, 10:18:51 AM5/11/21
to django-...@googlegroups.com
#32731: makemigrations reports "No changes detected" if a property exists with the
same field name
-------------------------------+--------------------------------------
Reporter: Jej | Owner: nobody
Type: Uncategorized | Status: closed
Component: Migrations | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: annoying | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Jej):

Ok. Thanks for the explanation of the underlaying.

--
Ticket URL: <https://code.djangoproject.com/ticket/32731#comment:5>

Reply all
Reply to author
Forward
0 new messages