django-types
django-types copied to clipboard
Why declare AutoField when you can just type the id?
in the readme, in order to get the id field to be recognized, it's recommended to declare the AutoField explicitly like so:
# before
class Post(models.Model):
...
# after
class Post(models.Model):
id = models.AutoField(primary_key=True)
But why not just assign a type to the id field like so:
# after
class Post(models.Model):
id: int
the later avoids any unnecessary migrations from being created during makemigrations after modifying the models.
The README has been updated, this can probably be closed