aoscici
V2EX  ›  Django

Django 中 Models 的设计问题

  •  
  •   aoscici · May 25, 2018 · 2690 views
    This topic created in 2933 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   ·   2839 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 09:56 · PVG 17:56 · LAX 02:56 · JFK 05:56
    ♥ Do have faith in what you're doing.