Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda