version with pydantic inheritance passing all the tests
This commit is contained in:
22
docs_src/models/docs007.py
Normal file
22
docs_src/models/docs007.py
Normal file
@ -0,0 +1,22 @@
|
||||
import databases
|
||||
import sqlalchemy
|
||||
|
||||
import ormar
|
||||
|
||||
database = databases.Database("sqlite:///db.sqlite")
|
||||
metadata = sqlalchemy.MetaData()
|
||||
|
||||
|
||||
class Course(ormar.Model):
|
||||
__database__ = database
|
||||
__metadata__ = metadata
|
||||
|
||||
id = ormar.Integer(primary_key=True)
|
||||
name = ormar.String(length=100)
|
||||
completed = ormar.Boolean(default=False)
|
||||
|
||||
|
||||
course = Course(name="Painting for dummies", completed=False)
|
||||
await course.save()
|
||||
|
||||
await Course.objects.create(name="Painting for dummies", completed=False)
|
||||
Reference in New Issue
Block a user