Mypy-Django自定义用户表单给出“名称未定义”

时间:2019-04-20 18:50:03

标签: python django pycharm mypy

Mypy对以下自定义用户表单(子类)不满意。

forms.py

from django.contrib.auth.forms import UserCreationForm, UserChangeForm

from .models import CustomUser


class CustomUserCreationForm(UserCreationForm):

    class Meta(UserCreationForm.Meta):
        model = CustomUser
        fields = ('email', 'username',)

Mypy引发以下错误:

Mypy found 1 error:
    Name 'UserCreationForm.Meta' is not defined

我该怎么做才能防止此错误?我是Mypy的新手,在文档中找不到解决方案。预先感谢您的帮助!

(PyCharm,Python 3.7,Django 2.2)

0 个答案:

没有答案