I'm making something easy that is adding numbers to a list in Zago. However, whenever I try to convert a float string value and convert it, it's throwing an error. It's easy to see in code.
First of my thoughts:
def submitworkout (requested): user = User.objects.get (username = request.session ['username']) bodyweight = request. Get [ 'weight'] repinputboxes = request.GET [ 'repinputboxes'] = try yoga (list (Repinputboxes)) Totalreps: leaving the boat (weight): weight = none W = workout (userid = user.id, datesubmitted = datetime .datetime.now (), workoutdate = request.GET [ 'workoutdate'], weight = weight, totalreps = totalreps, totalweight = sum (request.GET [ 'weightinputboxes']), numexercises = int (request.GET [ "Numecssersises']), Numsets = Summtion (Rikvestkget [ 'Numsets'])) # Vksev () # Vorkotid = Vrkautkobjektskget (id = Vkid) #kreatecssersise (dict (Rikvestkget ), User.id, workoutid.id) Returns render_to_response ('home.html', {'infoprompt': request.GET}, context_instance = Re The following traceback is: Code> Environment: Request method: Received Rake URL: http: // localhost: 8000 / submitworkout / workoutdate = & amp; Weight = & amp; Numexercises = 1 & amp; Exercicesame = b & amp; amp; Numsets = 1 & amp; Weightinputboxes = 32.5 & amp; Repinputboxes = 1 Django version:? 1.3.1 Python version 2.7.0 installed applications: ( 'django.contrib.auth', 'django.contrib.contenttypes',' django.contrib.sessions', 'django.contrib.sites',' django. contrib.messages ',' Django .contrib.staticfiles ',' django.contrib.admin ',' certification ',' tracking ') established middleware: (' django.middleware.common.CommonMiddleware ',' django.contrib.sessions. middleware.SessionMiddleware ',' Django .middleware.csrf.CsrfViewMiddleware ',' django.contrib.auth.middleware.AuthenticationMiddleware ',' django.contrib.messages.middleware.MessageMiddleware ') Traceback: file "C: \ Python27 \ lib \ Site-package \ Django \ core \ handlers \ base.py "get_response 111. response = callback (request, * callback, ** callback_keyworks) file" : \ Users \ Chris \ Test Dijenjo \ Fitness \ ideas Sbmitvrkaut in "45. totalweight = summation (reques) T. GET ['VatinoteBoxes']), File "C: \ Users \ Chris \ Testedgego \ Fitness \ Ideas" in the equation 89. suma + = float (i) Exception type: Value on / Bestworkwork / Exception value: String changed to float Do not:
And last but at least my local var is giving me the problem:
weightinputboxes = u'32.5 ' I had another strange error like this before it was resolved here:
And I think that This is similar to that issue. However, I still can not understand it.
Thanks guys!
It is written using the most built-in sum and the getlist method < Code> request.GET sum (map, float, request.GET.getlist ('weightinputboxes')))
Comments
Post a Comment