* 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.