Django-fr

Forum

#1 02-03-2007 09:54:05

Nicolas Steinmetz
Membre
Inscription : 11-08-2010
Messages : 96

Fwd: ABSOLUTE_URL_OVERRIDES issue

Est-ce que l'un d'entre vous aurait une idée ?

--------------- Message transmis (début)

Sujet: ABSOLUTE_URL_OVERRIDES issue
De: Nicolas Steinmetz <nsteinmetz _AT_ gmail.com>
Date: Wed, 28 Feb 2007 09:20:31 +0100
Forums: gmane.comp.python.django.user


Hello,

To use "Cab", I got a path issue and need to override get_absolute_url
defined by James (I would like to avoid to change the models by itself to
keep synchronized with its version).

James set :

    def get_absolute_url(self):
        return "/languages/%s/" % self.slug

Issue is that for the language of the snippets, it points to
http://localhost:8000/languages/python/ instead of
http://localhost:8000/snippets/languages/python/

So James suggests me to use ABSOLUTE_URL_OVERRIDES to solve my issue. So I
read
<http://www.djangoproject.com/documentation/settings/#absolute-url-overrides>
but it lacks some explaination for my python level ;-)

I added the following piece of "code" in settings.py (is it the right
place ?) but it does not work (it looks it's not take into account with
django svn 4643).

ABSOLUTE_URL_OVERRIDES = {
    'cab.Language' : lambda o: "/snippets/languages/%s/" % o.slug,
}

What did I miss ?

Cheers,
Nicolas


--~--~---------~--~----~------------~-------~--~----~
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 _AT_ googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe _AT_ googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---



--------------- Message transmis (fin)

Hors ligne

#2 03-03-2007 23:29:48

Nicolas Steinmetz
Membre
Inscription : 11-08-2010
Messages : 96

Re : Fwd: ABSOLUTE_URL_OVERRIDES issue

Réponse ici :

<
http://www.unelectronlibre.info/index.php/post/2007/03/03/Django-%3A-Surcharger-les-urls-de-vos-applcations
>

bon week end,
Nicolas

2007/3/2, Nicolas Steinmetz <nsteinmetz _AT_ gmail.com>:
>
> Est-ce que l'un d'entre vous aurait une idée ?
>
> --------------- Message transmis (début)
>
> Sujet: ABSOLUTE_URL_OVERRIDES issue
> De: Nicolas Steinmetz <nsteinmetz _AT_ gmail.com>
> Date: Wed, 28 Feb 2007 09:20:31 +0100
> Forums: gmane.comp.python.django.user
>
>
> Hello,
>
> To use "Cab", I got a path issue and need to override get_absolute_url
> defined by James (I would like to avoid to change the models by itself to
> keep synchronized with its version).
>
> James set :
>
>     def get_absolute_url(self):
>         return "/languages/%s/" % self.slug
>
> Issue is that for the language of the snippets, it points to
> http://localhost:8000/languages/python/ instead of
> http://localhost:8000/snippets/languages/python/
>
> So James suggests me to use ABSOLUTE_URL_OVERRIDES to solve my issue. So I
> read
> <
> http://www.djangoproject.com/documentation/settings/#absolute-url-overrides
> >
> but it lacks some explaination for my python level ;-)
>
> I added the following piece of "code" in settings.py (is it the right
> place ?) but it does not work (it looks it's not take into account with
> django svn 4643).
>
> ABSOLUTE_URL_OVERRIDES = {
>     'cab.Language' : lambda o: "/snippets/languages/%s/" % o.slug,
> }
>
> What did I miss ?
>
> Cheers,
> Nicolas
>
>
> --~--~---------~--~----~------------~-------~--~----~
> 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 _AT_ googlegroups.com
> To unsubscribe from this group, send email to
> django-users-unsubscribe _AT_ googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>
>
> --------------- Message transmis (fin)
>
>
>
> _______________________________________________
> django mailing list
> django _AT_ lists.afpy.org
> http://lists.afpy.org/cgi-bin/mailman/listinfo/django
>

Hors ligne

Pied de page des forums