Received a similar problem. I solved it using "add_fieldsets" and "limited_fieldsets" in ModelAdmin.
from django.contrib import admin class MyAdmin(admin.ModelAdmin): declared_fieldsets = None restricted_fieldsets = ( (None, {'fields': ('mod_obj1', 'mod_obj2')}), ( 'Text', {'fields': ('mod_obj3', 'mod_obj4',)}), ) add_fieldsets = ( (None, { 'classes': ('wide',), 'fields': ('add_obj1', 'add_obj2', )}), )
See for example: http://code.djangoproject.com/svn/django/trunk/django/contrib/auth/admin.py
But this will not protect your model from later changes to add_objX. If you want this too, I think you need to go through the Save class and check the changes there.
See: www.djangoproject.com/documentation/models/save_delete_hooks/
Griz, Nick
Nick Ma Dec 03 '10 at 11:32 2010-12-03 11:32
source share