Custom Redirect URL for pages in Wagtail

329 views
Skip to first unread message

sachit adhikari

unread,
Aug 12, 2014, 8:14:32 AM8/12/14
to wag...@googlegroups.com
 

I have a model like this:

from wagtail.wagtailcore.models import Page

class Blog(Page):
    created = models.DateTimeField(auto_now_add=True)
    ...
    ..

Right Now, my default, if my slug is hi-there, the blog post is accessible on site_url:/hi-there/ but I want it accessible via site:url/2014/02/05/hi-there/ The page has various methods like url, url_path which one should I override and what's the best practice to achieve something like this in wagtail?

Chris Moradi

unread,
Aug 12, 2014, 7:47:34 PM8/12/14
to wag...@googlegroups.com
I haven't implemented this, but you should check this post: https://groups.google.com/d/topic/wagtail/mQ73LtBxOTQ/discussion

Hope that helps.
-Chris

sachit adhikari

unread,
Aug 21, 2014, 4:23:09 AM8/21/14
to wag...@googlegroups.com
With Wagtail >= 0.5, this is very much efficiently done via RoutablePage. So I created the subpage_urls with that rule, created the view for that url and that's it. Thanks
Reply all
Reply to author
Forward
0 new messages