[Django] #35580: System check fields.E300 does not allow for related fields involving auto_created through models.

14 views
Skip to first unread message

Django

unread,
Jul 5, 2024, 3:26:49 PM7/5/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: brucejwb | Type: Bug
Status: new | Component: Database
| layer (models, ORM)
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
The model system checks will raise the fields.E300 error if you make an
auto_created through model the target of a related field. Here is an
example of models that will trigger this error:


{{{
class E300TestModelA(models.Model):
pass

class E300TestModelB(models.Model):
many_to_many_rel = models.ManyToManyField(E300TestModelA)

class E300TestModelC(models.Model):
one_to_one_rel =
models.OneToOneField("check_framework.E300TestModelB_many_to_many_rel",
on_delete=models.CASCADE)
}}}


I realize this might be an unusual thing to do, however I have a use case
that requires this and thought I would create this ticket in case others
agree that this should be changed. I will create a pull request shortly.
--
Ticket URL: <https://code.djangoproject.com/ticket/35580>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 5, 2024, 3:28:20 PM7/5/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: brucejwb | Owner: brucejwb
Type: Bug | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by brucejwb):

* owner: (none) => brucejwb
* status: new => assigned

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

Django

unread,
Jul 5, 2024, 3:35:44 PM7/5/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: brucejwb | Owner: brucejwb
Type: Bug | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by brucejwb):

* has_patch: 0 => 1

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

Django

unread,
Jul 5, 2024, 3:40:29 PM7/5/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: brucejwb | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by brucejwb):

* owner: brucejwb => (none)
* status: assigned => new

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

Django

unread,
Jul 5, 2024, 3:43:15 PM7/5/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: brucejwb | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by brucejwb):

I created a pull request with a fix for the bug and a regression test.
--
Ticket URL: <https://code.djangoproject.com/ticket/35580#comment:4>

Django

unread,
Jul 8, 2024, 12:13:04 PM7/8/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: Jason Bruce | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* cc: Simon Charette (added)
* stage: Unreviewed => Accepted

Comment:

Thank you for the report and patch
--
Ticket URL: <https://code.djangoproject.com/ticket/35580#comment:5>

Django

unread,
Jul 8, 2024, 12:15:52 PM7/8/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: Jason Bruce | Owner: Jason
| Bruce
Type: Bug | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1
* owner: (none) => Jason Bruce
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35580#comment:6>

Django

unread,
Jul 8, 2024, 6:37:09 PM7/8/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: Jason Bruce | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jason Bruce):

* needs_better_patch: 1 => 0
* owner: Jason Bruce => (none)
* status: assigned => new

Comment:

I updated my pr. Please let me know if there is anything else I can
improve.
--
Ticket URL: <https://code.djangoproject.com/ticket/35580#comment:7>

Django

unread,
Jul 8, 2024, 9:52:00 PM7/8/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: Jason Bruce | Owner: Jason
| Bruce
Type: Bug | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* owner: (none) => Jason Bruce
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35580#comment:8>

Django

unread,
Jul 9, 2024, 2:42:53 AM7/9/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: Jason Bruce | Owner: Jason
| Bruce
Type: Bug | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/35580#comment:9>

Django

unread,
Jul 9, 2024, 7:50:22 AM7/9/24
to django-...@googlegroups.com
#35580: System check fields.E300 does not allow for related fields involving
auto_created through models.
-------------------------------------+-------------------------------------
Reporter: Jason Bruce | Owner: Jason
| Bruce
Type: Bug | Status: closed
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"af84bcc8d1b129bd2dc35fae6bb42a175143661f" af84bcc8]:
{{{#!CommitTicketReference repository=""
revision="af84bcc8d1b129bd2dc35fae6bb42a175143661f"
Fixed #35580 -- Allowed related fields referencing auto-created through
models.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35580#comment:10>
Reply all
Reply to author
Forward
0 new messages