Giter VIP home page Giter VIP logo

Comments (3)

grigi avatar grigi commented on July 3, 2024

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.

florimondmanca avatar florimondmanca commented on July 3, 2024

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.

grigi avatar grigi commented on July 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.