Comments (3)
Yes, I think we can safely auto-generate the "required" attribute from a combination of the null
and default
parameters.
In Django the "blank" parameter is only really used by auto-form generation and is otherwise ignored. It is one of the areas where persistence rules and presentation rules is mixed, which is not ideal, as it implies inter-dependency. So lets see if we can leave it out.
Also, have a look at #13 & #39 which is both features we wanted to get to post 1.0, but as you are showing interest :-)
Also #14 which led to a more standardised init, it also makes models cleaner to discover. So If there is anything you feel is needed, we could extend that interface to provide.
I'd prefer something explicit, and not an implementation detail, so we have the capability of changing internals without breaking it for everyone.
from tortoise-orm.
In Django the "blank" parameter is only really used by auto-form generation and is otherwise ignored.
FYI, I believe the Django REST Framework does use blank
to figure out whether a field is required (which makes sense because a REST POST
request is a form too, in a way).
But it always seemed strange to me that we needed to specify blank=True
even though a default was passed, hence the proposal which we seem to agree upon. :-)
I'd prefer something explicit, and not an implementation detail, so we have the capability of changing internals without breaking it for everyone.
I'm not sure what you mean exactly by this?
Also, I've taken a look at those issues you mentioned and will keep them under my radar. :-)
from tortoise-orm.
I meant that we should instead of letting the user use what is currently an internal interface, instead formalise it, so that we can at worst know exactly what we need to keep compatible for, in case of internal change.
E.g. we need to support deprecation period, so if we need to change something incompatibily internally, we can still have a stable interface for this, so that we annoy our users less.
A good read on this topic (and many others) is: https://emptysqua.re/blog/api-evolution-the-right-way/
from tortoise-orm.
Related Issues (20)
- model relationship bugged HOT 8
- why are there three files for one database? HOT 1
- auto_now not working HOT 2
- Field 'DatetimeField' has error when I use '__year' or '__month'. report this:" 'int' object has no attribute 'utcoffset' " HOT 2
- Tortoise ORM integration with FastAPI lifespan ('NoneType' object is not iterable) HOT 4
- update(balance=Wallet.balance+1) how to do this? HOT 1
- Req: concurrent use of multiple databases HOT 4
- model.update_or_create KeyError HOT 4
- Bug: Pydantic 2.7 broke `pydantic_model_creator` HOT 7
- Occasionally during high-frequency queries, there may be differences between SQL statements and query results, leading to KeyError errors. Additionally, Command Out of Sync errors may also be reported during transactions
- QuerySet.count(): IndexError: list index out of range HOT 3
- ConnectionDoesNotExistError, connection was closed in the middle of operation
- Can not to use relation to table with unsigned pk HOT 2
- Documentation is completely broken - it points to the develop branch but says it's for 0.20.1 HOT 9
- Question - how to configure Tortoise for transparent auto-reconnect? HOT 2
- Doubts about the correctness of the result of the count() method HOT 4
- Add proper error messages and a doc page dedicated for testing HOT 3
- Support symmetrical ManyToMany relationships HOT 2
- Bulk Create without returning objects HOT 3
- OperationalError when attempting to filter by annotated field in m2m relation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tortoise-orm.