I want to create two fields for creating an object in Django models.
The first field is required and will use the built in DateTimeField
.
Second field will take on the same data as in the first field, furthermore it should be possible to update the date without changing the data in the first field.
This is my class:
class MyClass(models.Model):
...
created_at = models.DateTimeField(null=True)
updated_at = models.DateTimeField(null=True) # this field should take data
...
I looked for built-in Models which fulfill my requirements, but couldn't find the right one.
This class with auto_now_add won't show me any field.
class MyClass(models.Model):
...
created_at = models.DateTimeField(**auto_now_add**=True)
updated_at = models.DateTimeField(**auto_now**=True)
...