

def __new__(cls, name, bases, attrs):
    formfield_callback = attrs.pop('formfield_callback', None)
    try:
        parents = [b for b in bases if issubclass(b, DocumentForm)]
    except NameError:
        parents = None
    declared_fields = get_declared_fields(bases, attrs, False)
    new_class = super(DocumentFormMetaclass, cls).__new__(cls, name, bases, attrs)
    if (not parents):
        return new_class
    opts = new_class._meta = DocumentFormOptions(getattr(new_class, 'Meta', None))
    if opts.document:
        fields = fields_for_document(cls.document, opts.fields, opts.exclude, formfield_callback)
        fields.update(declared_fields)
    else:
        fields = declared_fields
    new_class.declared_fields = declared_fields
    new_class.base_fields = fields
    return new_class

dataset/ETHPy150Open peterbe/django-mongokit/django_mongokit/forms/forms.py DocumentFormMetaclass.__new__/VarMisuse@131/172 `opts`->`cls`