On 8 dec 2005, at 06.16, Daniel Ericsson wrote:

On 8 dec 2005, at 04.18, Brett Hoerner wrote:

luminosity in IRC asked if I tried it without "auto_now_add=True" ... I
tried, and it worked.

So what am I doing wrong with "auto_now_add" here?

I'm not sure you are doing anything wrong. When you set auto_now or auto_now_add on the TimeField it isn't editable. Inserting it into the Admin with the META-fields property should maybe revert this and it does for DateField and DateTimeField but not for TimeField. I've only had a look at the meta code and if you comment out 629 in django/core/meta/fields.py and insert kwargs['blank'] = True as for DateFields you will see your TimeField.

django/core/meta/fields.py
624  class TimeField(Field):
625      empty_strings_allowed = False
626 def __init__(self, verbose_name=None, name=None, auto_now=False, auto_now_add=False, **kwargs): 627 self.auto_now, self.auto_now_add = auto_now, auto_now_add
628          if auto_now or auto_now_add:
629              #kwargs['editable'] = False
630              kwargs['blank'] = True
631          Field.__init__(self, verbose_name, name, **kwargs)

There seem to be a fix in the new-admin branch -> http:// code.djangoproject.com/changeset/1244

- Daniel

Reply via email to