On 5 oct, 11:30, Erik Allik <[EMAIL PROTECTED]> wrote:
>
> what if I did the from django.core.urlresolvers import reverse part in
> the function itself that gets called?
>
> def my_flatpage_url(o):
>from django.core.urlresolvers import reverse
>return '%s%s' % (reverse('my-site-index'), o.
Small postscript to the above:
On 21 August, Jannis Leidel (http://jannisleidel.com/) posted that he
was using something like Erik's code:
from django.core.urlresolvers import reverse
ABSOLUTE_URL_OVERRIDES = {
'coltrane.entry': lambda o: reverse('coltrane_entry_detail',
kwargs={
Malcolm,
Thanks, your explanation is clear for me and I certainly don't need to
live dangerously - the conventional usage of ABSOLUTE_URL_OVERRIDES
works fine for me. I was only trying to satisfy my curiosity about
using reverse() because I've read a number of posts from James Bennett
and others s
Malcolm,
what if I did the from django.core.urlresolvers import reverse part in
the function itself that gets called?
def my_flatpage_url(o):
from django.core.urlresolvers import reverse
return '%s%s' % (reverse('my-site-index'), o.url)
ABSOLUTE_URL_OVERRIDES = {
'flatpages.flatpage'
On Sun, 2008-10-05 at 12:30 +0300, Erik Allik wrote:
> Malcolm,
>
> what if I did the from django.core.urlresolvers import reverse part in
> the function itself that gets called?
>
> def my_flatpage_url(o):
>from django.core.urlresolvers import reverse
>return '%s%s' % (reverse('my-si
in Js, "document.URL" has the same function as get_ab_url().
--
真正的杰出,不是妙用规则的错层,而是极致的偏执于信念
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-use
On Sun, 2008-10-05 at 00:50 -0700, John Allen wrote:
> Erik, Malcolm,
>
> Thanks for two very interesting answers - but which one is correct?
> Malcolm, you are saying, in effect, that the code in Erik's post can
> never work in the settings file?
Even if it does work by accident, it would not
Erik, Malcolm,
Thanks for two very interesting answers - but which one is correct?
Malcolm, you are saying, in effect, that the code in Erik's post can
never work in the settings file?
John
--~--~-~--~~~---~--~~
You received this message because you are subscribed
On Sat, 2008-10-04 at 09:42 -0700, John Allen wrote:
[...]
> This works fine but I am wondering: can the function in
> ABSOLUTE_URL_OVERRIDES make use of reverse(), so as to avoid hard-
> coding the "/cms" into the setting?
No, you can't do this. The rule is that you cannot use any pieces of
Dja
from django.core.urlresolvers import reverse
def get_flatpage_absolute_url(o):
return '%s%s' % (reverse('site-index'), o.url)
ABSOLUTE_URL_OVERRIDES = {
'flatpages.flatpage': get_flatpage_absolute_url
}
Actually I think this would work too:
ABSOLUTE_URL_OVERRIDES = {
'flatpag
10 matches
Mail list logo