django.core.exceptions.FieldError: 'date' cannot be specified for Forum model form as it is a non-editable field 1

django.core.exceptions.FieldError: ‘date’ cannot be specified for Forum model form as it is a non-editable field

from django.utils import timezone
# change date = models.DateField(auto_now_add=True) to this one:
date = models.DateTimeField(default=timezone.now)

Here is what the above code is Doing:
1. We import the timezone module from django.utils.
2. We change the date field to a DateTimeField.
3. We set the default value of the date field to the current date and time.

Similar Posts