I'm using the current trunk version and I have a similar issue with
the reverse function:

- I defined a get_urls() method for one of my models whose I have
written a custom admin page.
- From my view I try to reverse one of this pattern with the "admin:"
prefix and it works but if I wrap the view callback with
self.admin_site.admin_view() decorator the reverse don't work and I
get a NoReverseMatch error.

Here the used code http://dpaste.com/hold/68763/



On 17 Lug, 23:32, Vasil Vangelovski <vvangelov...@gmail.com> wrote:
> Yeah, I was confused mostly about the stuff with the colon because I
> didn't pay much attention when reading about namespaced urls the new
> docs.
>
> Thanks
>
> On Fri, Jul 17, 2009 at 10:49 PM, Michael<newmani...@gmail.com> wrote:
> > On Fri, Jul 17, 2009 at 4:27 PM, Vasil Vangelovski <vvangelov...@gmail.com>
> > wrote:
>
> >> Sorry, it was probably my missunderstanding of some details in the
> >> docs. I changed the initialization of my admin site so it doesn't have
> >> a name and what I was trying to do works now. But anyway, if my admin
> >> site was initialized like so site = MyAdminSite('admin') what code is
> >> supposed to give me the url for it's index page?
>
> >> On Fri, Jul 17, 2009 at 9:48 PM, Vasil
> >> Vangelovski<vvangelov...@gmail.com> wrote:
> >> > Yes it does work, I've tried this with a brand new project in the same
> >> > virtualenv. Reverese resolution of urls for the AdminSite in
> >> > django.contrib.admin does work with the latest trunk revision.
> >> > Here's simplest situation where I'm having a problem:
>
> >> > I have an app called admin in my project which contains some
> >> > templatetags and a subcalss of AdminSite, you can see the relevant
> >> > code in this dpaste:
> >> >http://dpaste.com/68309/
> >> > The shell interaction is here:
> >> >http://dpaste.com/68303/
> >> > Note in my installed apps I have both my admin application and the
> >> > admin app from django.contrib.
> >> > The same shell interaction would work without a problem if I try it in
> >> > another project where I use just django.contrib.admin.sites.AdminSite
> >> > Note that changing the url regex for the admin from empty to
> >> > r'^admin/' doesn't change anything, it's like that because the django
> >> > project
> >> > is just an admin site for a larger project done in Java/Flex.
> >> > Thanks.
>
> > Tryreverse('admin:index ')
> > The colon is the new namespaces that were just added to the django
> > urlresolvers. Pretty exciting, huh?
> > FYI the admin uses 'admin' as the default app instance. I am not sure what
> > this will do if you have two apps that are named the same and try to
> >reverse. It might just be unpredictable as to which URL is going to be
> > returned or might throw an error. I am not sure. You might want to change
> > that to something else.
> > Hope that helps,
> > Michael
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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