django-taggit filter by tags - 'NoneType' object has no attribute '_meta'

Issue #1 invalid
created an issue

When trying to add a filter for a django-taggit TaggableManager() field the 'through' many to many relationship is not being populated properly.

In line 357:

{{{through = self.field_obj.rel.through}}}

through is being set to None. The error then occurs on line 362:

{{{fkey_to_this_table = [f for f in through._meta.fields}}}

// Caught AttributeError while rendering: 'NoneType' object has no attribute '_meta'//

I'm new to Django so I"m not sure if this is an issue with the TaggableManager implementation or if something else is causing it. Any help would be appreciated.

Comments (4)

  1. Luke Plant repo owner

    At the moment django-easyfilters only supports built in field types (or fields that have the same interface as the built-in types). It also assumes models will look the way they do in Django 1.3, so it assumes the 'through' attribute for many-to-many fields.

    Looking here:

    it is difficult to see how 'through' could ever be 'None'. Perhaps you are using an older version? I don't know if it will work with a more modern version, because I haven't got any support for GenericForeignKey yet, but it might.

    I don't know django-taggit, but it looks to me that a 'TaggableManager' is not a field at all, but a Manager

  2. MissFilly

    This issue still exists. I'm using Django 1.6.2, django-taggit 0.11.2 and django-easyfilters 0.5, and getting the same error. The problem is that line 383 in assumes that self.field_obj.rel.through, but in this case it doesn't.

    (Pdb) self.field_obj.rel.__dict__
    {'through': None, 'field': <taggit_autosuggest.managers.TaggableManager: tags>, 'limit_choices_to': {}, 'multiple': True, 'symmetrical': True, 'to': <class 'taggit.models.Tag'>, 'related_name': None}
  3. Log in to comment