[Fixed]-Modify slug for every page of model on wagtail

1👍

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
👤gasman

Leave a comment