How to exclude form fields if the user is not staff ? I tried this but didn\'t work , giving an error :
global name \'user\' is not defined
This can be achieved in the template when rendering the form. It will need to allow null values or have a default value in the model definition or alternatively have its validation overridden:
Similarly you can check for is_superuser
or check permissions, see the docs: https://docs.djangoproject.com/en/dev/topics/auth/default/#permissions