Friday, April 15, 2011

Why isn't keyword DateField.input_formats recognized in django 1.0.2 and Python 2.5?

With django 1.0.2 and Python 2.5, when I use the keyword DateField.input_formats, I get the error that __init__() got an unexpected keyword argument 'input_formats'. When I look in the __init__ file, I don't see input_formats as one of the acceptable keyword arguments.

I thought that input_formats had been around long enough that it should be in there. Is the input_formats keyword not supported in this configuration? If not, how can I acquire an updated __init__ that does support it? Thank you.

As suggested in the comment, I have added code below. I suspect the problem is that I am confusing the DateField form and DateField model, but I would be pleased if someone could confirm that.

from django.db import models

class Payment(models.Model):
    date_paid = models.DateField(blank=True, db_index=True, input_formats=['%m/%d/%y'])
From stackoverflow

0 comments:

Post a Comment