7👍
✅
Try this instead:
data = serializers.serialize('json', events)
The error message you got is telling you that events
is already a QuerySet, there is no reason to try and do anything more with it.
You could also revisit your earlier attempt:
{% for object in objects %}
var date = object.date // assuming object has a column named date
{% endfor %}
You need to actually use the Django object
like this:
{% for object in objects %}
var date = {{ object.date }}
{% endfor %}
The way you were doing it before object
would simply be undefined
and you would get the error cannot read property date of undefined
Source:stackexchange.com