#187 closed defect (fixed)
Uknown error with ordering in the admin interface
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | 1.0 |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I've defined the following model:
class Blog(meta.Model): fields = ( meta.OneToOneField(Site), #One blog per site meta.CharField('name', maxlength=100, help_text="Blog Title, as shown on the page"), meta.CharField('subtitle', maxlength=500), meta.CharField('titlebarname', "Title Bar Name", maxlength=50, blank=True, help_text="Short name for putting in <title> elements") ) admin = meta.Admin() def __repr__(self): return self.name
When I try to list my blogs by going to http://localhost:8000/admin/blog/blogs/ I always end up with the following error:
There's been an error: Traceback (most recent call last): File "D:\My Documents\Python Sources\Django\django\core\handlers\base.py", line 63, in get_response return callback(request, **param_dict) File "D:\My Documents\Python Sources\Django\django\views\admin\main.py", line 97, in change_list ordering = lookup_opts.admin.ordering or lookup_opts.ordering or ['-' + lookup_opts.pk.name] AttributeError: 'NoneType' object has no attribute 'ordering'
A quick play with the object in the interpreter shows it's working correctly:
>>> from django.models.blog import * >>> b = blogs.get_list() >>> b [My Blog] >>> from django.models.blog import * >>> bs = blogs.get_list() >>> bs [My Blog] >>> b = bs[0] >>> b My Blog >>> b.name 'My Blog' >>> b.id 1 >>> b.subtitle 'Where you find all the news' >>> b.titlebarname ' ' >>> s = b.get_site() >>> s mysite.com >>> s.domain 'mysite.com' >>> s.name 'My Django site' >>>
Change History (3)
comment:1 by , 19 years ago
comment:3 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Please remember that the Trac site isn't for support. Please use the discussion lists: http://groups-beta.google.com/group/django-users or #django on irc.freenode.net