Opened 9 months ago

Last modified 9 months ago

#35337 closed Bug

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

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 = [
        ('licitacion__date', admin.DateFieldListFilter),
        ('licitacion__FechaCierre', admin.DateFieldListFilter),
        'licitacion__CodigoEstado',
        'active',
        'licitacion_detalle__CodigoTipo',
        'licitacion_detalle__Tipo',
        'licitacion_detalle__TipoConvocatoria',
        'licitacion_detalle__CodigoTipo']

    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 (4)

by dz, 9 months ago

Attachment: error.txt added

error trace

comment:1 by dz, 9 months ago

Description: modified (diff)

comment:2 by dz, 9 months ago

Description: modified (diff)

comment:3 by dz, 9 months ago

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