Thomas, Please read this page: http://www.django-rest-framework.org/api-guide/serializers/
*The serializers in REST framework work very similarly to Django's Form and ModelForm classes. We provide a Serializerclass which gives you a powerful, generic way to control the output of your responses, as well as a ModelSerializer class which provides a useful shortcut for creating serializers that deal with model instances and querysets.* You will also enjoy the browsable HTML interface of DRF that comes for free: http://www.django-rest-framework.org/api-guide/renderers/#browsableapirenderer good luck, Ian On Wednesday, August 30, 2017 at 8:28:48 AM UTC-4, Thomas Güttler wrote: > > > > Am Dienstag, 29. August 2017 15:17:38 UTC+2 schrieb Jeremy Stretch: >> >> A common pattern is to have a REST API (like DRF) return JSON-formatted >> data to the client, and use a front end library to render that data on the >> page. Here's an example using jQuery to retrieve and render a static JSON >> file: https://www.sitepoint.com/ajaxjquery-getjson-simple-example/ (In >> practice, you would replace the static JSON file with a dynamic API). >> >> Hope that helps! >> >> Jeremy >> >> > > Thank you Jeremy. > > If I go this way (sending data (not HTML) to the web client), then I will > miss the great django forms library. > > Is there an equivalent which works well with django-rest-framework? > > Regards, > Thomas Güttler > > > > >> On Tuesday, August 29, 2017 at 4:15:30 AM UTC-4, Thomas Güttler wrote: >>> >>> I use Post/Redirect/Get >>> <https://en.wikipedia.org/wiki/Post/Redirect/Get> since several years. >>> I use simple HTML forms (via ModelForm) with a plain old submit-button. >>> >>> Above pattern works. >>> >>> But I think the web of the future works different. >>> >>> Up to now my web application sends html to the web client. I think >>> modern web applications >>> don't send html, they send data (in json format). >>> >>> I guess in the future web clients render the (json) data using a >>> library/framework. >>> >>> For me this client-side rendering is completely new. I have no clue >>> where to start this adventure. >>> >>> I guess django-rest-framework could help on the server side.... >>> >>> Has anyone hints or practical experience? >>> >>> BTW, I asked the same question some days ago in the django user group: >>> https://groups.google.com/d/msg/django-users/DXF_jnb5Fow/kGefF8QYCAAJ >>> >> -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
