• 请不要在回答技术问题时复制粘贴 AI 生成的内容
liangmishi
V2EX  ›  程序员

peewee 创建的复合主键不能做外键 吗?

  •  
  •   liangmishi · Jul 27, 2016 · 2588 views
    This topic created in 3602 days ago, the information mentioned may be changed or developed.
    class A(BaseModel):
        one = CharField()
        two = CharField()  
        class Meta:
            primary_key = CompositeKey('one', 'two')
    
    class B(BaseMoedel):
        a = ForeignKeyField(A, related_name='A')
    
    db.create_tables([A,B])
    

    这是行不通的,谷歌了,没找到好的解决方案,实在苦恼。
    可有老司机指路~

    1 replies    2016-07-27 21:54:20 +08:00
    liangmishi
        1
    liangmishi  
    OP
       Jul 27, 2016
    感觉要沉
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   831 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:33 · PVG 04:33 · LAX 13:33 · JFK 16:33
    ♥ Do have faith in what you're doing.