Big integer field in django models

后端 未结 3 372
孤城傲影
孤城傲影 2021-01-11 09:30

In short: How do you specify a BIGINT in Django models?

In a current project I am doing using Django (0.97-svn release), I\'ve all the integer fields in all the mode

相关标签:
3条回答
  • 2021-01-11 10:00

    Try a DecimalField.

    0 讨论(0)
  • 2021-01-11 10:05

    BigIntegerField was added in changeset 11887, 2009-12-17 09:10:38 and is part of Django 1.2 and newer.

    0 讨论(0)
  • 2021-01-11 10:08

    SQLite won't complain ever. it uses 'manifest typing', that is, the values have type, not the columns. It lets you store bigtext on a smallint collumn, or whatever you want! (except if you define an integer primary key, where it uses a 64-bit integer).

    that's a very convenient feature, but it makes a SQLite bad choice for developing if you're going to deploy with a different engine.

    for using a BIGINT, you'd have to create a custom field class. unfortunately, that part has changed on Django 1.0, so you'd have to rewrite it if/when you update.

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