Add your custom urls before the admin include urls directive:
urlpatterns += patterns('',
    (r'^admin/myview/$', 'your_admin_view'),
    (r'^admin/', include(admin.site.urls)),
    ...

and continue working as usual. Django will go through the urls in descending
order matching your custom url before loading all the other admin urls.

Rgds,
Marcos


On Sat, Dec 11, 2010 at 1:33 PM, William Grzybowski <willia...@gmail.com>wrote:

> Hello,
>
> I am trying to extend AdminSite so I can provide custom views, so far
> i have this:
>
> class MyAdminSite(AdminSite):
>
>    def get_urls(self):
>        urls = super(self.__class__, self).get_urls()
>        my_urls = patterns('',
>            (r'^myview/$', self.admin_view(myview))
>        )
>        return my_urls + urls
>
> myadmin = MyAdminSite()
>
> admpattern = patterns('', (r'^admin/', include(myadmin.urls)),)
>
> It works fine, except for one reason. I don't get any ModelAdmin
> registered in this admin, because all external apps register it doing
> admin.site.register().
>
> I figured out do add the registered models from site instance to
> myadmin through:
> myadmin._registry = site._registry
>
> But it doesn't feel right.
>
> Anyone with experience in this could point me out to the most correct
> answer for this problem?
>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to