Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
Django DisallowedModelAdminLookup for lookup in Admin list_filter

I have a Member model and an Organization model, joined via a PrincipleMembership model. PrincipleMembership has ForeignKey fields for Member and Organization.

I create MemberAdmin with the line list_filter = ['principlemembership__organization__type', ], the filter renders perfectly, but clicking on it produces the DisallowedModelAdminLookup exception.

I can fix it by overriding ModelAdmin.Lookup_allowed to permit principlemembership__organization__type__exact, but is this a bug in Django? I'm on Python 3.5.3 and Django 1.10.

I have tried adding filters on organization.type to OrganizationAdmin and PrincipleMembershipAdmin, both of which work. I do not use a many to many join as I have other data on PrincipleMembership, such as From and To dates. I have tried making the filter explicitly a admin.ChoicesFieldListFilter. I have tried removing everything else from MemberAdmin except list_filter = ['principlemembership__organization__type', ]. I have tried a filter on a simple Char field on Organization and get the same error.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Looks like it was a bug, fixed in 1.11.3. See the change in this commit: https://github.com/django/django/commit/834d57b4de80e525195128c88592e0e076708a23

The 1.11.3 release notes have a link to the ticket.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda