[Django] #33823: Inspectdb add related_name on same relation link

8 views
Skip to first unread message

Django

unread,
Jul 4, 2022, 10:07:43 AM7/4/22
to django-...@googlegroups.com
#33823: Inspectdb add related_name on same relation link
-------------------------------------+-------------------------------------
Reporter: whysage | Owner: nobody
Type: | Status: new
Uncategorized |
Component: Core | Version: 4.0
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Hi!

After models generation with inspectdb command we have issue with
relations to same enities

****
module.Model.field1: (fields.E304) Reverse accessor for
'module.Model.field1' clashes with reverse accessor for
'module.Model.field2'.
HINT: Add or change a related_name argument to the definition for
'module.Model.field1' or 'module.Model.field2'.
*******

Maybe we can autogenerate

related_name='attribute_name'

to all fields in model if related Model was used for this table

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

Django

unread,
Jul 4, 2022, 10:33:53 AM7/4/22
to django-...@googlegroups.com
#33823: Inspectdb add related_name on same relation link
-------------------------------------+-------------------------------------
Reporter: whysage | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by whysage):

Pull request

https://github.com/django/django/pull/15816

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

Django

unread,
Jul 4, 2022, 2:30:27 PM7/4/22
to django-...@googlegroups.com
#33823: Inspectdb add related_name on same relation link
-------------------------------------+-------------------------------------
Reporter: whysage | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by whysage):

Updated solution
https://github.com/django/django/pull/15819

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

Django

unread,
Jul 5, 2022, 12:10:24 AM7/5/22
to django-...@googlegroups.com
#33823: Inspectdb add related_name on same relation link
-------------------------------------+-------------------------------------
Reporter: whysage | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: 4.0
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by whysage):

* has_patch: 0 => 1


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

Reply all
Reply to author
Forward
0 new messages