Opened 8 months ago

Last modified 8 months ago

#35337 closed Bug

argument of type 'NoneType' is not iterable, when show facets and change_view is overwritten in ModelAdmin — at Version 2

Reported by: dz Owned by: nobody
Component: contrib.admin Version: 5.0
Severity: Normal Keywords:
Cc: dz Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by dz)

Hello,

Django==5.0.3
@admin.register(LicitacionItem)
class LicitacionItemAdmin(admin.ModelAdmin):

    list_select_related = ('licitacion', 'categoria',
                           'proveedor', 'producto', 'licitacion_detalle')

    raw_id_fields = ('licitacion', 'categoria',
                     'proveedor', 'producto', 'licitacion_detalle')

    search_fields = ["CodigoExterno", 'search']

    show_facets = admin.ShowFacets.ALLOW

    list_filter = [
        ('ordencompra__date', admin.DateFieldListFilter),
        ('ordencompra_detalle__Fechas_FechaCreacion', admin.DateFieldListFilter),
        'ordencompra_detalle__CodigoEstado',
        'ordencompra_detalle__CodigoEstadoProveedor',
        'active',
        ('licitacion', admin.EmptyFieldListFilter),
        ('categoria', admin.EmptyFieldListFilter),
        'ordencompra_detalle__CodigoTipo',
        'ordencompra_detalle__Tipo']

    def change_view(self, request, object_id, extra_context=None):
        self.exclude = ('active', 'analizado', 'touch', 'search')
        return super(LicitacionItemAdmin, self).change_view(request, object_id, extra_context)

when clicking on an item (enter change view), without activating show facets: there are no errors.

when clicking on an item (enter change view), with show facets activated: argument of type 'NoneType' is not iterable (see attached file with the trace)

By completely removing the change_view function, the error does not occur (even if show facets is activated).

Regards


      

Change History (3)

by dz, 8 months ago

Attachment: error.txt added

error trace

comment:1 by dz, 8 months ago

Description: modified (diff)

comment:2 by dz, 8 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top