Friday, May 28, 2010

Getting brackets at the end of your Keys?

I'm having to, in Javascript, create a dictionary ( my_dict = {} ),
then put in some Arrays.

my_dict["stringkey"] = Array("hey","hey1")
my_dict["stringkey1"] = Array("more","stuff")


In the views function:

for key in request.POST:
prop_rec = request.POST.getlist(key)


The Python var, "prop_rec" has the array contents that I'm
expecting.

However, I also need to use "key". But when I'm sending over stuff
from javascript like above,
the key has a "[]" tacked on the end of it, like "stringkey[]"

If I code the normal in js:
my_dict["stringkey"] = "1",
then if I do a print key in the views function, I don't get
the brackets at the end

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment