-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I have followed the documentation about manipulators and they were
working quite well. However I now get a strange error becaue of an
unkown reason:
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
in get_response
74. response = callback(request, *callback_args, **callback_kwargs)
File
"/usr/lib/python2.4/site-packages/django/contrib/auth/decorators.py"
in _checklogin
14. return view_func(request, *args, **kwargs)
File
"/home/lucasvo/Desktop/harmony/addressbook/harmony/../harmony/addressbook/views.py"
in new_contact
54. new_contact = manipulator.save(new_data)
File
"/usr/lib/python2.4/site-packages/django/db/models/manipulators.py" in
save
101. new_object.save()
File "/usr/lib/python2.4/site-packages/django/db/models/base.py" in save
180. db_values = [f.get_db_prep_save(f.pre_save(self, True)) for f
in self._meta.fields if not isinstance(f, AutoField)]
File
"/usr/lib/python2.4/site-packages/django/db/models/fields/__init__.py"
in get_db_prep_save
446. value = value.strftime('%Y-%m-%d')
AttributeError at /addressbook/new/
'str' object has no attribute 'strftime'
My view code is:
@login_required
def new_contact(request):
manipulator = Contact.AddManipulator()
if request.POST:
# If data was POSTed, we're trying to create a new Place.
new_data = request.POST.copy()
new_data['owner'] = request.user.id
# Check for errors.
errors = manipulator.get_validation_errors(new_data)
if not errors:
# No errors. This means we can save the data!
manipulator.do_html2python(new_data)
new_contact = manipulator.save(new_data)
# Redirect to the object's "edit" page. Always use a redirect
# after POST data, so that reloads don't accidently create
# duplicate entires, and so users don't see the confusing
# "Repost POST data?" alert box in their browsers.
return HttpResponseRedirect("/addressbook/edit/%i/" %
new_contact.id)
else:
# No POST, so we want a brand new form without any data or
errors.
errors = new_data = {}
# Create the FormWrapper, template, context, response.
form = forms.FormWrapper(manipulator, new_data, errors)
return render_to_response('addressbook/new_contact.html', {'form':
form})
What's wrong?
regards,
Lucas Vogelsang
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Signed with GPG & Enigmail - see http://www.vincisolutions.ch/pgp/
iD8DBQFFNh473RQ/RpGW2HgRAnykAJ9vP0NRUkV1Rf12x3qYbvlxMZsoxACgmiet
RhnPM6O2BNmGANB3IuTm5Kg=
=n79O
-----END PGP SIGNATURE-----
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---