In my project settings.py i try this :
USE_L10N = False
DATE_INPUT_FORMATS = ['%d/%m/%Y']
In my models.py i try this :
from django.db import models
from django.conf import settings
class PersonalInfo(models.Model):
Married_Status = (
("1", "Married"),
("2", "Unmarried"),
)
Name = models.CharField(max_length=50)
Age = models.IntegerField()
Married_Status = models.CharField(max_length=10, choices=Married_Status, default="Unmarried")
Birth_Date = models.DateField(input_formats=settings.DATE_INPUT_FORMATS)
It's show a error "TypeError: init() got an unexpected keyword argument 'input_formats'" I read django document and other stackoverflow question answer but i could not understand.
I want input from user like : 17/03/1998
I'm a noob to python and Django so any help would be greatly appreciated.
CodePudding user response:
In Setting.py :
USE_L10N = False
DATE_INPUT_FORMATS = ['%d/%m/%Y']
In model.py :
from django.db import models
from django.conf import settings
class PersonalInfo(models.Model):
Married_Status = (
("1", "Married"),
("2", "Unmarried"),
)
Name = models.CharField(max_length=50)
Age = models.IntegerField()
Married_Status = models.CharField(max_length=10, choices=Married_Status, default="Unmarried")
Birth_Date = models.DateField(default="Day/Month/Year")
That show like : Day/Month/Year