Поля доступа Django admin в TabularInLine - PullRequest
0 голосов
/ 24 января 2020

У меня есть модель со связью ManyToMany, использующая таблицу по умолчанию:

class Foo(models.Model):

    bool = models.BooleanField(
        default=True,
    )

    bars = models.ManyToManyField(
        to='Bar',
        related_name='bars',
    )


class Bar(models.Model):
    bool = models.BooleanField(
        default=True,
    )

как получить доступ к полям bools в Foo и Bar в TabularInLine в Django admin ie.

class BarInline(admin.TabularInline):
    model = Foo.bars.through
    fields = [Foo.bool, Bar.bool, ]
...