On Sep 16, 4:11 pm, matehat <mathieu.damo...@gmail.com> wrote:
> Hi,
>
> If the url only depends on the object's id (which I suppose don't
> change with time),

The only problem is, it doesn't :-) We'd like to be able to handle
redirects.
E.g. category "wine" is renamed to "wines", but we still want to be
able to redirect bots and whatnot from old url to the new one. 404 is
just bad for SEO.

 you should not have it put in the database at
> first, because the object's id alone takes care of its persistence.
> Then, plugging it into Django's url resolving mechanism becomes really
> easy with the well-documented "get_absolute_url()" model method and
> the "permalink" decorator, for instance.

Thanks, I didn't know about that, will look into it. Can it also
handle the above-mentioned redirects?

>
> Also, if you want better advices on how to fit your database model
> into django's url resolving mechanism, you should post a question
> (together with more details) onto the django-users group.

Sorry about that, I only noticed later that there is a -users group :-
(

>
> Mathieu
>
> On 16 sep, 07:07, twold <marek.ber...@gmail.com> wrote:
>
> > Hello,
> > I am having little difficulties with django url system and I hope
> > someone can clear it up. Here's what I want to achieve: we're going to
> > have a tree-based catalog in our app and we'd like to index it like
> > this: name1/name2/name3/... I've created a database lookup table url <-> id 
> > with urls being automatically generated at catalog save time. Now
>
> > I would like to plug this in django url resolving process (first I put
> > in view to which I passed whole path, but that is simply wrong for a
> > couple of reasons). Also, I don't want to completely replace
> > RegexURLResolver, because other parts of our site will be using it. So
> > what I'd like would probably be some refactoring of the resolvers. For
> > the time being I subclassed RegexURLPattern and implemented custom
> > resolve method -- it is hacky, but works straight away when I put my
> > subclass in url_patterns. The problem is, there seems to be no easy
> > way, to make reverse work. I was thinking about all of it a lot, also
> > googling a lot and I found no answers. So I wonder: what's the best
> > way to make database URL resolving play nicely with the default regex
> > resolving? Is there any way at all?
>
> > With regards,
> > Marek Bernat
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to