Re: Linking to Django Admin from 1.3

2011-07-14 Thread eric.frederich
Nevermind... this was my bad.  I removed (.*) from my urls.py
This is now working... thanks a bunch.

This is what I get for developing an app that works and then not touching it 
for over a year.
I really need to keep up with these things.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/MfVJRaK0OwsJ.
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.



Re: Linking to Django Admin from 1.3

2011-07-14 Thread eric.frederich
Well... two people replied with the same answer so rather than picking 
favorites I'll just reply to myself.

This seems to work but looks a bit quirky.

When I use {% url admin:index %} the link that gets generated actually has 
"admin/(.*)" in it.
This even shows up in the url when I click on it.

Is this okay... is it a bug?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/OfQ60Wy260oJ.
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.



Re: Linking to Django Admin from 1.3

2011-07-14 Thread rebus_
On 14 July 2011 16:35, eric.frederich  wrote:
> Hello,
>
> I am moving from 1.0.2 to 1.3 and am having problems linking to the
> admin site from within a template.
> I used to have this in my template...
>
>    Django Admin
>
> And I used to have this in my urls.py
>
>    url(r'^admin/(.*)'      , admin.site.root, name='the-django-
> admin'),
>
> I'm sure this was hacky even back in 1.0.2
> How should I link to the admin site's index from within a template?
>
> I cannot hard code it to /admin because while this would work on
> development, on production it needs to be /apps/admin
> So I need to use the URL resoving mechanism so that the prefix gets
> picked up based on which environment it is on.
>
> So... simple question.  How do I link to the Django admin site from
> within a template?
>
> Thanks,
> ~Eric
>
> --
> 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.
>

Try:

{% url admin:index %}

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls

-- 
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.



Re: Linking to Django Admin from 1.3

2011-07-14 Thread Alasdair Nicol

From the django docs on url namespaces [1]

Namespaced URLs are specified using the : operator. For example, the 
main index page of the admin application is referenced using 
admin:index. This indicates a namespace of admin, and a named URL of 
index.


So you link to the admin index in your template using:

{% url admin:index %}

For Django 1.3, the documented way [2] to include the admin site is:

*url(r'^admin/', include(admin.site.urls)),*


Regards,
Alasdair Nicol

[1] https://docs.djangoproject.com/en/dev/topics/http/urls/#url-namespaces
[2] https://docs.djangoproject.com/en/1.3/intro/tutorial02/


On 14/07/11 15:35, eric.frederich wrote:

Hello,

I am moving from 1.0.2 to 1.3 and am having problems linking to the
admin site from within a template.
I used to have this in my template...

 Django Admin

And I used to have this in my urls.py

 url(r'^admin/(.*)'  , admin.site.root, name='the-django-
admin'),

I'm sure this was hacky even back in 1.0.2
How should I link to the admin site's index from within a template?

I cannot hard code it to /admin because while this would work on
development, on production it needs to be /apps/admin
So I need to use the URL resoving mechanism so that the prefix gets
picked up based on which environment it is on.

So... simple question.  How do I link to the Django admin site from
within a template?

Thanks,
~Eric




--
Alasdair Nicol
Developer, MEMSET

mail: alasd...@memset.com
 web: http://www.memset.com/

Memset Ltd., registration number 4504980. 25 Frederick Sanger Road, Guildford, 
Surrey, GU2 7YD, UK.

--
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.



Linking to Django Admin from 1.3

2011-07-14 Thread eric.frederich
Hello,

I am moving from 1.0.2 to 1.3 and am having problems linking to the
admin site from within a template.
I used to have this in my template...

Django Admin

And I used to have this in my urls.py

url(r'^admin/(.*)'  , admin.site.root, name='the-django-
admin'),

I'm sure this was hacky even back in 1.0.2
How should I link to the admin site's index from within a template?

I cannot hard code it to /admin because while this would work on
development, on production it needs to be /apps/admin
So I need to use the URL resoving mechanism so that the prefix gets
picked up based on which environment it is on.

So... simple question.  How do I link to the Django admin site from
within a template?

Thanks,
~Eric

-- 
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.