Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Requires the user to create their own slug field. #25

Closed
jrdnbrkfld opened this issue Aug 16, 2022 · 1 comment
Closed

BUG: Requires the user to create their own slug field. #25

jrdnbrkfld opened this issue Aug 16, 2022 · 1 comment
Assignees
Labels
bug Something isn't working
Projects

Comments

@jrdnbrkfld
Copy link
Owner

I realised that the fact that the user having to generate their own slug when creating/editing their post is not good UX.

@jrdnbrkfld jrdnbrkfld added the bug Something isn't working label Aug 16, 2022
@jrdnbrkfld jrdnbrkfld self-assigned this Aug 16, 2022
@jrdnbrkfld jrdnbrkfld added this to Open Bugs in Bugs Aug 16, 2022
@jrdnbrkfld jrdnbrkfld moved this from Open Bugs to In progress in Bugs Aug 16, 2022
@jrdnbrkfld
Copy link
Owner Author

After a bit of research I found the way to ensure the user doesn't have to write their own slug field.

I did this by importing slugify to my models.py
from django.utils.text import slugify

I then added the following code to have the slug auto generate from the users post title.

def save(self, *args, **kwargs):
        self.slug = slugify(self.title)
        super(Post, self).save(*args, **kwargs)

@jrdnbrkfld jrdnbrkfld moved this from In progress to Fixed Bugs in Bugs Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Bugs
Fixed Bugs
Development

No branches or pull requests

1 participant