django ER model design

It is not that easy as we usually think of.
In fact, it could cause chained impacts on later API usage due to the fact that we have less control on data creation of admin user
Any bad data can potentially cause API calling problem in future usage

So basically, when design ER model for django backend, it is recommended to design with admin UI to detect if there is any required field/logic/relationship which should be required.

Fk, is not that easy as it looks to determine which side to add at first glance.

concept: Required field independent
In admin site, once user creates a new instance, the instance is complete and requires no other dependencies from logic/experiecne anymore.

Course and Student, for example, we set the FK(child) in Course model instead of student. However, logically speaking, a student has to have a course to be meaningful and useful in django, a child without a course could made broken APIs by coding something like course=Course.objects.filter(child=child).

Even if we can handle it by try except block, the serialisers and all other stuff has made this much more complex to handle.

So think of this before design the er model: is this object Required field independent in my design?

And that’s why we recommend to code mode.py and check admin site while designing the ER model

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容