I'm trying to view a python list of objects that was a part of some input in an html form:
$('input[name=my_array]').serializeObject()
where my input tag would be something like this:
<input type="hidden" name="my_array" value="{{ my_array_of_objects }}">
But I'm just getting something like this:
[<object_type: an_object object>]
So I can't access any properties of this object. Is there a way to convert this to where I can view what these are referencing to? I've been able to iterate over them in previous instances, and access their properties in my HTML file:
{% for o in my_array_of_objects %}
<li> o.id, o.first_name, o.last_name </li>
{% endfor %}
So is there a similar way I can access this object in javascript? Sorry if this is noob question.
EDIT: Here is a sample of what I'm trying to pass. I'm using a django rest framework, where my objects are stored in a SQLDB, under python classes like so:
class my_object(models.Model):
study_id = models.CharField(max_length = 30, blank = True)
g1 = models.ForeignKey(G1)
g2 = models.ForeignKey(G2)
title = models.IntegerField(choices = TITLE_CHOICES)
family = models.IntegerField(choices = FAMILY_CHOICES)
and when a I render some page, I create a list of these objects that I need, let's just call it my_list_of_objects
. So, in the HTML form, I have an input:
<input type="hidden" name="my_list" value="{{ my_list_of_objects }}">
and when I try to reference this value on the JavaScript side after I submit my form, all I get is a list of
my_list_of_objects =[<my_object: my_object object>, <my_object: my_object object>, ...]