Skip to content

An experiment in adding nested form/querystring support to Django, and what that might allow for

Notifications You must be signed in to change notification settings

kezabelle/django-formality

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 

Repository files navigation

django-formality

Author: Keryn Knight
Version: 0.1.0

If Django had support for parsing nested query-string and form-encoded data, and the existing Forms API supported nested data, what would that look like, and how much of a RESTy API could be built on such?

Brief

Currently, this is just a parser capable of dumping structured query-string data in the form of:

a[][item]=4&a[][item]=5&a[][item]=6

into a data-structure like:

{'a': [{'item': 4}, {'item': 5}, {'item': 6}]}

It mostly tries to conform sensibly(ish) to Rack and jQuery-BBQ (and is in fact a semi-transliteration of the latter) but skirts certain edge cases I'm not brainy enough to solve ... That basically means I'll throw an exception for "malformed" data.

Eventually, I've got plans for a bunch more. But this is absolutely currently just an experiment in how far I'll be able to take things

Goals

An optimistic list of the things I'd like this to achieve, regardless of if I currently know how. Off the top of my head:

  • Nested structure support for normal web forms & query strings, like PHP, Rack and jQuery-BBQ have.
  • The ability to use the Forms API to describe nested data, for both input parsing and output.
  • Flexible parsing and content-negotiation based on those Forms.
  • OpenAPI generation from the very same Forms, so I can have nice Swagger UI or ReDoc output.
    • Ideally, I want the ability to do this for anything I can detect as being a form-based view.

About

An experiment in adding nested form/querystring support to Django, and what that might allow for

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages