[Answered ]-Changing The Appearance of a Django Form Based on a Condition Before The Form Loads

2👍

You check it in view before initializing form object.

if request.user.is_superuser:
  initial = {'checkboxfields_name':True}
else:
  initial = {'checkboxfields_name':False}

form = YourForm(request.POST, initial = initial) if request.method == 'POST' else YourForm(initial = initial)

something like that, i guess.

Leave a comment