mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-11-02 21:24:34 +08:00
Fix tortoise import error (#97)
I was getting an import error using tortoise 0.1.1: `ImportError: cannot import name 'Model' from 'tortoise'`. These few changes seemed to have resolved the issue.
This commit is contained in:
@ -1,13 +1,13 @@
|
|||||||
from typing import List, Optional, Type
|
from typing import List, Optional, Type
|
||||||
|
|
||||||
from tortoise import Model, fields
|
from tortoise import models, fields
|
||||||
from tortoise.exceptions import DoesNotExist
|
from tortoise.exceptions import DoesNotExist
|
||||||
|
|
||||||
from fastapi_users.db.base import BaseUserDatabase
|
from fastapi_users.db.base import BaseUserDatabase
|
||||||
from fastapi_users.models import UD
|
from fastapi_users.models import UD
|
||||||
|
|
||||||
|
|
||||||
class TortoiseBaseUserModel(Model):
|
class TortoiseBaseUserModel(models.Model):
|
||||||
id = fields.CharField(pk=True, generated=False, max_length=255)
|
id = fields.CharField(pk=True, generated=False, max_length=255)
|
||||||
email = fields.CharField(index=True, unique=True, null=False, max_length=255)
|
email = fields.CharField(index=True, unique=True, null=False, max_length=255)
|
||||||
hashed_password = fields.CharField(null=False, max_length=255)
|
hashed_password = fields.CharField(null=False, max_length=255)
|
||||||
@ -26,7 +26,7 @@ class TortoiseBaseUserModel(Model):
|
|||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
|
||||||
class TortoiseBaseOAuthAccountModel(Model):
|
class TortoiseBaseOAuthAccountModel(models.Model):
|
||||||
id = fields.CharField(pk=True, generated=False, max_length=255)
|
id = fields.CharField(pk=True, generated=False, max_length=255)
|
||||||
oauth_name = fields.CharField(null=False, max_length=255)
|
oauth_name = fields.CharField(null=False, max_length=255)
|
||||||
access_token = fields.CharField(null=False, max_length=255)
|
access_token = fields.CharField(null=False, max_length=255)
|
||||||
|
|||||||
Reference in New Issue
Block a user