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

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

  •  
  •   liangmishi · Jul 27, 2016 · 2589 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   ·   5518 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 07:57 · PVG 15:57 · LAX 00:57 · JFK 03:57
    ♥ Do have faith in what you're doing.