Reputation: 95
I am trying to upload a csv file into a database with a date column using the package Django Adaptor - https://django-adaptors.readthedocs.io/en/latest/
My csv file date format is %d/%m/%Y and it seem the system only accept a date format %Y-%m-%d.
How do I change my csv format to fit the system? Or is there away to change the system to accept my csv file date format? I am using Django 10.1. Thanks in advance!
class Transactions(models.Model):
date = models.DateField()
description = models.CharField(max_length=40)
amount = models.DecimalField(max_digits=15, decimal_places=2)
balance = models.DecimalField(max_digits=15, decimal_places=2)
class UploadTransactionsModel(CsvDbModel):
class Meta:
delimiter = ";"
dbModel = Transactions
settings.py DATE_INPUT_FORMATS = ['%d/%m/%Y']
Upvotes: 0
Views: 301