Assume the following:
models.py
class Entry(models.Model):
title = models.CharField(max_length=50)
slug = models.CharField(max_length=50, unique=True)
body = models.CharField(max_length=200)
admin.py
class EntryAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug':('title',)}
I want the slug to be pre-populated with a header, but I don't want the user to be able to edit it with the administrator. I assumed that adding the = [] fields to the admin object and not including slug would work, but it is not. I also tried setting editable = False in the model, but that also did not work (infact, stops the page from rendering).
Thoughts?
source
share