Skip to content
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

Override fields not init #7

Closed
wants to merge 10 commits into from

Commits on Feb 7, 2017

  1. added app config file

    Jervis Whitley committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    eacd6a3 View commit details
    Browse the repository at this point in the history
  2. Failing test shows serializer keyerror when nested.

    Jervis Whitley committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    334cf2a View commit details
    Browse the repository at this point in the history
  3. the test case should pass now if there were no bug.

    Jervis Whitley committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    a3c70e0 View commit details
    Browse the repository at this point in the history
  4. avoid access to self.context - it is cached.

    Prevent access to it, since it will be run and cached even when
    serializer is initialized as nested.
    Jervis Whitley committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    478baa9 View commit details
    Browse the repository at this point in the history
  5. added some sanity checks for normal operation.

    Jervis Whitley committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    aa1fae6 View commit details
    Browse the repository at this point in the history
  6. warn only if the params/GET attributes are missing from request.

    Previously it would warn if they were present but empty.
    jtrain committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    d71f829 View commit details
    Browse the repository at this point in the history
  7. override fields not __init__.

    __init__ is called when creating the serializer instance. It can be
    during the request cycle or at django start time (nested serializer).
    
    Instead do the fields filtering logic directly in the `fields` property.
    Internal and external methods and properties use this public API for
    working with fields. It should be safe to assume `fields` is only
    accessed during the request cycle, so fetching `self.context` is
    assumed safe.
    Jervis Whitley committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    da85b37 View commit details
    Browse the repository at this point in the history
  8. prevent filtering before request cycles have begun.

    This situation would occur if someone was accessing `fields` during
    their own custom __init__ method.
    jtrain committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    9456e92 View commit details
    Browse the repository at this point in the history
  9. This came from using the cookie-cutter template

    I'm not convinced it is required.
    jtrain committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    28ed1a5 View commit details
    Browse the repository at this point in the history
  10. try to keep the linter happy in github.

    I thought the code quality was good, but it requires docstrings on
    everything.
    jtrain committed Feb 7, 2017
    Configuration menu
    Copy the full SHA
    e08ccda View commit details
    Browse the repository at this point in the history