Hi guys,
Following the API first mindset I created my first API with Django rest-framework. Using generic-views helps a lot and makes that a piece of cake, especially with the support of the community.
The challenge is now to create a nice UI for the API. Normally I would create the application with Django views and forms to realize the creation and modification of data and the Django templates in combination with the twitter bootstrap (normally I would not have an API!).
Since I want to offer people access to the API to automate things as well as to a frontend in case they do not need that, I would like to have URLs like /API/Users and /Users (non API use). To not rewrite the whole application in django, I would like to consume the API myself with the Django frontend and serve the data with the Django template language. Unfortunately I have not found out how to call the API from Django to post data from a form (PUT api calls) and to display data (GET API calls) and especially parse and transform the data to be used in the API and templates.
- Is there a way to consume the own API to not rewrite the whole part?
- Is there may be a better way? Learning node.js or stuff like that and hardcode the parameters and urls to build a frontend for the API seems like a waste of time?
Thank you very much.
Mike