'NoneType' object has no attribute '__getitem__'
peppelinux opened this issue · comments
'NoneType' object has no attribute 'getitem'
in
dal/widgets.py in render, line 130
class OlaGruppoDiStudioFilter(AutocompleteFilter):
title = 'Gruppo di studio'
parameter_name = 'ola_gruppo_di_studio'
autocomplete_url = 'ola_gruppo-autocomplete'
class OlaGruppoDiStudioAutocomplete(autocomplete.Select2QuerySetView):
def get_queryset(self):
if not self.request.user.is_authenticated():
return OlaGruppoDiStudio.objects.none()
qs = OlaGruppoDiStudio.objects.all()
if self.q:
qs = qs.filter(
Q(nome__istartswith=self.q) |
Q(ola_instructor__cognome__istartswith=self.q)|
Q(ola_instructor__nome__istartswith=self.q)
)
return qs.order_by('nome')
I tested it in two different apps, with two different models schema and parameter name.
Is it caused by some Null value in FK ?
If any news please let me know, I'd like to use this django app widely in my projects
Please show your code of dal/widgets.py at line 130.
dal/widgets.py from line 127 to line 131:
def render(self, name, value, attrs=None):
"""Calling Django render together with `render_forward_conf`."""
widget = super(WidgetMixin, self).render(name, value, attrs)
conf = self.render_forward_conf(attrs['id'])
return mark_safe(widget + conf)
attrs is None and exception is raised
I can't reproduce this error.
Can you fork this repository and make changes into demo_project to make this bug appear there?
Yeah, error with some dependencies, now everything works fine.
The problem occours with django-autocomplete-light-3.2.1
Thanks for report.
I'll check compatibility with newest django and django-autocomplete-light versions.