losee
losee

Reputation: 2238

In django prepopulated_fields = {"slug": ("title",)} doesn't show all words

I am using

prepopulated_fields = {"slug": ("title",)}

in my django admin area and when I type certain words like

 this is the first slug

into the title field

only

first-slug

is outputted in the slug field, and if I delete the "t"in the title field

the slug field will then output

his-first-slug

"is" and "the" won't show up

in the slug field. Why is that? or better yet How can I fix this so that anything I type in the title field is properly displayed in the slug field

Upvotes: 3

Views: 1015

Answers (1)

Mahir Labib Chowdhury
Mahir Labib Chowdhury

Reputation: 105

There is actually a filter in action that prevents certain words from ending up in the slug or url. You can see the source of that here. What it does is that it makes sure that you don't end up with words or symbols in the slug/url that just shouldn't be there.

How to fix it? Just change the mentioned file in /django/contrib/admin/static/admin/js/urlify.py and you should be good to go.

Upvotes: 4

Related Questions