I'm pretty new to Python and App Engine, but what I'm trying to do is store a model which contains a DateProperty, and that DateProperty is populated with a Date entered by the user in a web form.
I've got the model of:
class Memory(db.Model):
author = db.UserProperty()
content = db.StringProperty(multiline=True)
date = db.DateProperty()
and then create an instance with:
memory = Memory()
memory.author = users.get_current_user()
memory.content = self.request.get('content')
But as soon as I try to do anything with the date value, I break it. I'm assuming - and entering - the date value in this format: 2009-07-21
I've tried:
memory.date = time.strptime(self.request.get('date'), '%Y-%m-%d')
memory.date = db.DateProperty(self.request.get('date'))
memory.date = self.request.get('date') (wishful thinking I guess)
and a few other options I can't even remember now. Everything I try leads to an ImportError with a giant stack trace ending in:
: No module named _multiprocessing args = ('No module named _multiprocessing',) message = 'No module named _multiprocessing'
I have no idea what to make of that.
I come from a PHP world where strtotime() was my magic function that gave me everything I needed for conversions, and the date() function could handle the rest of the formatting. Now I see things with inline lambda (??) functions and what not.
What am I missing on something that would seem to be so simple.