Updateview with dynamic form_class
问题 I would like to dynamically change the form_class of an UpdateView CBV in Django 1.6. I've tried to do this using the get_context_data(), but that didn't help since the form is already initialized. So it will need to happen during __init__ , I guess. Here's what I've tried on __init__ : class UpdatePersonView(generic.UpdateView): model = Person form_class = "" def __init__(self, *args, **kwargs): super(UpdatePersonView, self).__init__(*args, **kwargs) person = Person.objects.get(id=self.get