I'm writing existing SQLite3 database to django models. Some dates replicate themselves and I need them encoded, so I create a class in the model to store unique periods in the following form: mm/yyyy
.
What would be the right syntax to set date, so in django they have the same format, but as a datetime object?
class Periods(models.Model):
period = models.DateField()
def __str__(self):
return self.period
Thanks in advance.