Basically what's happening is that `auto_now_add` and `editable`
outdated kludges. Both work by actually excluding the field in
question from the admin form, which means it's not available for
validation so none is ran.
A better approach, I think, would be to use something like::
import datetime
from django.db import models
class Entry(models.Model):
title = models.CharField(max_length=255)
slug = models.SlugField(unique_for_date='created')
created = models.DateField(default=datetime.date.today)
This will work as expected in the admin and in model forms.
Jacob
Thanks for your reply Jacob. The only problem with the method you
suggested is that the field now shows up in the admin form which
allows people to edit it. I would rather that this didn't happen. Is
there any way around this?
Thanks,
Ryan
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Overwrite the model's save method and add the date automatically on save. That is the best way to do most things "auto" in your models.