I am using Wagtail CMS for a project. I'm able to create entries and update them without issue.
I have moved the slug field from the Promote panel into my content panel. This is what my models.py
looks like:
# models.py
...
content_panels = Page.content_panels + [
FieldPanel('slug'),
...
]
promote_panels = []
When creating a new entry, I am letting Wagtail populate the slug field. For example,
- Title:
Birthdays
- Slug:
birthdays
I'm able to enter all fields and successfully save the entry.
When I create a new entry with the same title, I am getting an error (when saving) that the slug must be unique.
ValidationError: {'slug': ['This slug is already in use']}
This makes sense that slugs must be unique - however, I would like to have Wagtail take care of that for me? I want to use the same page title of "Birthdays".
Is it possible to have Wagtail catch the exception and append -1
, -2
etc to the slug without throwing an error?
I am coming from CraftCMS and this is how the authoring experience worked...