I have a monthly report model and I want to set it to a specific date (cycle). This is my model:
class MonthlyReport(m.Model):
month = m.DateField() <= set to a specific day in a month
worker = m.ForeignKey('auth.User')
total = m.IntegerField()
cycle = m.DateField(blank=True, null=True)
approvedDate = m.DateTimeField(blank=True, null=True)
you could set
auto_now=True
so it is set to actual date once object is updated:your model is just a definition of a report class. the specific month will be set to its object once the report object is created/updated in that specific month.
month
field is automatically updated with actual month's date. you dont need to do anything for it.