GET /api/v2/video/1388
HTTP 200 OK Vary: Accept Content-Type: text/html; charset=utf-8 Allow: GET, PUT, PATCH, HEAD, OPTIONS
{ "category": "DjangoCon 2012", "language": "English", "slug": "django-forms-in-a-web-api-world", "speakers": [ "Tareque Hossain" ], "tags": [ "django", "django-forms" ], "id": 1388, "state": 1, "title": "Django forms in a web API world", "summary": "In a world of django powered web APIs and arbitrary consumers, traditional\nmethods of rendering & validating django forms are ineffective. We discuss how\nto uphold the API provider/ consumer separation, yet utilize provider's django\nform subsystem to power forms in a pure JS consumer. We achieve this by\nserializing form configurations, rendering metadata, error handlers & exposing\nthem over API.\n\n", "description": "In our quest to modularize the architecture of web applications, we create\nself-containing backend systems that provide web APIs for programmatic\ninteractions. This gives us the flexibility to separate different system\ncomponents. A system with multiple backend components e.g. user profile\nengine, content engine, community engine, analytics engine may have a single\nfrontend application that fetches data from all of these components using\nrespective web APIs.\n\nWith the increased availability of powerful JavaScript frameworks, such\nfrontend applications are often purely JS based to decrease application\nfootprint, increase deployment flexibility and separate presentation from\ndata. The separation is very rewarding from a software engineering standpoint\nbut imposes several limitations on system design. Using django to construct\nthe API for arbitrary consumers comes with the limitation of not being able to\nutilize the powerful django form subsystem to drive forms on these consumers.\nBut is there a way to overcome this restriction?\n\nThis is not a trivial problem to solve and there are only a few assumptions we\ncan make about the web API consumer. It can be a native mobile or desktop -\napplication or browser. We advocate that web APIs should provide sufficient\ninformation about 'forms' so that they can be faithfully reproduced at the\nconsumer end.\n\nEven in a API backend built using django, forms are essential for accepting,\nfiltering, processing and saving data. The django form subsystem provides many\nuseful features to accomplish these tasks. At the same time it facilitates the\nprocess of rendering the form elements in a browser environment. The concepts\nof form fields combined with widgets can go a long way in streamlining the\ninterface to interact with data.\n\nWe propose an architecture to serialize information about django forms (to\nJSON) in a framework independent fashion so that it can be consumed by any\nfrontend application that renders HTML. Such information includes but is not\nlimited to basic form configurations, security tokens (if necessary),\nrendering metadata and error handling instructions. We lovingly name this\narchitecture - django-remote-forms.\n\nAt WiserTogether, we are in the process of building a component based\narchitecture that strictly provides data endpoints for frontend applications\nto consume. We are working towards developing our frontend application for web\nbrowsers using backbone.js as MVC and handlebars as the templating engine.\ndjango-remote-forms helps us streamline our data input interface with the\ndjango forms living at the API backend.\n\nIn this talk we detail the architecture of our components, the mechanism of\ndelivering django form metadata over API and a backbone.js/ handlebars\nimplementation to consume the metadata and reproduce forms.\n\n", "quality_notes": "", "copyright_text": "Creative Commons Attribution license (reuse allowed", "embed": "<object width=\"640\" height=\"390\"><param name=\"movie\" value=\";hl=en_US\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\";hl=en_US\" type=\"application/x-shockwave-flash\" width=\"640\" height=\"390\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed></object>", "thumbnail_url": "", "duration": null, "video_ogv_length": null, "video_ogv_url": null, "video_ogv_download_only": false, "video_mp4_length": null, "video_mp4_url": null, "video_mp4_download_only": false, "video_webm_length": null, "video_webm_url": null, "video_webm_download_only": false, "video_flv_length": null, "video_flv_url": null, "video_flv_download_only": false, "source_url": "", "whiteboard": "needs editing", "recorded": "2012-09-05", "added": "2012-10-08T17:39:49", "updated": "2014-04-08T20:28:26.986" }