Reputation: 75
I am working on creating model in models.py file.
date_created = models.DateTimeField(null=False,default='0000-00-00 00:00:00')
above code working perfect as it create default in database as per mentioned.
concept_id = models.IntegerField(default=0,null=False)
above code not working as it can't able to create default value.
please help me for assign default value for above mentioned field.
Also How can i create Double Type using models.py ?? by using above code i am creating integer type field but can't create Double dataType.
Upvotes: 0
Views: 82
Reputation: 1909
Use a DecimalField. Ie
models.DecimalField(..., max_digits=5, decimal_places=2)
or a FloatField (Decimal is more precise, see https://docs.djangoproject.com/en/dev/ref/models/fields/#floatfield-vs-decimalfield).
Upvotes: 1