rc for skip of literal binds

This commit is contained in:
collerek
2022-01-06 18:22:07 +01:00
parent 067b61460d
commit c8586e5b8e
20 changed files with 188 additions and 155 deletions

View File

@ -15,14 +15,17 @@ class Book(ormar.Model):
id: int = ormar.Integer(primary_key=True)
title: str = ormar.String(max_length=200)
author: str = ormar.String(max_length=100)
genre: str = ormar.String(max_length=100, default='Fiction',
choices=['Fiction', 'Adventure', 'Historic', 'Fantasy'])
genre: str = ormar.String(
max_length=100,
default="Fiction",
choices=["Fiction", "Adventure", "Historic", "Fantasy"],
)
await Book.objects.create(title='Tom Sawyer', author="Twain, Mark", genre='Adventure')
await Book.objects.create(title='War and Peace', author="Tolstoy, Leo", genre='Fiction')
await Book.objects.create(title='Anna Karenina', author="Tolstoy, Leo", genre='Fiction')
await Book.objects.create(title="Tom Sawyer", author="Twain, Mark", genre="Adventure")
await Book.objects.create(title="War and Peace", author="Tolstoy, Leo", genre="Fiction")
await Book.objects.create(title="Anna Karenina", author="Tolstoy, Leo", genre="Fiction")
await Book.objects.update(each=True, genre='Fiction')
all_books = await Book.objects.filter(genre='Fiction').all()
await Book.objects.update(each=True, genre="Fiction")
all_books = await Book.objects.filter(genre="Fiction").all()
assert len(all_books) == 3