tags:

views:

838

answers:

1

If there a way to detect if information in a model is being added or changed.

If there is can this information be used to exclude fields.

Some pseudocode to illustrate what I'm talking about.

class SubSectionAdmin(admin.ModelAdmin):
    if something.change_or_add = 'change':
        exclude = ('field',)
    ...

Thanks

+1  A: 
class SubSectionAdmin(admin.ModelAdmin):
    # ...
    def change_view(self, request, object_id, extra_context=None):       
        self.exclude('field', )
    return super(SubSectionAdmin, self).change_view(request, object_id, extra_context=None)
orwellian