No, what I'm describing is functions in a selector.py, like: def get_orders_for_date(date) -> Order:
where Order is a pydantic model, not a fat django model. Other modules shouldn't know about my internal database. All other modules should use functions from this selector.py, they aren't allowed to use the OrderModel themselves directly, only the pydantic class. Because otherwise you end up with spaghetti.
Re:Django Styleguide
by traverseda on Thursday January 12, 2023 @08:57AM
(#34353504)
Right... so you're talking about mapping an object from your database to a pydantic object.
So you want an ORM, but you want it without a save method? Or presumably with a save method that can only be called under specific circumstances?
What you're describing takes a selector, and maps it onto an object. Is it just that you want type hints or something?