﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7280	"newforms-admin fields marked ""editable=False"" raise error when used in ""prepoluated_fields"""	peschler	nobody	"Consider the following model and the associated !ModelAdmin (shortened for demonstration):

{{{
class Menu(models.Model):
    name = models.CharField(max_length=50, unique=True)
    slug = models.SlugField(editable=False)
    # ...

class MenuOptions(admin.ModelAdmin):
    prepopulated_fields = {'slug': ('name',)}
    display_list = ('name', 'slug',)    
admin.site.register(Menu, MenuOptions)
}}}

The ``slug`` field should not be editable by a user but rather is updated in the ``save()`` method of the model everytime the name of the menu changes.
Now when I try to open the (newforms) admin page for adding a new Menu instance I get the following error:
{{{
KeyError at /admin/newnavigation/menu/add/
""Key 'slug' not found in Form""
}}}

The error disappears as soon I exchange ""editable=False"" with ""editable=True"" or remove the ``slug`` from the ``prepoluated_fields``.
Seems there is a problem when using a field marked ``editable=False`` in the !ModelAdmin's ``prepopulated_fields``.

In my use case I can simply remove ``slug`` from the ``prepopulated_fields`` because I populate it manually, but there might be some cases where such a simple fix is not possible.
"		closed	contrib.admin	newforms-admin		invalid	newforms-admin editable prepopulated_fields		Unreviewed	0	0	0	0	0	0
