Django Error while trying to migrate model on Postgre DB


Django Error while trying to migrate model on Postgre DB



I'm still learning to use Django and I have an issue while trying to create a model.
Here's my models.py


class Identifiants(models.Model):
id = models.AutoField(primary_key=True)
taxon = models.IntegerField(unique=True)
noms = models.TextField(blank=True, null=True)
fiche = models.IntegerField(blank=True, null=True)
comestible = models.TextField(blank=True, null=True)
sms = models.NullBooleanField()
a_imprimer = models.NullBooleanField()
lieu = models.TextField(blank=True, null=True)
apparition = models.TextField()

class Meta:
managed = True
db_table = 'identifiants'



The makemigrations command works with no issues but the migrate one is where I have problems


Running migrations:
Applying app.0001_initial...Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/django/db/backends/utils.py", line 83,
in _execute
return self.cursor.execute(sql)
psycopg2.DataError: NUMERIC precision 65535 must be between 1 and 1000
LINE 1: ...iants" ("id" serial NOT NULL PRIMARY KEY, "taxon" numeric(65...



I'm using IntegerField method so I can't see why there is an issue ...



Can anyone help me ?



Thanks




1 Answer
1



Remove id = models.AutoField(primary_key=True) id is automatically created by django.


id = models.AutoField(primary_key=True)



check it here, its similar to your question.





Working ! Thanks a lot !
– Rahveiz
Jun 29 at 12:14






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Opening a url is failing in Swift

Possible Unhandled Promise Rejection (id: 0): ReferenceError: user is not defined ReferenceError: user is not defined