I'm processing pretty simple form data, just reading POST data and
saving it to my database.  I have a list of "timesheet" objects that i
run through, editing and saving each object in the list.  All the
objects save all right except for the last one.  When i process the
last one i receive a validation error:

Environment:

Request Method: POST
Request URL: http://support.mipscomputation.com/audit_sheets/TEST/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.4.3
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'helpdesk.departments',
 'helpdesk.projects',
 'helpdesk.internal']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.contrib.redirects.middleware.RedirectFallbackMiddleware')


Traceback:
File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
base.py" in get_response
  86.                 response = callback(request, *callback_args,
**callback_kwargs)
File "/home/mipscomp/public_html/support/helpdesk/projects/views.py"
in audit_sheets_test
  558.       temp_timesheet.save()
File "/usr/local/lib/python2.4/site-packages/django/db/models/base.py"
in save
  307.         self.save_base(force_insert=force_insert,
force_update=force_update)
File "/usr/local/lib/python2.4/site-packages/django/db/models/base.py"
in save_base
  357.                     values = [(f, None, f.get_db_prep_save(raw
and getattr(self, f.attname) or f.pre_save(self, False))) for f in
non_pks]
File "/usr/local/lib/python2.4/site-packages/django/db/models/fields/
__init__.py" in get_db_prep_save
  192.         return self.get_db_prep_value(value)
File "/usr/local/lib/python2.4/site-packages/django/db/models/fields/
__init__.py" in get_db_prep_value
  843.         return connection.ops.value_to_db_time(self.to_python
(value))
File "/usr/local/lib/python2.4/site-packages/django/db/models/fields/
__init__.py" in to_python
  830.                 raise exceptions.ValidationError(

Exception Type: ValidationError at /audit_sheets/TEST/
Exception Value: Enter a valid time in HH:MM[:ss[.uuuuuu]] format.


the code that causes looks as:


temp_timesheet = TimeSheet.objects.get(id=timesheetid)
      temp_timesheet.department = request.POST['department']
      temp_timesheet.engagement = request.POST['engagement']
      temp_timesheet.labor_code = request.POST['labor_code']
      temp_timesheet.location = request.POST['location']
      start_hour = request.POST['start_hour']
      start_minute = request.POST['start_minute']
      start_period = request.POST['start_period']
      end_hour = request.POST['end_hour']
      end_minute = request.POST['end_minute']
      end_period = request.POST['end_period']
      temp_timesheet.billtime = request.POST['billtime']
      if (end_period == "PM"):
        end_hour =+ 12
      temp_timesheet.start = str(start_hour) + ":" + str(start_minute)
+ ":" + "00"
      temp_timesheet.end = str(end_hour) + ":" + str(end_minute) + ":"
+ "00"
      temp_timesheet.date = request.POST['date']
      temp_timesheet.ctsytime = request.POST['ctsytime']
      temp_timesheet.description = request.POST['description']
      temp_timesheet.recommendations = request.POST['recommendations']
      temp_timesheet.save()


Any help would be greatly appreciated, and any input setting me off in
a different direction would be great also, i'm just kind of stumped at
this point.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to