Re: [Django] #33813: Incorrect queryset for the 'id' field in the InlineModels' forms for django.cotrib.admin when using custom model managers

3 views
Skip to first unread message

Django

unread,
Jun 29, 2022, 5:56:06 AM6/29/22
to django-...@googlegroups.com
#33813: Incorrect queryset for the 'id' field in the InlineModels' forms for
django.cotrib.admin when using custom model managers
-------------------------------------+-------------------------------------
Reporter: Hristo Trendafilov | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version:
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
admin,inlines,custom model | Unreviewed
manager |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

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


Comment:

This is a duplicate of #33375 — in
[https://github.com/django/django/blob/33401cba9317de2487c31ffdd1a5a51ecfbc0248/django/forms/models.py#L859-L862
BaseModelFormSet.add_fields()] we add the `id` `ModelChoiceField` using
the default manager.

You'll need to provide the
[https://docs.djangoproject.com/en/4.0/ref/contrib/admin
/#inlinemodeladmin-options inline's `form` option] to provide the base
form class declaring the `id` `ModelChoiceField` with the correct (for
your case) QuerySet.

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

Reply all
Reply to author
Forward
0 new messages