﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
187	Uknown error with ordering in the admin interface	Moof <moof@…>	Adrian Holovaty	"I've defined the following model:

{{{
#!python
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:

{{{
#!python
>>> 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'
>>> 
}}}"	defect	closed	contrib.admin	1.0	normal	fixed			Ready for checkin	0	0	0	0	0	0
