-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I found an error when my data have an id or pk field. But, when I removed it id, it just working fine.
from reobject.models import Model, Field
data = [
{'id': 1, 'name': 'brad', 'color': 'red', 'tags': [], 'author': {'name': 'admin'}},
{'id': 2, 'name': 'sylvia', 'color': 'blue', 'tags': [], 'author': {'name': 'user'}},
{'id': 3, 'name': 'sylwia', 'color': 'green', 'tags': [], 'author': {'name': 'admin'}},
{'id': 4, 'name': 'shane', 'color': 'red', 'tags': [], 'author': {'name': 'admin'}},
{'id': 5, 'name': 'shane', 'color': 'red', 'tags': ['python', 'django'], 'author': {'name': 'user'}}
]
class Book(Model):
id = Field()
name = Field()
color = Field()
tags = Field()
author = Field()
for item in data:
Book(**item)
Book.objects.all()
Book.objects.filter(author__name='admin')Also it doesn't work for:
Book.objects.filter(tags__in=['python'])oh it working with:
Book.objects.filter(tags__contains='python')Metadata
Metadata
Assignees
Labels
No labels
