I'm currently having a Menu model with an Admin class. Inside the admin class, I'm defining the fields tuple in order to have all the model fields displayed in a nice, ergonomic manner.
The Admin class looks like this:
class Admin:
fields = (
(None, {
'fields': ('name', 'description', 'linked_page', 'linked_resource', 'menu_group', 'position')
}),
(_('Language options'), {
'classes': 'collapse',
'fields' : ('language'),
'description': _('Language options for each page')
}),
(_('Advanced options'), {
'classes': 'collapse',
'fields' : ('status', 'pub_date'),
'description': 'Some extra advanced options for each menu entry'
}),
)
list_per_page = 10
list_display = ('name', 'position', 'description', 'linked_page', 'linked_resource', 'menu_group', 'status', 'was_published_today', 'pub_date')
list_filter = ['language', 'pub_date', 'status','linked_page', 'menu_group']
search_fields = ['name', 'description', 'linked_resource']
date_hierarchy = 'pub_date'
ordering = ["position"]
As you can see, the fields tuple inside (_('Language options') contains a single element, which is the 'language' field.
This configuration brings a
FieldDoesNotExist? at /cms/admin/content/menu/15/
Menu has no field named 'l'
error each time I'm trying to change any of the Menu entries.
It seems that if I'm adding another field, any field, to the fields tuple inside the language options, the error does not occur anymore.
So, a tuple like this: 'fields' : ('language', 'name'), would do the trick. However, I cannot do that because the 'name' field already appears and has nothing to do with the language options.