Login

Tag "bigserial"

Snippet List

BigIntegerField and BigAutoField

Allows to create bigint (mysql), bigserial (psql), or NUMBER(19) (oracle) fields which have auto-increment set by using the AutoField of django, therefore ensuring that the ID gets updated in the instance when calling its 'save()' method. If you would only subclass IntegerField to BigIntegerField and use that as your primary key, your model instance you create would not get the id attribute set when calling 'save()', buy instead you would have to query and load the instance from the DB again to get the ID.

  • "primary
  • key"
  • bigserial
  • bigint
  • auto_increment
Read More
Author: fnl
  • 1
  • 2

1 snippet posted so far.