Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
Modify slug for every page of model on wagtail

I am trying to create a custom slug for every page of a specific Page model on Wagtail. I have been looking into and tried the RoutablePageMixin examples, but that seems to modify the url structure, not the slug itself.

Here is what I am looking to do:

Current page title: About Django

current page slug: about-django

page title I want: About Django

page slug I want: awesome-things-about-django

I looked at creating route method, but that didn't seem to modify the slug. Is there any way to prepend something onto your slug? I understand I can do this manually, but would prefer for it to happen automatically.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

One possibility for making automatic updates to pages on save is to override the full_clean method:

class MyPage(Page):

    # ...

    def full_clean(self, *args, **kwargs):
        # first call the built-in cleanups (including default slug generation)
        super(MyPage, self).full_clean(*args, **kwargs)

        # now make your additional modifications
        if not self.slug.startswith('awesome'):
            self.slug = "awesome-%s" % self.slug
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!