Django UUIDField modelfield causes error in Django admin: badly formed hexadecimal UUID string

前端 未结 1 976
情歌与酒
情歌与酒 2020-12-21 01:34

I have a Django 1.8 project and on one of my models, I am using the new UUIDField like so:

class MyModel(models.Model):
    id = models.UUIDField(primary_key         


        
相关标签:
1条回答
  • 2020-12-21 02:21

    The problem is that I had an existing record in the DB with a default integer autoincrement id, before I had specific that the id field on my model was a UUIDField. The value of this field was just 1, which was not a valid UUID hex string.

    Removing this record fixed my issue.

    0 讨论(0)
提交回复
热议问题