i have a simple ModelForm:
class MyForm(ModelForm):
def __init__(self, *args, **kwargs):
super(MyForm, self).__init__(*args, **kwargs)
d
I had the same problem. This is how I made it work in the new Django (trunk):
class MyModelAdmin(admin.ModelAdmin):
# Your stuff here..
def get_form(self, request, obj=None, **kwargs):
if request.user.is_staff: # condition
self.exclude = ('field',)
return super(PublishAdmin, self).get_form(request, obj=obj, **kwargs)
By overriding the get_form method and putting the logic here you can select which Form you want to have displayed. Above I have displayed the standard form when a condition was met.