aoscici
V2EX  ›  Django

Django 中 Models 的设计问题

  •  
  •   aoscici · May 25, 2018 · 2873 views
    This topic created in 3012 days ago, the information mentioned may be changed or developed.

    假设一个房子,属于哪个市,市里哪个区,一般是怎么设计法?

    class City: name = ....

    class Area: name = ... belong = ForeignKey(City)

    class House: name = ... city = ForeignKey(City) area = ?

    还是用其他什么方法? 比如我有个 json 数据,能直接在后台选项那里引用吗??

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   851 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 20:51 · PVG 04:51 · LAX 13:51 · JFK 16:51
    ♥ Do have faith in what you're doing.