One of my functions returns a ‘msg’ object… which is merely a string.
I got into 2 for loops in the function.
msg=''
for e in example:
msg+= "some crap"
msg+= "some crap1"
for sl in somelist
msg+= v.somevalue
msg+="-------------"
return httpresponse(msg)
There’s an example of the code.
‘somelist’ contains two values… when the ‘msg’ returns it only returns the second of the two values! I’m rather confused.
If your code is exactly like that, it should work just like you want it to. However, as this clearly isn’t the actual code, I’d guess you have msg = … somewhere, when you should have msg += … At least that’s the most likely reason for the behaviour you’re seeing.
If you have trouble finding where it goes wrong, put in there some “print msg” statements and test it by running your Django project in development server. You’ll see where it goes wrong.