Django: Querying read-only view with no primary key

前端 未结 4 1134
广开言路
广开言路 2020-12-28 14:41
class dbview(models.Model):
    # field definitions omitted for brevity
    class Meta:
        db_table = \'read_only_view\'

def main(request):
    result = dbview         


        
4条回答
  •  醉话见心
    2020-12-28 15:04

    If there really is no primary key in the view, then there is no workaround.

    Django requires each model to have exactly one field primary_key=True.

提交回复
热议问题