Hi all,
I would like to know how you can change a model's field's parameters, not during model initialisation, but from a model admin. For instance, I would like to make either field "foo" or "bar" optional, according on a get parameter (wondering about the correct solution for the # PSEUDO CODE bit):
def add_view(self, request, form_url='', extra_context=None):
if request.GET.get('object_type', 'foo') == 'foo':
# PSEUDO CODE:
model.fields.foo.blank = False
model.fields.bar.blank = True
else:
# PSEUDO CODE:
model.fields.foo.blank = True
model.fields.bar.blank = False
return super(FileNodeAdmin, self).add_view(request, form_url, extra_context)