添加orm
This commit is contained in:
parent
b2db8b8574
commit
da306f9b99
13
orm.py
Normal file
13
orm.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
from tortoise import Model, fields
|
||||||
|
|
||||||
|
|
||||||
|
class User(Model):
|
||||||
|
id = fields.IntField(pk=True)
|
||||||
|
name = fields.CharField(max_length=60)
|
||||||
|
state = fields.CharField(max_length=20)
|
||||||
|
|
||||||
|
|
||||||
|
class UserGroup(Model):
|
||||||
|
id = fields.IntField(pk=True)
|
||||||
|
name = fields.CharField(max_length=60)
|
||||||
|
user = fields.ForeignKeyField('orm.User')
|
Loading…
Reference in New Issue
Block a user