I am not an expert in javascript but I am trying to learn bit by bit.
I am trying to add a search function for my project, so I am starting by sending the item list to JSON using the following:
views.py
class ItemListView(ListView):
model = Item
paginate_by = 12
template_name = "store/product_list.html"
ordering = ['-timestamp']
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["qs_json"] = json.dumps(list(Item.objects.values()))
return context
but I keep receiving an error Object of type Decimal is not JSON serializable
My question: Why am I receiving this error although I am following a tutorial and this error didn't show up and how do I fix it?