在django模型中创建unsigned bigint字段

时间:2016-03-22 11:53:46

标签: python django python-2.7 django-models

我在Ubuntu 14.04上使用python 2.7,Django 1.9.4

在定义模型时,我找不到创建UNSIGNED BIGINT类型字段的方法。

我检查了文档。我不认为有这样的东西似乎令人惊讶。也许我错过了什么。

然后我检查了来源: https://github.com/django/django/blob/stable/1.9.x/django/db/models/fields/init.py

第1883行...类BigIntegerField实际上是一个签名的vaue。 第912行... AutoField是一个整数

然后我找到了一种(hackish)方法(我不确定它是否会在以后破坏): Can the Django ORM store an unsigned 64-bit integer (aka ulong64 or uint64) in a reliably backend-agnostic manner?

PS:主分支在第993行有一个名为BigAutoField的东西..但它也有签名。 https://github.com/django/django/blob/master/django/db/models/fields/init.py

您建议创建此字段的建议是什么?

0 个答案:

没有答案