Slug field doesn't appear to be auto populating


#1

I have an annoying issue where the slug field is not auto populating in admin. I have to fill the field in manually. Here’s my admin.py:-

from django.contrib import admin
from logbook.models import Trip

class TripAdmin(admin.ModelAdmin):
    model = Trip
    list_display = ('tripdate', 'waterway',)
    prepopulated_fields = {'slug': ('tripdate', 'waterway')}
   
admin.site.register(Trip)

#2

Try using only one thing, rather than two. For example: https://github.com/hellowebbooks/hellowebapp-code/blob/master/collection/admin.py#L10


#3

As per my other issue, I’ll check this today and let you know the outcome.


#4

Just tried the one field instead of two and it works fine, thanks. I am guessing that if I wanted to have slugs based on two fields, I would need extra coding and possibly the use of foreign keys etc… just a guess…

Thanks anyway.