Replies: 7 comments 8 replies
-
Uncomfortable to work with FKey Example:
When I create a Course that references Department, I need to add an object to the department field (something like {'id': 1}), but not a numeric value |
Beta Was this translation helpful? Give feedback.
-
In general one of the things I've noticed is that I think part of this is that it seems like every instance gets validated twice. As in the validation seems to run when you pull things out of the database, and then it's run again when the model is sent out of FastAPI. Projects like Django and DRF I think assume that stuff coming out of the database doesn't need to validated (e.g. if I have an I'm not sure how practical doing any of this would be for So maybe some kind of "inbound only" validation could be helpful to make |
Beta Was this translation helpful? Give feedback.
-
I don't like much (of course I can live with that) to |
Beta Was this translation helpful? Give feedback.
-
Hi Collerek One thing that stands out to me is the Consider an API route where we POST new {
"name": "Bark",
"courses": [
{"id": "11ea82fe-72c3-4029-a683-7572d934c320"},
{"id": "5db60d96-5577-4ae7-bfa8-ff4941b10871"},
],
...
} And a route: StudentRequest = Student.get_pydantic(include={'name': ..., 'courses': 'id'})
@app.post('/students', response_model=Student.get_pydantic(include={'id', 'some_other_attr'})
async def create_student(student: StudentRequest):
student_db = await Student.objects.create(**student.dict())
for course in student.courses:
course_db = await Course.objects.get(pk=course.id)
await student_db.add(course_db)
return student_db It would be much more convenient to be able to call Other than that, using Ormar has been a pleasure. I especially enjoy being able to dynamically add filters to a list such as Thanks for your work. |
Beta Was this translation helpful? Give feedback.
-
First I want to thank you, @collerek for creating this package. I really like the Fastapi integration. We decided to use Ormar for a new internal service and are bumping into problems as soon as we're trying to do non-trivial things. This are the two specific problems we encountered. |
Beta Was this translation helpful? Give feedback.
-
Maybe should only concentrate on the orm project, don't integrate pydantic, many times, it will be clearer to separate the orm model from the pydantic model. |
Beta Was this translation helpful? Give feedback.
-
Hi @collerek I think this related to |
Beta Was this translation helpful? Give feedback.
-
Hi,
I would like to get some feedback about what users don't like about the package.
You can always put a word or two about what you like but the main focus is to find areas of improvement.
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions