Django: Create fixtures without specifying a primary key?

前端 未结 5 2145
梦毁少年i
梦毁少年i 2020-12-07 22:16

One of the things that bugs me about Django fixtures is that you\'ve got to specify every model\'s primary key. Is there any way to create fixtures without having to specify

5条回答
  •  生来不讨喜
    2020-12-07 22:51

    You should have a look at Natural Keys if you're wiling to add relation without using pk's

    https://docs.djangoproject.com/en/dev/ref/django-admin/#dumpdata-app-label-app-label-app-label-model

提交回复
热议问题