- NapView now decorates the as_view response with except_response, instead of overriding dispatch.
- Simplified code that builds ModelMapper
nap.mapper.Field.setwill now be caught and raised as a
- Add MapperMixin.include_meta as an override to including meta in responses.
- Moved StreamingJSONResponse into nap.http.response
- Moved except_response into nap.http.decorators
- MapperMixin.get_meta(page) was added to allow customising of meta-data in response.
- MapperMixin no longer provides default values of None for mapper, object and object_list.
The prototype for context_field has been changed.
See documentation for details.
- Allow ModelMapper to inherit its Meta from a parent.
- Add tools to help support generators in JSON encoding
- Changed context_field to pass the Mapper._context as the last argument to the getter and setter methods.
- Added custom __set__ method for ToManyField so it can call set on the manager.
- Don’t replace inherited fields with auto-added model fields.
- Return a list of PKs if no Mapper provided to ToManyField
- Added pagination support to MapperMixin.multiple_response
- Import all fields into mapper namespace
- Allow passing **kwargs to all CBV valid_FOO methods.
- Call all() on Manager instances in ToManyfield
- Removed newrelic module, as it was only to support Publishers.
- Added nap.utils.NapJSONEncoder to support __json__ protocol.
- Fixed __new__ on field so subclasses work.
- Reworked context_field to work properly, and match docs.
- Using @foo.setter on a field will now retain other keyword arguments.
- RPCClient now sets Content-Type on request.
- Began documenting the extras module.
- Fixed ToOneField to reference self.related_model not self.model
- fields will now raise and error when trying to set a value with no setter.
- Include null in field constructor
- Set null correctly in fields on ModelMapper
- Handle null ForeignKey/OneToOneFields properly
- Dropped nap.utils.digattr and nap.mapper.fields.DigField
- Typed fields no longer special case None
Python and Django version support change
Support for Python2 has been dropped.
Support for Django 1.7 is no longer tested.
Another large code reorganisation was undertaken. DataMapper has been renamed to Mapper, and large amounts of its cod have been rewritten.
Filters are no longer supported.
- Added readonly attribute to Mapper.field
- Added readonly list to ModelMapper.Meta
- All MapperMixin.*_response methods now accept kwargs, and try to setdefault their default behaviour in it.
- In PUT/POST REST views, the *_valid methods now accept kwargs and pass them to their response class.
- Added RPC Client example code.
- Dropped deprecated test class.
- Corrected Mapper to work as documented for
obj = data << dm
- Handle None values properly in ModelFilter
- Added nap.http.except_response decorator to handle exceptional responses in view functions.
- Finished updating nap.extras.actions.ExportCsv to work with DataMappers.
v0.20.1 (2017-05-04) ... be with you!¶
- Remove default_app_config [Thanks nkuttler]
WARNING: Major Refactor
All code related to Publishers and Serialisers have been removed.
- Add a common base class HttpResponseError for Status 4xx and 5xx responses.
- JsonMixin imports settings late to avoid problems
- Removed backward compatibility shim for JsonResponse, now that we require Django 1.7
- Removed Publishers
- Removed Serialisers
- Removed auth - use Django’s built in mixins.
- Removed SerialisedResponseMixin
- Dropped support for testing in older Django
- Add ModelFilter to ForeignKeys in ModelDataMapper
- Allow passing kwargs to JsonMixin.loads and JsonMixin.dumps
- Added ability to change the response class used in auth decorators.
- Added >>= to ModelDataMapper to allow applying to new model instance.
- Add any fields not in a supplied Meta.fields for a ModelDataMapper to the excludes list to ensure model validation also excludes them.
- Fixed utils.JsonClient to actually work.
- Propery handle encoding in JsonMixin.get_request_data for PUT and PATCH.
- Added Ripper class to utils.
- Use six.moves.urllib instead of our own try/except on import
- Micro-optimisation: Calculate fields and field names for DataMappers at declatation
- Added NapView to nap.rest.views to handle when custom http responses are raised.
- Change default DELETE response to be empty
- Added nap.rest.views.NapView to catch and return nap.http.BaseHttpResponse exceptions as responses.
- Set safe=False in MapperMixin.empty_response
- Simplified auth.permit_groups
- On a DataMapper, if a Field’s default is callable, call it.
- Make _CastFiler and Date/Time filters skip to_python if value is of right type already.
- Allow passing extra arguments to MapperMinix.ok_response
- Add required and default options for datamapper.field
- Add LoginRequiredMixin and StaffRequiredMixin to nap.rest.auth
- Allow use of custom JSONEncoder/JSONDecoder with JsonMixin
- Make MapperMixin.single_response and MapperMixin.multiple_response get mapper, object, and queryset if none is provided.
- Dropped testing support for older versions of Django
- Added DataMapper tutorial to docs (Thanks limbera!)
- Added ModelFilter to DataMapper
- Reworked Publisher URLs to be easier to customise, and more consistent
- Added test module
- ModelDataMapper now creates a new Model instance if not passed one at construction.
- Pass list of excluded fields to Model.full_clean()
- Use six.string_types not str in flatten_errors
- Properly update error dict in ModelDataMapper._clean
- Add _clean method to DataMapper for whole-object cleaning.
- Make ModelDataMapper._clean call instance.full_clean.
- Fix ModelDataMapper to not get confused by
- Fix ListMixin.ok_response to call self.multiple_response not self.list_response
- Fix travis config
- Simplify AppConfig usage
- Switched from using Django’s HTTP reason phrases to Python’s.
- Tidied the abstractions of response helpers in django.rest.views.
- Added BaseListView and BaseObjectView to django.rest.views.
- Use our own get_object_or_404 shortcut in ModelPublisher.
- Fixed rest.views to closer match RFC [Thanks Ian Wilson]
- JsonMixin.get_request_data will now handle form encoded data for PUT
- Change API for datamapper to separate _apply and _patch.
WARNING: Removed module
The module nap.exceptions has been completely removed.
- Switched custom ValidationError / ValidationErrors to django’s ValidationError
- Added DataMapper library
- Added CBV mixins for composing API Views that use DataMappers
- Add required name attribute to AppConfig [thanks bobobo1618]
- Import REASON_CODES from Django
- Use Django’s JsonResponse if available, or our own copy of it.
- Unify all json handling functions into utils.JsonMixin
- Add RPCView introspection
- Use Django’s vendored copy of ‘six’
- Add new runtests script
- Cope with blank content encoding values in RPC Views
- Raise a 404 on invalid page_size value
- Validate the data we got in RPC View is passable as **kwargs
- ISO_8859_1 isn’t defined in older Django versions
- Emulate django template lookups in digattr by ignoring callables flagged ‘do_not_call_in_templates’
WARNING: API breakage
A large reorganisation of the code was undertaken.
Now there are 3 major top-level modules: - serialiser - rest - rpc
- Added functional RPC system [merged from django-marionette]
- Made most things accessible in top-level module
- Added Django 1.7 AppConfig, which will auto-discover on ready
- Added a default implementation of ModelPublsiher.list_post_default
- Tidied code with flake8
- Fixed use of wrong argument in auth.permit_groups
- Added prefetch_related and select_related support to ExportCsv action
- Added Field.virtual to smooth changes to Field now raising AttributeError, and support optional fields
- Added ReadTheDocs, and prettied up the docs
- Use Pythons content-type parsing
- Added RPC publisher [WIP]
- Allow api.register to be used as a decorator
- Make Meta classes more proscriptive
- Allow ModelSerialiser to override Field type used for fields.
- Added ModelReadSerialiser and ModelCreateUpdateSerialiser to support more complex inflate scenarios [WIP]
- Fixed ExportCsv and simplecsv extras
- Raise AttributeError if a deflating a field with no default set would result in using its default. [Fixes #28]
- Fixed auto-generated api_names.
- Purged under-developed ModelFormMixin class
- Overhauled testing
- Added ‘total_pages’ to page meta.
- Added Serialiser.obj_class
- Fix fix for b’’ from last release, to work in py2
- Fix use of b’’ for Py3.3 [thanks zzing]
- Add options to control patterns
- Return http.NotFound instead of raising it
- Added views publisher
- Updated docs
- Re-added support for ujson, if installed
- Tidied up with pyflakes/pylint
- Added Publisher.response_class property
- Make API return NotFound, instead of Raising it
- Remove bogus CSV Reader class
- Fixed typo
- Fixed resolving cache in mixin
- Separate Publisher.build_view from Publisher.patterns to ease providing custom patterns
- Added SimplePatternsMixin for Publisher
- Added Publisher.sort_object_list and Publisher.filter_object_list hooks
- Fixed silly bug in inflate
WARNING: API breakage
Changed auto-discover to look for ‘publishers’ instead of ‘seraliser’.
- Added Field.null support
- Now use the Field.default value
- ValidationError handled in all field and custom inflator methods
- Fix mistake introduced in 0.12.3 which broke NewRelic support
- Restored Django 1.4 compatibility
- Allow disabling of API introspection index
- Fixed filename generation in csv export action
- Fixed unicode/str issues with type() calls
- Split simplecsv and csv export into extras module
- Merged engine class directly into Publisher
- Added fields.StringField
- Fix argument handling in Model*SerialiserFields
- Tidied up with pyflakes
- Added support for Py3.3 [thanks ioneyed]
- Overhauled the MetaSerialiser class
- Overhauled “sandbox” app
- Added csv export action
- Support read_only in modelserialiser_factory
- Flatten url patterns so object_default can match without trailing /
- Fix class returned in permit decorator [Thanks emilkjer]
- Allow passing an alternative default instead of None for Publisher.get_request_data
- Added “read_only_fields” to ModelSerialiser [thanks jayant]
- Tune Serialisers to pre-build their deflater/inflater method lists, removing work from the inner loop
- Remove *args where it’s no helpful
- Renamed HttpResponseRedirect to HttpResponseRedirection to avoid clashing with Django http class
- Raise a 404 on paginator raising EmptyPage, instead of failing
- Fix arguments passed to execute method
- Add Publisher.execute to make wrapping handler calls easier [also, makes NewRelic simpler to hook in]
- Allow empty first pages in pagination
- Added support module for NewRelic
- Make content-type detection more forgiving
- Make get_page honor limit parameter, but bound it to max_page_size, which defaults to page_size
- Allow changing the GET param names for page, offset and limit
- Allow passing page+limit or offset+limit
- Added BooleanField
- Extended tests
- Force CSRF protection
- Changed SerialiserField/ManySerialiserField to replace reduce/restore instead of overriding inflate/deflate methods
- Fixed broken url pattern for object action
- Updated fields documentation
Serialiser.deflate_object and Serialiser.deflate_list have been renamed.
- Changed deflate_object and deflate_list to object_deflate and list_deflate to avoid potential field deflater name conflict
- Moved all model related code to models.py
- Added modelserialiser_factory
- Updated ModelSerialiserField/ModelManySerialiserField to optionally auto-create a serialiser for the supplied model
- Added python2.6 support back [thanks nkuttler]
- Added more documentation
- Added Publisher.get_serialiser_kwargs hook
- Publisher.get_data was renamed to Publisher.get_request_data for clarity
- Removed leftover debug print
- Added Publisher introspection
- Added LocationHeaderMixin to HTTP classes
- Removed useless cruft form utils
- Replaced http subclasses with Exceptional ones
- Wrap call to handlers to catch Exceptional http responses
- Started documentation
- Added permit_groups decorator
- Minor speedup in MetaSerialiser
- Fixed var name bug in ModelSerialiser.restore_object
- Removed old ‘may’ auth API
- Added permit decorators
- use string formatting not join - it’s slightly faster
- Added create/delete methods to ModelPublisher
- Renamed HttpResponse subclasses
- Split out BasePublisher class
- Added http.STATUS dict/list utility class
Because this uses OrderedDict nap is no longer python2.6 compatible
- Use first engine.CONTENT_TYPES as default content type for responses
- Removed custom JSON class
- Added Engine mixin classes
- Added MsgPack support
- Added type-casting fields
- Fixed JSON serialising of date/datetime objects
- Added index view to API
- Make render_single_object use create_response
- Allow create_response to use a supplied response class
- Added names to URL patterns
- Added “argument” URL patterns
- Added next/prev flags to list meta-data
- Added tests
- Changed to more generic extra arguments in Serialiser
- Fixed bug in serialiser meta-class that broke inheritance
- Fixed variable names
- Pass the Publisher down into the Serialiser for more flexibility
- Allow object IDs to be slugs
- Handle case of empty request body with JSON content type
- Added SerialiserField and ManySerialiserField
- Added Api machinery
- Changed Serialiser to use internal Meta class
- Added ModelSerialiser class
- Initial release, fraught with bugs :)