'Returns the form class to use in this view.'

def get_form_class(self):

    if self.form_class:
        return self.form_class
    else:
        if (self.model is not None):
            model = self.model
        elif (hasattr(self, 'object') and (self.object is not None)):
            model = self.object.__class__
        else:
            model = self.get_queryset().model
        return model_forms.modelform_factory(model)
