I need convert this django code to mongoose nextjs
BonusRefill.objects.values('user').order_by('user').annotate(total_price=Sum('amount')).order_by('total_price').last()
i tried this but not working
BonusRefill.find().sort('user')
Related
I want to build an app that will use a database.
I already build few of them, with models, views, urls... But I discovered that I can build my own API using Django Rest and use this API in my Django project. So if I undersand I will have to separate apps: -an API and my Django app and all my models and database related datas will be in my API app.
If I want to use vue.js for the frontend in my Django app, using an API will make eveything simpler to implement?
I know we can use django rest framework for creating API for normal data. But I'm confused can we use django rest framework for geojson data. I'm mean i want to build location based web app using django and I also want to manipulate the data from android app or ios app. So here I'm confused can i use django rest framework or somethings else. Here I'm using PostgreSQL and postgis for data storage.
I've almost finished developing my frontend in Angular 2 using static json files as API mocks. Now I want to use it with my real API from Django, and I'm struggling with few issues, since it is my first Angular 2 frontend.
I've moved whole Angular project generated by Angular CLI as frontend directory within my Django project. Django is exposing API at /api, and I want to perform request to that API from Angular. In production, Angular sources will be transpiled into javascript and moved into static (i guess), but I don't know how to handle it during development.
Is it possible to run Django development server with Angular ng serve on the same port at the same time? If I'll run them at different ports, I will need to hardcode my API url in frontend, and enable CORS which won't be enabled in production.
What are the best practices to develop Angular with Django?
I've worked with Django for web apps but now i have to implement it in my mobile application that is use django as the backend for my application.
Can anyone please suggest how to integrate django with ionic 2 ?
you need to create an api for your app to consume the back-end data.
You can use Django-rest-framework: http://www.django-rest-framework.org/
take a look at ionic with Django backend and Django Rest Backend
We're about to develop a web-application using Django and also develop the mobile application for the same using PhoneGap later. So, essentially I would be using the front end pages that I develop using Django for the PhoneGap project as well.
How would Django templates work with PhoneGap? Since PhoneGap takes in only static web pages (in the form of HTML,CSS and JS), what should be done to resolve this issue with Django templates and PhoneGap compliance?
You couldn't just compile your Django app into hybrid Apps. PhoneGap wouldn't run or compile any server side code, so you can't use Django templates.
But you can integrate your PhoneGap app to current Django app by using REST API. You can do Ajax request to your Django app.