New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make default serialization formats use a Django setting #833

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
1 participant
@acdha
Copy link
Contributor

acdha commented Feb 22, 2013

While it's possible to configure or subclass Serializer to accomplish the same
goal (or will be when #817 lands) that requires repetitive code changes for a
simple site policy like 'We only support JSON and XML', which can now be as
simple as adding a setting:

TASTYPIE_DEFAULT_FORMATS = ['json', 'xml']

Changes:

  • Serializer: init will apply TASTYPIE_DEFAULT_FORMATS when
    self.formats is the default Serializer.formats
  • Serializer: restructured init to improve locality for format-
    related settings
  • Restructured serializers documentation so format-related info is
    in one place & added a link to the new setting doc for
    TASTYPIE_DEFAULT_FORMATS
Make default serialization formats use a Django setting
While it's possible to configure or subclass Serializer to accomplish
the same goal (or will be when #817 lands) that requires repetitive code
changes for a simple site policy like 'We only support JSON and XML',
which can now be as simple as adding a setting::

    TASTYPIE_DEFAULT_FORMATS = ['json', 'xml']

Changes:
* Serializer: __init__ will apply TASTYPIE_DEFAULT_FORMATS when
  self.formats is the default Serializer.formats
* Serializer: restructured __init__ to improve locality for format-
  related settings
* Restructured serializers documentation so format-related info is
  in one place & added a link to the new setting doc for
  TASTYPIE_DEFAULT_FORMATS

@acdha acdha closed this in 905ae88 Mar 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment