[Django]-Django Prepopulated Fields with two/three letter words

2👍

Like @Alasdair said in his answer, there are words that get ignored when you use prepoulated_fields. Instead of overriding the js file that handles those words I turned the slug field from the title in the save_model.

def save_model(self, request, obj, form, change):        
    if not change:
        obj.slug = slugify(('%s') % obj.title)
    obj.save()
👤Austin

2👍

You are using the prepopulated_fields option correctly. If you look at the urlify.js script included in the django admin app, you can see there’s a list of words which are ignored.

I’m not aware of an easy way to modify the behaviour besides editing the file itself, which isn’t ideal.

Leave a comment