Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # модель пользователя / models.py
- class User(AbstractUser):
- username = None
- first_name = None
- last_name = None
- email = models.EmailField(unique=True)
- USERNAME_FIELD = 'email'
- REQUIRED_FIELDS = []
- objects = CustomUserManager()
- def __str__(self):
- return f'{self.email}, #{self.id}'
- class Meta:
- ordering = ['-id']
- # настройки mypy / setup.cfg
- [mypy]
- plugins =
- mypy_django_plugin.main
- ignore_missing_imports = True
- implicit_reexport = False
- strict_optional = True
- strict_equality = True
- no_implicit_optional = True
- warn_unused_ignores = True
- warn_redundant_casts = True
- warn_unused_configs = True
- warn_unreachable = True
- warn_no_return = True
- [mypy.plugins.django-stubs]
- django_settings_module = feeder.settings
- # трейсбек
- user/models.py:32: error: Incompatible types in assignment (expression has type "None", base class "AbstractUser" defined the type as "CharField[Union[str, int, Combinable], str]")
- user/models.py:33: error: Incompatible types in assignment (expression has type "None", base class "AbstractUser" defined the type as "CharField[Union[str, int, Combinable], str]")
- user/models.py:34: error: Incompatible types in assignment (expression has type "None", base class "AbstractUser" defined the type as "CharField[Union[str, int, Combinable], str]")
- user/models.py:38: error: Need type annotation for 'REQUIRED_FIELDS' (hint: "REQUIRED_FIELDS: List[<type>] = ...")
- user/models.py:40: error: Incompatible types in assignment (expression has type "CustomUserManager[User]", base class "AbstractUser" defined the type as "UserManager[AbstractUser]")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement