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

def get_form_class(self):

    if ((self.fields is not None) and self.form_class):
        raise ImproperlyConfigured("Specifying    both    'fields'    and    'form_class'    is    not    permitted.")
    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
        if (self.fields is None):
            raise ImproperlyConfigured(("Using    ModelFormMixin    (base    class    of    %s)    without    the    'fields'    attribute    is    prohibited." % self.__class__.__name__))
        return model_forms.modelform_factory(model, fields=self.fields)
