@classmethod
def get_partial_form(cls, Form, fields):
    """ Get partial form based on original Form and fields set.

        :param Form: django.forms.ModelForm
        :param list fields: list of field names.

        """
    if not fields:
        return Form
    if not set(fields) <= set(Form.base_fields.keys()):
        fields = set(fields) & set(Form.base_fields.keys())
    meta_attributes = dict(fields=list(fields))
    meta_bases = Form.Meta,
    if not issubclass(Form.Meta, object):
        meta_bases += object,
    PartialForm = type('PartialForm', (Form,), {'Meta': type('Meta',
        meta_bases, meta_attributes)})
    return PartialForm
