'Django DatField returns null value every time I register information
I have a model that registers a project information which have start date and end date but when I submit those information, the value of start date and end date is null their value never saved to the database.
Here is my model.py
class Project(models.Model):
project_name = models.CharField(max_length=255, blank=False)
created_by = models.ForeignKey(
Employee, related_name='employee', on_delete=models.CASCADE)
status = models.CharField(
max_length=50, choices=PROJECT_STATUS_CHOICES, default=COMING_STATUS, null=True, blank=True
)
start_date = models.DateField( null=False)
end_date = models.DateField( null=False)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return self.project_name
Here is the list of project data
{
"id": 1,
"created_by": "Teshome",
"project_name": "Teshome",
"status": "Coming",
"start_date": null,
"end_date": null,
"created_at": "2022-04-15T12:16:31.045887Z",
"updated_at": "2022-04-15T12:16:31.045887Z"
},
{
"id": 2,
"created_by": "Teshome",
"project_name": "Babi",
"status": "Ended",
"start_date": null,
"end_date": null,
"created_at": "2022-04-15T12:30:03.332208Z",
"updated_at": "2022-04-15T12:30:03.332208Z"
},
Here is the Django admin interface where I register project information.
I did not use any frontend framework to register project information I just did it from Django Admin.
How can I solve this Isuue?
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
