The following simple model gives me an error message if the list_filter
line is present in the class CompoundOptions?.
If it's not present and any of the other out-comments lines are, the admin
site works as expected.
# Create your models here.
from django.db import models
class Compound(models.Model):
'''
Compounds
'''
name = models.CharField(maxlength=20,unique=True,null=True)
from django.contrib import admin
class CompoundOptions(admin.ModelAdmin):
#list_select_related = True
#list_display = ('name',)
list_filter = ('name',)
#list_per_page = 25
admin.site.register(Compound,CompoundOptions)
---
I get the following error message:
AttributeError at /xxx/admin/qqq/compound/
'NoneType' object has no attribute 'manager'
Request Method: GET
Request URL: https://fwnc7122.wks.gorlaeus.net/zbdb/admin/qqq/compound/
Exception Type: AttributeError
Exception Value: 'NoneType' object has no attribute 'manager'
Exception Location: /usr/lib/python2.3/site-packages/django/contrib/admin/filterspecs.py in __init__, line 161
Python Executable: /usr/bin/python
Python Version: 2.3.4
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/django/core/handlers/base.py" in get_response
77. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.3/site-packages/django/contrib/admin/sites.py" in root
123. return self.model_page(request, *url.split('/', 2))
File "/usr/lib/python2.3/site-packages/django/contrib/admin/sites.py" in model_page
140. return admin_obj(request, rest_of_url)
File "/usr/lib/python2.3/site-packages/django/contrib/admin/options.py" in __call__
210. return self.changelist_view(request)
File "/usr/lib/python2.3/site-packages/django/contrib/admin/options.py" in changelist_view
589. self.date_hierarchy, self.search_fields, self.list_select_related, self.list_per_page, self)
File "/usr/lib/python2.3/site-packages/django/contrib/admin/views/main.py" in __init__
263. self.filter_specs, self.has_filters = self.get_filters(request)
File "/usr/lib/python2.3/site-packages/django/contrib/admin/views/main.py" in get_filters
271. spec = FilterSpec.create(f, request, self.params, self.model)
File "/usr/lib/python2.3/site-packages/django/contrib/admin/filterspecs.py" in create
25. return factory(f, request, params, model)
File "/usr/lib/python2.3/site-packages/django/contrib/admin/filterspecs.py" in __init__
161. self.lookup_choices = model._meta.admin.manager.distinct().order_by(f.name).values(f.name)
AttributeError at /zbdb/admin/qqq/compound/
'NoneType' object has no attribute 'manager'
If you nee more info please let me know.
Eiso