How to run ORM commands from DOM Javascript?

2019-04-09 Thread sairanganadh Narayana
I'm trying to get run model.objects.filter(id=2) from javascript and show on database. I am unable to get solution for this. Please guide me solution for this or alternative for this. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscr

Re: How to run ORM commands from DOM Javascript?

2019-04-09 Thread Robin Riis
in models.py you can define a 'as_json' function def as_json(self): return dict( identification_number = self.id awesome_picture = self.picture ) in views.py: class My_View(View): def get(self, request): if request.is_ajax(): q = request.GET.get('q

Re: How to run ORM commands from DOM Javascript?

2019-04-15 Thread sairanganadh Narayana
Thanks for your response. But, I need to run ORM(model.objects.filter(pk=1)) commands in javascript and show results in HTML pages. I was wrong in question. Please suggest any possibility. On Tuesday, April 9, 2019 at 5:51:24 PM UTC+5:30, Robin Riis wrote: > > in models.py you can define a 'as_

Re: How to run ORM commands from DOM Javascript?

2019-04-15 Thread Sithembewena L. Dube
You cannot run Django's Python code in JavaScript in a browser. The advice you have been given applies. Kind regards, Sithu *Sent with Shift