Use admin.autodiscover() by default?

191 views
Skip to first unread message

James Bennett

unread,
Jul 19, 2008, 4:08:02 AM7/19/08
to django-d...@googlegroups.com
As of the newforms-admin merge, the IRC channel is seeing a sudden
rush of folks who try the tutorial and complain because the admin
doesn't work. And they're right, because as written the tutorial sets
up the admin in such a way that it's never aware of any models being
registered -- including the contrib models that already have admin
classes.

Adding 'admin.autodiscover()' to the project's root URLConf fixes
this; normally I'd just check in a quick change to the tutorial to
indicate that this should happen, but it feels to me like the right
thing to do here is instead tweak the project template so that line is
in the default URLConf (but commented out like the rest of the admin
stuff), at which point the tutorial can simply stay as-is.

Thoughts?


--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

Valts Mazurs

unread,
Jul 19, 2008, 4:41:08 AM7/19/08
to django-d...@googlegroups.com

+1 As this would remove unneccessary frustration.

Regards,
Valts.

Russell Keith-Magee

unread,
Jul 19, 2008, 8:06:49 AM7/19/08
to django-d...@googlegroups.com
On Sat, Jul 19, 2008 at 4:08 PM, James Bennett <ubern...@gmail.com> wrote:
>
> Adding 'admin.autodiscover()' to the project's root URLConf fixes
> this; normally I'd just check in a quick change to the tutorial to
> indicate that this should happen, but it feels to me like the right
> thing to do here is instead tweak the project template so that line is
> in the default URLConf (but commented out like the rest of the admin
> stuff), at which point the tutorial can simply stay as-is.

I agree that this is something that should be in the project template.
However, we can't completely avoid changes to the tutorial text - the
text about what needs to be uncommented will need to be tweaked
slightly. A quick explanation in tutorial 3 of the purpose of the
admin.autodiscover() would also be appropriate, IMHO.

Russ %-)

Jacob Kaplan-Moss

unread,
Jul 19, 2008, 8:45:03 AM7/19/08
to django-d...@googlegroups.com
On Sat, Jul 19, 2008 at 3:08 AM, James Bennett <ubern...@gmail.com> wrote:
> Adding 'admin.autodiscover()' to the project's root URLConf fixes
> this; normally I'd just check in a quick change to the tutorial to
> indicate that this should happen, but it feels to me like the right
> thing to do here is instead tweak the project template so that line is
> in the default URLConf (but commented out like the rest of the admin
> stuff), at which point the tutorial can simply stay as-is.

We should do both -- many of these questions (especially early on) are
going to be from people who're upgrading instead of starting anew (the
dynamic might shift after 1.0 final).

Jacob

Karen Tracey

unread,
Jul 19, 2008, 9:32:35 AM7/19/08
to django-d...@googlegroups.com

FYI there was a ticket opened last night that suggests both of these:

http://code.djangoproject.com/ticket/7824

Karen

 

Brian Rosner

unread,
Jul 19, 2008, 9:49:23 AM7/19/08
to django-d...@googlegroups.com

On Jul 19, 2008, at 2:08 AM, James Bennett wrote:

> Adding 'admin.autodiscover()' to the project's root URLConf fixes
> this; normally I'd just check in a quick change to the tutorial to
> indicate that this should happen, but it feels to me like the right
> thing to do here is instead tweak the project template so that line is
> in the default URLConf (but commented out like the rest of the admin
> stuff), at which point the tutorial can simply stay as-is.
>
> Thoughts?

Yeah, I agree that this should be done. I originally took the stance
that it might be an uncommon thing since most people might want a
custom AdminSite instance, and boy was I wrong ;)

Tweaking the tutorial would be a good idea too. Give a bit of
information about it would be a good thing.

Brian Rosner
http://oebfare.com

Reply all
Reply to author
Forward
0 new messages