Skip to content

Introducing Deserializers, and improving core `@api_view` decorators

Pre-release
Pre-release
Compare
Choose a tag to compare
@alaouimehdi1995 alaouimehdi1995 released this 22 Apr 07:45
· 40 commits to master since this release
b4bd36d

Main changes:

  • Implementing the first Deserializerclass
  • Assuring support for all python's versions (2.7+, 3+), and django's versions (1.11+).
  • Type hinting to improve code's readability.

Core @api_view changes:

  • Supporting deserializer_class parameter.
  • Supporting deserializer class mapping (custom deserializers for each http method).
  • Adding allow_forms parameter to accept forms data or raise error.
  • Supporting for @api_view syntax (only @api_view() was supported before)
  • Checking view's type to make sure it's either a function or a django.views.View class
  • Normalizing requests payload between content_types, so that the output's always in the same format.
  • Extracting query params and passing custom parameters for the view (query params, payload, url params, etc.).
  • Decorating only class view's relevant methods (http methods) instead of all methods.
  • Moving helpers function into separate file.