#34345: filter_horizontal and filter_vertical don't work with through
-------------------------------------+-------------------------------------
Reporter: David Pratten | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 4.1
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
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* keywords: Gotcha =>
* type: Bug => Cleanup/optimization
* easy: 1 => 0
Comment:
> Neither of
>
> -
https://docs.djangoproject.com/en/4.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.filter_horizontal
and
> -
https://docs.djangoproject.com/en/4.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.filter_vertical
>
> call out the requirement to **not** use
> {{{
> ManyToManyField(through="")
> }}}
There is a separate section in the same docs that describes
[https://docs.djangoproject.com/en/stable/ref/contrib/admin/#working-with-
many-to-many-intermediary-models Working with many-to-many intermediary
models]. I don't think it is necessary to cross-refer this section in all
places where `ManyToManyField` is mentioned.
> In the same way:
> -
https://docs.djangoproject.com/en/4.1/ref/models/fields/#django.db.models.ManyToManyField.through
>
> doesn't call out the consequence that filter_horizontal and
filter_vertical will stop working if one goes down the pathway of:
>
> {{{
> ManyToManyField(through="")
> }}}
Models docs are not the right place to describe how contrib apps work.
-----
What do you think about changing `admin.E020` to:
> "The value of `filter_vertical[n]/filter_horizontal[n]` must be a many-
to-many field without a `through` model.
and raising a system check in this case?
--
Ticket URL: <https://code.djangoproject.com/ticket/34345#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701865dd5c7fe-5a2bf61d-bc66-4675-989f-34d87f06216b-000000%40eu-central-1.amazonses.com.