Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 8, 2005 02:24:51

t.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Date issues


I'm getting the following error when I try to upload a photo:

File "/usr/lib/python2.3/site-packages/django/core/meta/fields.py",
line 327, in get_db_prep_save
value = value.strftime('%Y-%m-%d')

AttributeError: 'str' object has no attribute 'strftime'

Here's my model:

from django.core import meta

class Weblog(meta.Model):
subject = meta.CharField(maxlength=200)
date_created = meta.DateTimeField('date created', auto_now_add=True)
last_updated = meta.DateTimeField('last updated', auto_now=True)
log_text = meta.TextField()
class META:
admin = meta.Admin(
)
def __repr__(self):
return self.subject

class Photocategory(meta.Model):
category = meta.CharField(maxlength=255)
class META:
admin = meta.Admin(
)
def __repr__(self):
return self.category

class Photo(meta.Model):
weblog = meta.ForeignKey(Weblog, null=True)
category = meta.ForeignKey(Photocategory, null=True)
photo =
meta.ImageField(upload_to="/home/mthaddon/tomhaddon/content/photos/%m_%y/")
date_uploaded = meta.DateField('date uploaded', auto_now_add=True)
photo_date = meta.DateField('photo date')
photo_description = meta.TextField()
class META:
admin = meta.Admin(
)
def __repr__(self):
return self.photo_description


I think what I'm seeing is a problem with converting something to a
date? Is this correct?

Thanks, Tom

Offline

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support