[
  {
    "path": ".gitattributes",
    "content": "docs/theme/src/drf-logos.fig filter=lfs diff=lfs merge=lfs -text\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: [browniebroke]\nopen_collective: django-rest-framework\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: false\ncontact_links:\n- name: Discussions\n  url: https://github.com/encode/django-rest-framework/discussions\n  about: >\n    The \"Discussions\" forum is where you want to start. 💖\n    Please note that at this point in its lifespan, we consider Django REST framework to be feature-complete.\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "# Keep GitHub Actions up to date with GitHub's Dependabot...\n# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot\n# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem\nversion: 2\nupdates:\n  - package-ecosystem: github-actions\n    directory: /\n    groups:\n      github-actions:\n        patterns:\n          - \"*\"  # Group all Action updates into a single larger pull request\n    schedule:\n      interval: weekly\n    cooldown:\n      default-days: 7\n  \n  - package-ecosystem: \"pip\"\n    directory: \"/\"\n\n    groups:\n      test:\n        patterns:\n          - \"pytest*\"\n          - \"attrs\"\n          - \"importlib-metadata\"\n          - \"pytz\"\n\n      docs:\n        patterns:\n          - \"mkdocs\"\n          - \"pylinkvalidator\"\n\n      optional:\n        patterns:\n          - \"django-filter\"\n          - \"django-guardian\"\n          - \"inflection\"\n          - \"legacy-cgi\"\n          - \"markdown\"\n          - \"psycopg*\"\n          - \"pygments\"\n          - \"pyyaml\"\n\n    schedule:\n      interval: weekly\n    cooldown:\n      default-days: 7\n"
  },
  {
    "path": ".github/release.yml",
    "content": "changelog:\n  exclude:\n    labels:\n      - dependencies\n      - Internal\n      - CI\n      - Documentation\n    authors:\n      - dependabot[bot]\n      - pre-commit-ci[bot]\n  categories:\n    - title: Breaking changes\n      labels:\n        - Breaking\n    - title: Features\n      labels:\n        - Feature\n    - title: Bug fixes\n      labels:\n        - Bug\n    - title: Translations\n      labels:\n        - Translations\n    - title: Packaging\n      labels:\n        - Packaging\n    - title: Other changes\n      labels:\n        - '*'"
  },
  {
    "path": ".github/stale.yml",
    "content": "# Documentation: https://github.com/probot/stale\n\n# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 60\n\n# Number of days of inactivity before a stale issue is closed\ndaysUntilClose: 7\n\n# Comment to post when marking an issue as stale. Set to `false` to disable\nmarkComment: >\n  This issue has been automatically marked as stale because it has not had\n  recent activity. It will be closed if no further activity occurs. Thank you\n  for your contributions.\n\n# Comment to post when closing a stale issue. Set to `false` to disable\ncloseComment: false\n\n# Limit the number of actions per hour, from 1-30. Default is 30\nlimitPerRun: 1\n\n# Label to use when marking as stale\nstaleLabel: stale\n"
  },
  {
    "path": ".github/workflows/main.yml",
    "content": "name: CI\n\non:\n  push:\n    branches:\n    - main\n  pull_request:\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\njobs:\n  pre-commit:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v6\n        with:\n          fetch-depth: 0\n\n      - uses: actions/setup-python@v6\n        with:\n          python-version: \"3.10\"\n\n      - uses: pre-commit/action@v3.0.1\n\n  tests:\n    name: Python ${{ matrix.python-version }}\n    runs-on: ubuntu-24.04\n\n    strategy:\n      matrix:\n        python-version:\n        - '3.10'\n        - '3.11'\n        - '3.12'\n        - '3.13'\n        - '3.14'\n\n    steps:\n    - uses: actions/checkout@v6\n\n    - uses: actions/setup-python@v6\n      with:\n        python-version: ${{ matrix.python-version }}\n        allow-prereleases: true\n        cache: 'pip'\n\n    - name: Upgrade packaging tools\n      run: python -m pip install --upgrade pip setuptools virtualenv wheel\n\n    - name: Install dependencies\n      run: python -m pip install --upgrade tox\n\n    - name: Run tox targets for ${{ matrix.python-version }}\n      run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d . | cut -f 1 -d '-')\n\n    - name: Run extra tox targets\n      if: ${{ matrix.python-version == '3.13' }}\n      run: |\n        tox -e base,dist,docs\n\n    - name: Upload coverage\n      uses: codecov/codecov-action@v5\n      with:\n        env_vars: TOXENV,DJANGO\n\n  test-docs:\n    name: Test documentation links\n    runs-on: ubuntu-24.04\n    steps:\n    - uses: actions/checkout@v6\n\n    - uses: actions/setup-python@v6\n      with:\n        python-version: '3.13'\n\n    - name: Install dependencies\n      run: pip install --group docs\n    \n    # Start mkdocs server and wait for it to be ready\n    - run: mkdocs serve &\n    - run: WAIT_TIME=0 && until nc -vzw 2 localhost 8000 || [ $WAIT_TIME -eq 5 ]; do sleep $(( WAIT_TIME++ )); done\n    - run: if [ $WAIT_TIME == 5 ]; then echo cannot start mkdocs server on http://localhost:8000; exit 1; fi\n    \n    - name: Check links\n      run: pylinkvalidate.py -P http://localhost:8000/\n  \n    - run: echo \"Done\"\n"
  },
  {
    "path": ".github/workflows/mkdocs-deploy.yml",
    "content": "name: mkdocs\n\non:\n  push:\n    branches:\n      - main\n    paths:\n      - docs/**\n      - docs_theme/**\n      - pyproject.toml\n      - mkdocs.yml\n      - .github/workflows/mkdocs-deploy.yml\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    environment: github-pages\n    permissions:\n      contents: write\n    concurrency:\n      group: ${{ github.workflow }}-${{ github.ref }}\n    steps:\n      - uses: actions/checkout@v6\n      - run: git fetch --no-tags --prune --depth=1 origin gh-pages\n      - uses: actions/setup-python@v6\n        with:\n          python-version: 3.x\n      - run: pip install --group docs\n      - run: mkdocs gh-deploy\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Publish Release\n\nconcurrency:\n  # stop previous release runs if tag is recreated\n  group: release-${{ github.ref }}\n  cancel-in-progress: true\n\non:\n  push:\n    tags:\n      # Order matters, the last rule that applies to a tag\n      # is the one that takes effect:\n      # https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-including-and-excluding-branches-and-tags\n      - '*.*.*'\n      # There should be no dev tags created, but to be safe,\n      # let's not publish them.\n      - '!*.*.*.dev*'\n\nenv:\n  PYPI_URL: https://pypi.org/p/djangorestframework\n  PYPI_TEST_URL: https://test.pypi.org/p/djangorestframework\n\njobs:\n  build:\n    name: Build distribution 📦\n    runs-on: ubuntu-24.04\n    steps:\n      - uses: actions/checkout@v6\n      - name: Set up Python\n        uses: actions/setup-python@v6\n        with:\n          python-version: \"3.x\"\n      - name: Install pypa/build\n        run: python3 -m pip install build\n      - name: Build a binary wheel and a source tarball\n        run: python3 -m build\n      - name: Store the distribution packages\n        uses: actions/upload-artifact@v7\n        with:\n          name: python-package-distributions\n          path: dist/\n\n  publish-to-testpypi:\n    name: Publish Python 🐍 distribution 📦 to TestPyPI\n    needs:\n      - build\n    runs-on: ubuntu-24.04\n    environment:\n      name: testpypi\n      url: ${{ env.PYPI_TEST_URL }}\n    permissions:\n      id-token: write  # IMPORTANT: mandatory for trusted publishing\n    steps:\n      - name: Download all the dists\n        uses: actions/download-artifact@v8\n        with:\n          name: python-package-distributions\n          path: dist/\n      - name: Publish distribution 📦 to TestPyPI\n        uses: pypa/gh-action-pypi-publish@release/v1.13\n        with:\n          repository-url: https://test.pypi.org/legacy/\n          skip-existing: true\n\n  publish-to-pypi:\n    name: Publish Python 🐍 distribution 📦 to PyPI\n    needs:\n      - build\n      - publish-to-testpypi\n    runs-on: ubuntu-24.04\n    environment:\n      name: pypi\n      url: ${{ env.PYPI_URL }}\n    permissions:\n      id-token: write  # IMPORTANT: mandatory for trusted publishing\n    steps:\n      - name: Download all the dists\n        uses: actions/download-artifact@v8\n        with:\n          name: python-package-distributions\n          path: dist/\n      - name: Publish distribution 📦 to PyPI\n        uses: pypa/gh-action-pypi-publish@release/v1.13\n\n  github-release:\n    name: >-\n      Sign the Python 🐍 distribution 📦 with Sigstore\n      and upload them to GitHub Release\n    needs:\n      - publish-to-pypi\n    runs-on: ubuntu-24.04\n    permissions:\n      contents: write  # IMPORTANT: mandatory for making GitHub Releases\n      id-token: write  # IMPORTANT: mandatory for sigstore\n    steps:\n      - name: Download all the dists\n        uses: actions/download-artifact@v8\n        with:\n          name: python-package-distributions\n          path: dist/\n      - name: Sign the dists with Sigstore\n        uses: sigstore/gh-action-sigstore-python@v3.2.0\n        with:\n          inputs: >-\n            ./dist/*.tar.gz\n            ./dist/*.whl\n      - name: Create GitHub Release\n        env:\n          GITHUB_TOKEN: ${{ github.token }}\n        run: >-\n          gh release create\n          '${{ github.ref_name }}'\n          --repo '${{ github.repository }}'\n          --generate-notes\n      - name: Upload artifact signatures to GitHub Release\n        env:\n          GITHUB_TOKEN: ${{ github.token }}\n        # Upload to GitHub Release using the `gh` CLI.\n        # `dist/` contains the built packages, and the\n        # sigstore-produced signatures and certificates.\n        run: >-\n          gh release upload\n          '${{ github.ref_name }}' dist/**\n          --repo '${{ github.repository }}'\n"
  },
  {
    "path": ".gitignore",
    "content": "*.pyc\n*.db\n*~\n*.py.bak\n\n\n/site/\n/htmlcov/\n/coverage/\n/build/\n/dist/\n/*.egg-info/\n/env/\nMANIFEST\ncoverage.*\n.coverage\n.cache/\n\n!.github\n!.gitignore\n!.pre-commit-config.yaml\n"
  },
  {
    "path": ".pre-commit-config.yaml",
    "content": "repos:\n- repo: https://github.com/pre-commit/pre-commit-hooks\n  rev: v6.0.0\n  hooks:\n  - id: check-added-large-files\n  - id: check-case-conflict\n  - id: check-json\n  - id: check-merge-conflict\n  - id: check-symlinks\n  - id: check-toml\n- repo: https://github.com/PyCQA/isort\n  rev: 7.0.0\n  hooks:\n  - id: isort\n- repo: https://github.com/PyCQA/flake8\n  rev: 7.3.0\n  hooks:\n  - id: flake8\n    additional_dependencies:\n    - flake8-tidy-imports\n    - flake8-bugbear\n- repo: https://github.com/adamchainz/blacken-docs\n  rev: 1.20.0\n  hooks:\n  - id: blacken-docs\n    additional_dependencies:\n    - black==26.1.0\n- repo: https://github.com/codespell-project/codespell\n  # Configuration for codespell is in pyproject.toml\n  rev: v2.4.1\n  hooks:\n  - id: codespell\n    additional_dependencies:\n      # python doesn't come with a toml parser prior to 3.11\n      - \"tomli; python_version < '3.11'\"\n- repo: https://github.com/asottile/pyupgrade\n  rev: v3.21.2\n  hooks:\n  - id: pyupgrade\n    args: [\"--py310-plus\", \"--keep-percent-format\"]\n- repo: https://github.com/tox-dev/pyproject-fmt\n  rev: v2.11.1\n  hooks:\n  - id: pyproject-fmt\n"
  },
  {
    "path": ".readthedocs.yaml",
    "content": "# Read the Docs configuration file\n# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details\n\n# Required\nversion: 2\n\n# Set the OS, Python version, and other tools you might need\nbuild:\n  os: ubuntu-24.04\n  tools:\n    python: \"3.13\"\n  jobs:\n    install:\n      - pip install --upgrade pip\n      - pip install -e . --group docs\n\n# Build documentation with Mkdocs\nmkdocs:\n   configuration: mkdocs.yml\n"
  },
  {
    "path": ".tx/config",
    "content": "[main]\nhost = https://www.transifex.com\nlang_map = sr@latin:sr_Latn, zh-Hans:zh_Hans, zh-Hant:zh_Hant\n\n[django-rest-framework.djangopo]\nfile_filter = rest_framework/locale/<lang>/LC_MESSAGES/django.po\nsource_file = rest_framework/locale/en_US/LC_MESSAGES/django.po\nsource_lang = en_US\ntype = PO\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to REST framework\n\nAt this point in its lifespan we consider Django REST framework to be essentially feature-complete. We may accept pull requests that track the continued development of Django versions, but would prefer not to accept new features or code formatting changes.\n\nApart from minor documentation changes, the [GitHub discussions page](https://github.com/encode/django-rest-framework/discussions) should generally be your starting point. Please only open a pull request if you've been recommended to do so **after discussion**.\n\nThe [Contributing guide in the documentation](https://www.django-rest-framework.org/community/contributing/) gives some more information on our process and code of conduct.\n"
  },
  {
    "path": "LICENSE.md",
    "content": "# License\n\nCopyright © 2011-present, [Encode OSS Ltd](https://www.encode.io/).\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n  contributors may be used to endorse or promote products derived from\n  this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "MANIFEST.in",
    "content": "recursive-include tests/ *\nglobal-exclude __pycache__\nglobal-exclude *.py[co]\n"
  },
  {
    "path": "PULL_REQUEST_TEMPLATE.md",
    "content": "*Note*: Before submitting a code change, please review our [contributing guidelines](https://www.django-rest-framework.org/community/contributing/#pull-requests).\n\n## Description\n\nPlease describe your pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue. When linking to an issue, please use `refs #...` in the description of the pull request.\n"
  },
  {
    "path": "README.md",
    "content": "# [Django REST framework][docs]\n\n[![build-status-image]][build-status]\n[![coverage-status-image]][codecov]\n[![pypi-version]][pypi]\n\n**Awesome web-browsable Web APIs.**\n\nFull documentation for the project is available at [https://www.django-rest-framework.org/][docs].\n\n---\n\n# Overview\n\nDjango REST framework is a powerful and flexible toolkit for building Web APIs.\n\nSome reasons you might want to use REST framework:\n\n* The Web browsable API is a huge usability win for your developers.\n* [Authentication policies][authentication] including optional packages for [OAuth1a][oauth1-section] and [OAuth2][oauth2-section].\n* [Serialization][serializers] that supports both [ORM][modelserializer-section] and [non-ORM][serializer-section] data sources.\n* Customizable all the way down - just use [regular function-based views][functionview-section] if you don't need the [more][generic-views] [powerful][viewsets] [features][routers].\n* [Extensive documentation][docs], and [great community support][group].\n\n**Below**: *Screenshot from the browsable API*\n\n![Screenshot][image]\n\n----\n\n# Requirements\n\n* Python 3.10+\n* Django 4.2, 5.0, 5.1, 5.2, 6.0\n\nWe **highly recommend** and only officially support the latest patch release of\neach Python and Django series.\n\n# Installation\n\nInstall using `pip`...\n\n    pip install djangorestframework\n\nAdd `'rest_framework'` to your `INSTALLED_APPS` setting.\n\n```python\nINSTALLED_APPS = [\n    # ...\n    \"rest_framework\",\n]\n```\n\n# Example\n\nLet's take a look at a quick example of using REST framework to build a simple model-backed API for accessing users and groups.\n\nStart up a new project like so...\n\n    pip install django\n    pip install djangorestframework\n    django-admin startproject example .\n    ./manage.py migrate\n    ./manage.py createsuperuser\n\n\nNow edit the `example/urls.py` module in your project:\n\n```python\nfrom django.contrib.auth.models import User\nfrom django.urls import include, path\nfrom rest_framework import routers, serializers, viewsets\n\n\n# Serializers define the API representation.\nclass UserSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = User\n        fields = [\"url\", \"username\", \"email\", \"is_staff\"]\n\n\n# ViewSets define the view behavior.\nclass UserViewSet(viewsets.ModelViewSet):\n    queryset = User.objects.all()\n    serializer_class = UserSerializer\n\n\n# Routers provide a way of automatically determining the URL conf.\nrouter = routers.DefaultRouter()\nrouter.register(r\"users\", UserViewSet)\n\n# Wire up our API using automatic URL routing.\n# Additionally, we include login URLs for the browsable API.\nurlpatterns = [\n    path(\"\", include(router.urls)),\n    path(\"api-auth/\", include(\"rest_framework.urls\", namespace=\"rest_framework\")),\n]\n```\n\nWe'd also like to configure a couple of settings for our API.\n\nAdd the following to your `settings.py` module:\n\n```python\nINSTALLED_APPS = [\n    # ... make sure to include the default installed apps here.\n    \"rest_framework\",\n]\n\nREST_FRAMEWORK = {\n    # Use Django's standard `django.contrib.auth` permissions,\n    # or allow read-only access for unauthenticated users.\n    \"DEFAULT_PERMISSION_CLASSES\": [\n        \"rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly\",\n    ]\n}\n```\n\nThat's it, we're done!\n\n    ./manage.py runserver\n\nYou can now open the API in your browser at `http://127.0.0.1:8000/`, and view your new 'users' API. If you use the `Login` control in the top right corner you'll also be able to add, create and delete users from the system.\n\nYou can also interact with the API using command line tools such as [`curl`](https://curl.haxx.se/). For example, to list the users endpoint:\n\n    $ curl -H 'Accept: application/json; indent=4' -u admin:password http://127.0.0.1:8000/users/\n    [\n        {\n            \"url\": \"http://127.0.0.1:8000/users/1/\",\n            \"username\": \"admin\",\n            \"email\": \"admin@example.com\",\n            \"is_staff\": true,\n        }\n    ]\n\nOr to create a new user:\n\n    $ curl -X POST -d username=new -d email=new@example.com -d is_staff=false -H 'Accept: application/json; indent=4' -u admin:password http://127.0.0.1:8000/users/\n    {\n        \"url\": \"http://127.0.0.1:8000/users/2/\",\n        \"username\": \"new\",\n        \"email\": \"new@example.com\",\n        \"is_staff\": false,\n    }\n\n# Documentation & Support\n\nFull documentation for the project is available at [https://www.django-rest-framework.org/][docs].\n\nFor questions and support, use the [REST framework discussion group][group], or `#restframework` on libera.chat IRC.\n\n# Security\n\nPlease see the [security policy][security-policy].\n\n[build-status-image]: https://github.com/encode/django-rest-framework/actions/workflows/main.yml/badge.svg\n[build-status]: https://github.com/encode/django-rest-framework/actions/workflows/main.yml\n[coverage-status-image]: https://img.shields.io/codecov/c/github/encode/django-rest-framework/main.svg\n[codecov]: https://codecov.io/github/encode/django-rest-framework?branch=main\n[pypi-version]: https://img.shields.io/pypi/v/djangorestframework.svg\n[pypi]: https://pypi.org/project/djangorestframework/\n[group]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework\n\n[funding]: https://fund.django-rest-framework.org/topics/funding/\n[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors\n\n[oauth1-section]: https://www.django-rest-framework.org/api-guide/authentication/#django-rest-framework-oauth\n[oauth2-section]: https://www.django-rest-framework.org/api-guide/authentication/#django-oauth-toolkit\n[serializer-section]: https://www.django-rest-framework.org/api-guide/serializers/#serializers\n[modelserializer-section]: https://www.django-rest-framework.org/api-guide/serializers/#modelserializer\n[functionview-section]: https://www.django-rest-framework.org/api-guide/views/#function-based-views\n[generic-views]: https://www.django-rest-framework.org/api-guide/generic-views/\n[viewsets]: https://www.django-rest-framework.org/api-guide/viewsets/\n[routers]: https://www.django-rest-framework.org/api-guide/routers/\n[serializers]: https://www.django-rest-framework.org/api-guide/serializers/\n[authentication]: https://www.django-rest-framework.org/api-guide/authentication/\n[image]: https://www.django-rest-framework.org/img/quickstart.png\n\n[docs]: https://www.django-rest-framework.org/\n[security-policy]: https://github.com/encode/django-rest-framework/security/policy\n"
  },
  {
    "path": "SECURITY.md",
    "content": "# Security Policy\n\n## Reporting a Vulnerability\n\n**Please report security issues by emailing security@encode.io**.\n\nThe project maintainers will then work with you to resolve any issues where required, prior to any public disclosure.\n"
  },
  {
    "path": "codecov.yml",
    "content": "coverage:\n  precision: 2\n  round: down\n  range: \"80...100\"\n\n  status:\n    project: yes\n    patch: no\n    changes: no\n\ncomment: off\n"
  },
  {
    "path": "codespell-ignore-words.txt",
    "content": "Tim\nassertIn\nIAM\nendcode\ndeque\nthead\nlets\nfo\nmalcom\nser"
  },
  {
    "path": "docs/CNAME",
    "content": "www.django-rest-framework.org\n"
  },
  {
    "path": "docs/api-guide/authentication.md",
    "content": "---\nsource:\n    - authentication.py\n---\n\n> Auth needs to be pluggable.\n>\n> &mdash; Jacob Kaplan-Moss, [\"REST worst practices\"][cite]\n\nAuthentication is the mechanism of associating an incoming request with a set of identifying credentials, such as the user the request came from, or the token that it was signed with.  The [permission] and [throttling] policies can then use those credentials to determine if the request should be permitted.\n\nREST framework provides several authentication schemes out of the box, and also allows you to implement custom schemes.\n\nAuthentication always runs at the very start of the view, before the permission and throttling checks occur, and before any other code is allowed to proceed.\n\nThe `request.user` property will typically be set to an instance of the `contrib.auth` package's `User` class.\n\nThe `request.auth` property is used for any additional authentication information, for example, it may be used to represent an authentication token that the request was signed with.\n\n!!! note\n    Don't forget that **authentication by itself won't allow or disallow an incoming request**, it simply identifies the credentials that the request was made with.\n\n    For information on how to set up the permission policies for your API please see the [permissions documentation][permission].\n\n## How authentication is determined\n\nThe authentication schemes are always defined as a list of classes.  REST framework will attempt to authenticate with each class in the list, and will set `request.user` and `request.auth` using the return value of the first class that successfully authenticates.\n\nIf no class authenticates, `request.user` will be set to an instance of `django.contrib.auth.models.AnonymousUser`, and `request.auth` will be set to `None`.\n\nThe value of `request.user` and `request.auth` for unauthenticated requests can be modified using the `UNAUTHENTICATED_USER` and `UNAUTHENTICATED_TOKEN` settings.\n\n## Setting the authentication scheme\n\nThe default authentication schemes may be set globally, using the `DEFAULT_AUTHENTICATION_CLASSES` setting.  For example.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_AUTHENTICATION_CLASSES': [\n            'rest_framework.authentication.BasicAuthentication',\n            'rest_framework.authentication.SessionAuthentication',\n        ]\n    }\n\nYou can also set the authentication scheme on a per-view or per-viewset basis,\nusing the `APIView` class-based views.\n\n    from rest_framework.authentication import SessionAuthentication, BasicAuthentication\n    from rest_framework.permissions import IsAuthenticated\n    from rest_framework.response import Response\n    from rest_framework.views import APIView\n\n    class ExampleView(APIView):\n        authentication_classes = [SessionAuthentication, BasicAuthentication]\n        permission_classes = [IsAuthenticated]\n\n        def get(self, request, format=None):\n            content = {\n                'user': str(request.user),  # `django.contrib.auth.User` instance.\n                'auth': str(request.auth),  # None\n            }\n            return Response(content)\n\nOr, if you're using the `@api_view` decorator with function based views.\n\n    @api_view(['GET'])\n    @authentication_classes([SessionAuthentication, BasicAuthentication])\n    @permission_classes([IsAuthenticated])\n    def example_view(request, format=None):\n        content = {\n            'user': str(request.user),  # `django.contrib.auth.User` instance.\n            'auth': str(request.auth),  # None\n        }\n        return Response(content)\n\n## Unauthorized and Forbidden responses\n\nWhen an unauthenticated request is denied permission there are two different error codes that may be appropriate.\n\n* [HTTP 401 Unauthorized][http401]\n* [HTTP 403 Permission Denied][http403]\n\nHTTP 401 responses must always include a `WWW-Authenticate` header, that instructs the client how to authenticate.  HTTP 403 responses do not include the `WWW-Authenticate` header.\n\nThe kind of response that will be used depends on the authentication scheme.  Although multiple authentication schemes may be in use, only one scheme may be used to determine the type of response.  **The first authentication class set on the view is used when determining the type of response**.\n\nNote that when a request may successfully authenticate, but still be denied permission to perform the request, in which case a `403 Permission Denied` response will always be used, regardless of the authentication scheme.\n\n## Django 5.1+ `LoginRequiredMiddleware`\n\nIf you're running Django 5.1+ and use the [`LoginRequiredMiddleware`][login-required-middleware], please note that all views from DRF are opted-out of this middleware.  This is because the authentication in DRF is based on authentication and permissions classes, which may be determined after the middleware has been applied.  Additionally, when the request is not authenticated, the middleware redirects the user to the login page, which is not suitable for API requests, where it's preferable to return a 401 status code.\n\nREST framework offers an equivalent mechanism for DRF views via the global settings, `DEFAULT_AUTHENTICATION_CLASSES` and `DEFAULT_PERMISSION_CLASSES`.  They should be changed accordingly if you need to enforce that API requests are logged in.\n\n## Apache mod_wsgi specific configuration\n\nNote that if deploying to [Apache using mod_wsgi][mod_wsgi_official], the authorization header is not passed through to a WSGI application by default, as it is assumed that authentication will be handled by Apache, rather than at an application level.\n\nIf you are deploying to Apache, and using any non-session based authentication, you will need to explicitly configure mod_wsgi to pass the required headers through to the application.  This can be done by specifying the `WSGIPassAuthorization` directive in the appropriate context and setting it to `'On'`.\n\n    # this can go in either server config, virtual host, directory or .htaccess\n    WSGIPassAuthorization On\n\n---\n\n## API Reference\n\n### BasicAuthentication\n\nThis authentication scheme uses [HTTP Basic Authentication][basicauth], signed against a user's username and password.  Basic authentication is generally only appropriate for testing.\n\nIf successfully authenticated, `BasicAuthentication` provides the following credentials.\n\n* `request.user` will be a Django `User` instance.\n* `request.auth` will be `None`.\n\nUnauthenticated responses that are denied permission will result in an `HTTP 401 Unauthorized` response with an appropriate WWW-Authenticate header.  For example:\n\n    WWW-Authenticate: Basic realm=\"api\"\n\n!!! note\n    If you use `BasicAuthentication` in production you must ensure that your API is only available over `https`.  You should also ensure that your API clients will always re-request the username and password at login, and will never store those details to persistent storage.\n\n### TokenAuthentication\n\n!!! note\n    The token authentication provided by Django REST framework is a fairly simple implementation.\n\n    For an implementation which allows more than one token per user, has some tighter security implementation details, and supports token expiry, please see the [Django REST Knox][django-rest-knox] third party package.\n\nThis authentication scheme uses a simple token-based HTTP Authentication scheme.  Token authentication is appropriate for client-server setups, such as native desktop and mobile clients.\n\nTo use the `TokenAuthentication` scheme you'll need to [configure the authentication classes](#setting-the-authentication-scheme) to include `TokenAuthentication`, and additionally include `rest_framework.authtoken` in your `INSTALLED_APPS` setting:\n\n    INSTALLED_APPS = [\n        ...\n        'rest_framework.authtoken'\n    ]\n\nMake sure to run `manage.py migrate` after changing your settings.\n\nThe `rest_framework.authtoken` app provides Django database migrations.\n\nYou'll also need to create tokens for your users.\n\n    from rest_framework.authtoken.models import Token\n\n    token = Token.objects.create(user=...)\n    print(token.key)\n\nFor clients to authenticate, the token key should be included in the `Authorization` HTTP header.  The key should be prefixed by the string literal \"Token\", with whitespace separating the two strings.  For example:\n\n    Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b\n\n*If you want to use a different keyword in the header, such as `Bearer`, simply subclass `TokenAuthentication` and set the `keyword` class variable.*\n\nIf successfully authenticated, `TokenAuthentication` provides the following credentials.\n\n* `request.user` will be a Django `User` instance.\n* `request.auth` will be a `rest_framework.authtoken.models.Token` instance.\n\nUnauthenticated responses that are denied permission will result in an `HTTP 401 Unauthorized` response with an appropriate WWW-Authenticate header.  For example:\n\n    WWW-Authenticate: Token\n\nThe `curl` command line tool may be useful for testing token authenticated APIs.  For example:\n\n    curl -X GET http://127.0.0.1:8000/api/example/ -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\n\n!!! note\n    If you use `TokenAuthentication` in production you must ensure that your API is only available over `https`.\n\n#### Generating Tokens\n\n##### By using signals\n\nIf you want every user to have an automatically generated Token, you can simply catch the User's `post_save` signal.\n\n    from django.conf import settings\n    from django.db.models.signals import post_save\n    from django.dispatch import receiver\n    from rest_framework.authtoken.models import Token\n\n    @receiver(post_save, sender=settings.AUTH_USER_MODEL)\n    def create_auth_token(sender, instance=None, created=False, **kwargs):\n        if created:\n            Token.objects.create(user=instance)\n\nNote that you'll want to ensure you place this code snippet in an installed `models.py` module, or some other location that will be imported by Django on startup.\n\nIf you've already created some users, you can generate tokens for all existing users like this:\n\n    from django.contrib.auth.models import User\n    from rest_framework.authtoken.models import Token\n\n    for user in User.objects.all():\n        Token.objects.get_or_create(user=user)\n\n##### By exposing an api endpoint\n\nWhen using `TokenAuthentication`, you may want to provide a mechanism for clients to obtain a token given the username and password.  REST framework provides a built-in view to provide this behavior.  To use it, add the `obtain_auth_token` view to your URLconf:\n\n    from rest_framework.authtoken import views\n    urlpatterns += [\n        path('api-token-auth/', views.obtain_auth_token)\n    ]\n\nNote that the URL part of the pattern can be whatever you want to use.\n\nThe `obtain_auth_token` view will return a JSON response when valid `username` and `password` fields are POSTed to the view using form data or JSON:\n\n    { 'token' : '9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b' }\n\nNote that the default `obtain_auth_token` view explicitly uses JSON requests and responses, rather than using default renderer and parser classes in your settings.\n\nBy default, there are no permissions or throttling applied to the `obtain_auth_token` view. If you do wish to apply throttling you'll need to override the view class,\nand include them using the `throttle_classes` attribute.\n\nIf you need a customized version of the `obtain_auth_token` view, you can do so by subclassing the `ObtainAuthToken` view class, and using that in your url conf instead.\n\nFor example, you may return additional user information beyond the `token` value:\n\n    from rest_framework.authtoken.views import ObtainAuthToken\n    from rest_framework.authtoken.models import Token\n    from rest_framework.response import Response\n\n    class CustomAuthToken(ObtainAuthToken):\n\n        def post(self, request, *args, **kwargs):\n            serializer = self.serializer_class(data=request.data,\n                                               context={'request': request})\n            serializer.is_valid(raise_exception=True)\n            user = serializer.validated_data['user']\n            token, created = Token.objects.get_or_create(user=user)\n            return Response({\n                'token': token.key,\n                'user_id': user.pk,\n                'email': user.email\n            })\n\nAnd in your `urls.py`:\n\n    urlpatterns += [\n        path('api-token-auth/', CustomAuthToken.as_view())\n    ]\n\n\n##### With Django admin\n\nIt is also possible to create Tokens manually through the admin interface. In case you are using a large user base, we recommend that you monkey patch the `TokenAdmin` class to customize it to your needs, more specifically by declaring the `user` field as `raw_field`.\n\n`your_app/admin.py`:\n\n    from rest_framework.authtoken.admin import TokenAdmin\n\n    TokenAdmin.raw_id_fields = ['user']\n\n\n##### Using Django manage.py command\n\nSince version 3.6.4 it's possible to generate a user token using the following command:\n\n    ./manage.py drf_create_token <username>\n\nthis command will return the API token for the given user, creating it if it doesn't exist:\n\n    Generated token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b for user user1\n\nIn case you want to regenerate the token (for example if it has been compromised or leaked) you can pass an additional parameter:\n\n    ./manage.py drf_create_token -r <username>\n\n\n### SessionAuthentication\n\nThis authentication scheme uses Django's default session backend for authentication.  Session authentication is appropriate for AJAX clients that are running in the same session context as your website.\n\nIf successfully authenticated, `SessionAuthentication` provides the following credentials.\n\n* `request.user` will be a Django `User` instance.\n* `request.auth` will be `None`.\n\nUnauthenticated responses that are denied permission will result in an `HTTP 403 Forbidden` response.\n\nIf you're using an AJAX-style API with SessionAuthentication, you'll need to make sure you include a valid CSRF token for any \"unsafe\" HTTP method calls, such as `PUT`, `PATCH`, `POST` or `DELETE` requests.  See the [Django CSRF documentation][csrf-ajax] for more details.\n\n!!! warning\n    Always use Django's standard login view when creating login pages. This will ensure your login views are properly protected.\n\nCSRF validation in REST framework works slightly differently from standard Django due to the need to support both session and non-session based authentication to the same views. This means that only authenticated requests require CSRF tokens, and anonymous requests may be sent without CSRF tokens. This behavior is not suitable for login views, which should always have CSRF validation applied.\n\n\n### RemoteUserAuthentication\n\nThis authentication scheme allows you to delegate authentication to your web server, which sets the `REMOTE_USER`\nenvironment variable.\n\nTo use it, you must have `django.contrib.auth.backends.RemoteUserBackend` (or a subclass) in your\n`AUTHENTICATION_BACKENDS` setting. By default, `RemoteUserBackend` creates `User` objects for usernames that don't\nalready exist. To change this and other behavior, consult the\n[Django documentation](https://docs.djangoproject.com/en/stable/howto/auth-remote-user/).\n\nIf successfully authenticated, `RemoteUserAuthentication` provides the following credentials:\n\n* `request.user` will be a Django `User` instance.\n* `request.auth` will be `None`.\n\nConsult your web server's documentation for information about configuring an authentication method, for example:\n\n* [Apache Authentication How-To](https://httpd.apache.org/docs/2.4/howto/auth.html)\n* [NGINX (Restricting Access)](https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/)\n\n\n## Custom authentication\n\nTo implement a custom authentication scheme, subclass `BaseAuthentication` and override the `.authenticate(self, request)` method.  The method should return a two-tuple of `(user, auth)` if authentication succeeds, or `None` otherwise.\n\nIn some circumstances instead of returning `None`, you may want to raise an `AuthenticationFailed` exception from the `.authenticate()` method.\n\nTypically the approach you should take is:\n\n* If authentication is not attempted, return `None`.  Any other authentication schemes also in use will still be checked.\n* If authentication is attempted but fails, raise an `AuthenticationFailed` exception.  An error response will be returned immediately, regardless of any permissions checks, and without checking any other authentication schemes.\n\nYou *may* also override the `.authenticate_header(self, request)` method.  If implemented, it should return a string that will be used as the value of the `WWW-Authenticate` header in a `HTTP 401 Unauthorized` response.\n\nIf the `.authenticate_header()` method is not overridden, the authentication scheme will return `HTTP 403 Forbidden` responses when an unauthenticated request is denied access.\n\n!!! note\n    When your custom authenticator is invoked by the request object's `.user` or `.auth` properties, you may see an `AttributeError` re-raised as a `WrappedAttributeError`. This is necessary to prevent the original exception from being suppressed by the outer property access. Python will not recognize that the `AttributeError` originates from your custom authenticator and will instead assume that the request object does not have a `.user` or `.auth` property. These errors should be fixed or otherwise handled by your authenticator.\n\n### Example\n\nThe following example will authenticate any incoming request as the user given by the username in a custom request header named 'X-USERNAME'.\n\n    from django.contrib.auth.models import User\n    from rest_framework import authentication\n    from rest_framework import exceptions\n\n    class ExampleAuthentication(authentication.BaseAuthentication):\n        def authenticate(self, request):\n            username = request.META.get('HTTP_X_USERNAME')\n            if not username:\n                return None\n\n            try:\n                user = User.objects.get(username=username)\n            except User.DoesNotExist:\n                raise exceptions.AuthenticationFailed('No such user')\n\n            return (user, None)\n\n---\n\n## Third party packages\n\nThe following third-party packages are also available.\n\n### django-rest-knox\n\n[Django-rest-knox][django-rest-knox] library provides models and views to handle token-based authentication in a more secure and extensible way than the built-in TokenAuthentication scheme - with Single Page Applications and Mobile clients in mind. It provides per-client tokens, and views to generate them when provided some other authentication (usually basic authentication), to delete the token (providing a server enforced logout) and to delete all tokens (logs out all clients that a user is logged into).\n\n### Django OAuth Toolkit\n\nThe [Django OAuth Toolkit][django-oauth-toolkit] package provides OAuth 2.0 support and works with Python 3.4+. The package is maintained by [jazzband][jazzband] and uses the excellent [OAuthLib][oauthlib].  The package is well documented, and well supported and is currently our **recommended package for OAuth 2.0 support**.\n\n#### Installation & configuration\n\nInstall using `pip`.\n\n    pip install django-oauth-toolkit\n\nAdd the package to your `INSTALLED_APPS` and modify your REST framework settings.\n\n    INSTALLED_APPS = [\n        ...\n        'oauth2_provider',\n    ]\n\n    REST_FRAMEWORK = {\n        'DEFAULT_AUTHENTICATION_CLASSES': [\n            'oauth2_provider.contrib.rest_framework.OAuth2Authentication',\n        ]\n    }\n\nFor more details see the [Django REST framework - Getting started][django-oauth-toolkit-getting-started] documentation.\n\n### Django REST framework OAuth\n\nThe [Django REST framework OAuth][django-rest-framework-oauth] package provides both OAuth1 and OAuth2 support for REST framework.\n\nThis package was previously included directly in the REST framework but is now supported and maintained as a third-party package.\n\n#### Installation & configuration\n\nInstall the package using `pip`.\n\n    pip install djangorestframework-oauth\n\nFor details on configuration and usage see the Django REST framework OAuth documentation for [authentication][django-rest-framework-oauth-authentication] and [permissions][django-rest-framework-oauth-permissions].\n\n### JSON Web Token Authentication\n\nJSON Web Token is a fairly new standard which can be used for token-based authentication. Unlike the built-in TokenAuthentication scheme, JWT Authentication doesn't need to use a database to validate a token. A package for JWT authentication is [djangorestframework-simplejwt][djangorestframework-simplejwt] which provides some features as well as a pluggable token blacklist app.\n\n### Hawk HTTP Authentication\n\nThe [HawkREST][hawkrest] library builds on the [Mohawk][mohawk] library to let you work with [Hawk][hawk] signed requests and responses in your API. [Hawk][hawk] lets two parties securely communicate with each other using messages signed by a shared key. It is based on [HTTP MAC access authentication][mac] (which was based on parts of [OAuth 1.0][oauth-1.0a]).\n\n### HTTP Signature Authentication\n\nHTTP Signature (currently a [IETF draft][http-signature-ietf-draft]) provides a way to achieve origin authentication and message integrity for HTTP messages. Similar to [Amazon's HTTP Signature scheme][amazon-http-signature], used by many of its services, it permits stateless, per-request authentication. [Elvio Toccalino][etoccalino] maintains the [djangorestframework-httpsignature][djangorestframework-httpsignature] (outdated) package which provides an easy-to-use HTTP Signature Authentication mechanism. You can use the updated fork version of [djangorestframework-httpsignature][djangorestframework-httpsignature], which is [drf-httpsig][drf-httpsig].\n\n### Djoser\n\n[Djoser][djoser] library provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation. The package works with a custom user model and uses token-based authentication. This is a ready to use REST implementation of the Django authentication system.\n\n### DRF Auth Kit\n\n[DRF Auth Kit][drf-auth-kit] library provides a modern REST authentication solution with JWT cookies, social login, multi-factor authentication, and comprehensive user management. The package offers full type safety, automatic OpenAPI schema generation with DRF Spectacular. It supports multiple authentication types (JWT, DRF Token, or Custom) and includes built-in internationalization for 50+ languages.\n\n\n### django-rest-auth / dj-rest-auth\n\nThis library provides a set of REST API endpoints for registration, authentication (including social media authentication), password reset, retrieve and update user details, etc. By having these API endpoints, your client apps such as AngularJS, iOS, Android, and others can communicate to your Django backend site independently via REST APIs for user management.\n\n\nThere are currently two forks of this project.\n\n* [Django-rest-auth][django-rest-auth] is the original project, [but is not currently receiving updates](https://github.com/Tivix/django-rest-auth/issues/568).\n* [Dj-rest-auth][dj-rest-auth] is a newer fork of the project.\n\n### drf-social-oauth2\n\n[Drf-social-oauth2][drf-social-oauth2] is a framework that helps you authenticate with major social oauth2 vendors, such as Facebook, Google, Twitter, Orcid, etc. It generates tokens in a JWTed way with an easy setup.\n\n### drfpasswordless\n\n[drfpasswordless][drfpasswordless] adds (Medium, Square Cash inspired) passwordless support to Django REST Framework's TokenAuthentication scheme. Users log in and sign up with a token sent to a contact point like an email address or a mobile number.\n\n### django-rest-authemail\n\n[django-rest-authemail][django-rest-authemail] provides a RESTful API interface for user signup and authentication. Email addresses are used for authentication, rather than usernames.  API endpoints are available for signup, signup email verification, login, logout, password reset, password reset verification, email change, email change verification, password change, and user detail.  A fully functional example project and detailed instructions are included.\n\n### Django-Rest-Durin\n\n[Django-Rest-Durin][django-rest-durin] is built with the idea to have one library that does token auth for multiple Web/CLI/Mobile API clients via one interface but allows different token configuration for each API Client that consumes the API. It provides support for multiple tokens per user via custom models, views, permissions that work with Django-Rest-Framework. The token expiration time can be different per API client and is customizable via the Django Admin Interface.\n\nMore information can be found in the [Documentation](https://django-rest-durin.readthedocs.io/en/latest/index.html).\n\n### django-pyoidc\n\n[django_pyoidc][django-pyoidc] adds support for OpenID Connect (OIDC) authentication. This allows you to delegate user management to an Identity Provider, which can be used to implement Single-Sign-On (SSO). It provides support for most uses-cases, such as customizing how token info are mapped to user models, using OIDC audiences for access control, etc.\n\nMore information can be found in the [Documentation](https://django-pyoidc.readthedocs.io/latest/index.html).\n\n[cite]: https://jacobian.org/writing/rest-worst-practices/\n[http401]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2\n[http403]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4\n[basicauth]: https://tools.ietf.org/html/rfc2617\n[permission]: permissions.md\n[throttling]: throttling.md\n[csrf-ajax]: https://docs.djangoproject.com/en/stable/howto/csrf/#using-csrf-protection-with-ajax\n[mod_wsgi_official]: https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIPassAuthorization.html\n[django-oauth-toolkit-getting-started]: https://django-oauth-toolkit.readthedocs.io/en/latest/rest-framework/getting_started.html\n[django-rest-framework-oauth]: https://jpadilla.github.io/django-rest-framework-oauth/\n[django-rest-framework-oauth-authentication]: https://jpadilla.github.io/django-rest-framework-oauth/authentication/\n[django-rest-framework-oauth-permissions]: https://jpadilla.github.io/django-rest-framework-oauth/permissions/\n[juanriaza]: https://github.com/juanriaza\n[djangorestframework-digestauth]: https://github.com/juanriaza/django-rest-framework-digestauth\n[oauth-1.0a]: https://oauth.net/core/1.0a/\n[django-oauth-toolkit]: https://github.com/evonove/django-oauth-toolkit\n[jazzband]: https://github.com/jazzband/\n[oauthlib]: https://github.com/idan/oauthlib\n[djangorestframework-simplejwt]: https://github.com/davesque/django-rest-framework-simplejwt\n[etoccalino]: https://github.com/etoccalino/\n[djangorestframework-httpsignature]: https://github.com/etoccalino/django-rest-framework-httpsignature\n[drf-httpsig]: https://github.com/ahknight/drf-httpsig\n[amazon-http-signature]: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n[http-signature-ietf-draft]: https://datatracker.ietf.org/doc/draft-cavage-http-signatures/\n[hawkrest]: https://hawkrest.readthedocs.io/en/latest/\n[hawk]: https://github.com/hueniverse/hawk\n[mohawk]: https://mohawk.readthedocs.io/en/latest/\n[mac]: https://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05\n[djoser]: https://github.com/sunscrapers/djoser\n[django-rest-auth]: https://github.com/Tivix/django-rest-auth\n[dj-rest-auth]: https://github.com/jazzband/dj-rest-auth\n[drf-social-oauth2]: https://github.com/wagnerdelima/drf-social-oauth2\n[django-rest-knox]: https://github.com/James1345/django-rest-knox\n[drfpasswordless]: https://github.com/aaronn/django-rest-framework-passwordless\n[django-rest-authemail]: https://github.com/celiao/django-rest-authemail\n[django-rest-durin]: https://github.com/eshaan7/django-rest-durin\n[login-required-middleware]: https://docs.djangoproject.com/en/stable/ref/middleware/#django.contrib.auth.middleware.LoginRequiredMiddleware\n[django-pyoidc]: https://github.com/makinacorpus/django_pyoidc\n[drf-auth-kit]: https://github.com/huynguyengl99/drf-auth-kit\n"
  },
  {
    "path": "docs/api-guide/caching.md",
    "content": "# Caching\n\n> A certain woman had a very sharp consciousness but almost no\n> memory ... She remembered enough to work, and she worked hard.\n> - Lydia Davis\n\nCaching in REST Framework works well with the cache utilities\nprovided in Django.\n\n---\n\n## Using cache with apiview and viewsets\n\nDjango provides a [`method_decorator`][decorator] to use\ndecorators with class based views. This can be used with\nother cache decorators such as [`cache_page`][page],\n[`vary_on_cookie`][cookie] and [`vary_on_headers`][headers].\n\n```python\nfrom django.utils.decorators import method_decorator\nfrom django.views.decorators.cache import cache_page\nfrom django.views.decorators.vary import vary_on_cookie, vary_on_headers\n\nfrom rest_framework.response import Response\nfrom rest_framework.views import APIView\nfrom rest_framework import viewsets\n\n\nclass UserViewSet(viewsets.ViewSet):\n    # With cookie: cache requested url for each user for 2 hours\n    @method_decorator(cache_page(60 * 60 * 2))\n    @method_decorator(vary_on_cookie)\n    def list(self, request, format=None):\n        content = {\n            \"user_feed\": request.user.get_user_feed(),\n        }\n        return Response(content)\n\n\nclass ProfileView(APIView):\n    # With auth: cache requested url for each user for 2 hours\n    @method_decorator(cache_page(60 * 60 * 2))\n    @method_decorator(vary_on_headers(\"Authorization\"))\n    def get(self, request, format=None):\n        content = {\n            \"user_feed\": request.user.get_user_feed(),\n        }\n        return Response(content)\n\n\nclass PostView(APIView):\n    # Cache page for the requested url\n    @method_decorator(cache_page(60 * 60 * 2))\n    def get(self, request, format=None):\n        content = {\n            \"title\": \"Post title\",\n            \"body\": \"Post content\",\n        }\n        return Response(content)\n```\n\n\n## Using cache with @api_view decorator\n\nWhen using @api_view decorator, the Django-provided method-based cache decorators such as [`cache_page`][page],\n[`vary_on_cookie`][cookie] and [`vary_on_headers`][headers] can be called directly.\n\n```python\nfrom django.views.decorators.cache import cache_page\nfrom django.views.decorators.vary import vary_on_cookie\n\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\n\n\n@cache_page(60 * 15)\n@vary_on_cookie\n@api_view([\"GET\"])\ndef get_user_list(request):\n    content = {\"user_feed\": request.user.get_user_feed()}\n    return Response(content)\n```\n\n\n!!! note\n    The [`cache_page`][page] decorator only caches the `GET` and `HEAD` responses with status 200.\n\n[page]: https://docs.djangoproject.com/en/stable/topics/cache/#the-per-view-cache\n[cookie]: https://docs.djangoproject.com/en/stable/topics/http/decorators/#django.views.decorators.vary.vary_on_cookie\n[headers]: https://docs.djangoproject.com/en/stable/topics/http/decorators/#django.views.decorators.vary.vary_on_headers\n[decorator]: https://docs.djangoproject.com/en/stable/topics/class-based-views/intro/#decorating-the-class\n"
  },
  {
    "path": "docs/api-guide/content-negotiation.md",
    "content": "---\nsource:\n    - negotiation.py\n---\n\n> HTTP has provisions for several mechanisms for \"content negotiation\" - the process of selecting the best representation for a given response when there are multiple representations available.\n>\n> &mdash; [RFC 2616][cite], Fielding et al.\n\n[cite]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html\n\nContent negotiation is the process of selecting one of multiple possible representations to return to a client, based on client or server preferences.\n\n## Determining the accepted renderer\n\nREST framework uses a simple style of content negotiation to determine which media type should be returned to a client, based on the available renderers, the priorities of each of those renderers, and the client's `Accept:` header.  The style used is partly client-driven, and partly server-driven.\n\n1. More specific media types are given preference to less specific media types.\n2. If multiple media types have the same specificity, then preference is given to based on the ordering of the renderers configured for the given view.\n\nFor example, given the following `Accept` header:\n\n    application/json; indent=4, application/json, application/yaml, text/html, */*\n\nThe priorities for each of the given media types would be:\n\n* `application/json; indent=4`\n* `application/json`, `application/yaml` and `text/html`\n* `*/*`\n\nIf the requested view was only configured with renderers for `YAML` and `HTML`, then REST framework would select whichever renderer was listed first in the `renderer_classes` list or `DEFAULT_RENDERER_CLASSES` setting.\n\nFor more information on the `HTTP Accept` header, see [RFC 2616][accept-header]\n\n\n!!! note\n    \"q\" values are not taken into account by REST framework when determining preference.  The use of \"q\" values negatively impacts caching, and in the author's opinion they are an unnecessary and overcomplicated approach to content negotiation.\n\n    This is a valid approach as the HTTP spec deliberately underspecifies how a server should weight server-based preferences against client-based preferences.\n\n## Custom content negotiation\n\nIt's unlikely that you'll want to provide a custom content negotiation scheme for REST framework, but you can do so if needed.  To implement a custom content negotiation scheme override `BaseContentNegotiation`.\n\nREST framework's content negotiation classes handle selection of both the appropriate parser for the request, and the appropriate renderer for the response, so you should implement both the `.select_parser(request, parsers)` and `.select_renderer(request, renderers, format_suffix)` methods.\n\nThe `select_parser()` method should return one of the parser instances from the list of available parsers, or `None` if none of the parsers can handle the incoming request.\n\nThe `select_renderer()` method should return a two-tuple of (renderer instance, media type), or raise a `NotAcceptable` exception.\n\n### Example\n\nThe following is a custom content negotiation class which ignores the client\nrequest when selecting the appropriate parser or renderer.\n\n    from rest_framework.negotiation import BaseContentNegotiation\n\n    class IgnoreClientContentNegotiation(BaseContentNegotiation):\n        def select_parser(self, request, parsers):\n            \"\"\"\n            Select the first parser in the `.parser_classes` list.\n            \"\"\"\n            return parsers[0]\n\n        def select_renderer(self, request, renderers, format_suffix):\n            \"\"\"\n            Select the first renderer in the `.renderer_classes` list.\n            \"\"\"\n            return (renderers[0], renderers[0].media_type)\n\n### Setting the content negotiation\n\nThe default content negotiation class may be set globally, using the `DEFAULT_CONTENT_NEGOTIATION_CLASS` setting.  For example, the following settings would use our example `IgnoreClientContentNegotiation` class.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_CONTENT_NEGOTIATION_CLASS': 'myapp.negotiation.IgnoreClientContentNegotiation',\n    }\n\nYou can also set the content negotiation used for an individual view, or viewset, using the `APIView` class-based views.\n\n    from myapp.negotiation import IgnoreClientContentNegotiation\n    from rest_framework.response import Response\n    from rest_framework.views import APIView\n\n    class NoNegotiationView(APIView):\n        \"\"\"\n        An example view that does not perform content negotiation.\n        \"\"\"\n        content_negotiation_class = IgnoreClientContentNegotiation\n\n        def get(self, request, format=None):\n            return Response({\n                'accepted media type': request.accepted_renderer.media_type\n            })\n\n[accept-header]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html\n"
  },
  {
    "path": "docs/api-guide/exceptions.md",
    "content": "---\nsource:\n    - exceptions.py\n---\n\n# Exceptions\n\n> Exceptions… allow error handling to be organized cleanly in a central or high-level place within the program structure.\n>\n> &mdash; Doug Hellmann, [Python Exception Handling Techniques][cite]\n\n## Exception handling in REST framework views\n\nREST framework's views handle various exceptions, and deal with returning appropriate error responses.\n\nThe handled exceptions are:\n\n* Subclasses of `APIException` raised inside REST framework.\n* Django's `Http404` exception.\n* Django's `PermissionDenied` exception.\n\nIn each case, REST framework will return a response with an appropriate status code and content-type.  The body of the response will include any additional details regarding the nature of the error.\n\nMost error responses will include a key `detail` in the body of the response.\n\nFor example, the following request:\n\n    DELETE http://api.example.com/foo/bar HTTP/1.1\n    Accept: application/json\n\nMight receive an error response indicating that the `DELETE` method is not allowed on that resource:\n\n    HTTP/1.1 405 Method Not Allowed\n    Content-Type: application/json\n    Content-Length: 42\n\n    {\"detail\": \"Method 'DELETE' not allowed.\"}\n\nValidation errors are handled slightly differently, and will include the field names as the keys in the response. If the validation error was not specific to a particular field then it will use the \"non_field_errors\" key, or whatever string value has been set for the `NON_FIELD_ERRORS_KEY` setting.\n\nAn example validation error might look like this:\n\n    HTTP/1.1 400 Bad Request\n    Content-Type: application/json\n    Content-Length: 94\n\n    {\"amount\": [\"A valid integer is required.\"], \"description\": [\"This field may not be blank.\"]}\n\n## Custom exception handling\n\nYou can implement custom exception handling by creating a handler function that converts exceptions raised in your API views into response objects.  This allows you to control the style of error responses used by your API.\n\nThe function must take a pair of arguments, the first is the exception to be handled, and the second is a dictionary containing any extra context such as the view currently being handled. The exception handler function should either return a `Response` object, or return `None` if the exception cannot be handled.  If the handler returns `None` then the exception will be re-raised and Django will return a standard HTTP 500 'server error' response.\n\nFor example, you might want to ensure that all error responses include the HTTP status code in the body of the response, like so:\n\n    HTTP/1.1 405 Method Not Allowed\n    Content-Type: application/json\n    Content-Length: 62\n\n    {\"status_code\": 405, \"detail\": \"Method 'DELETE' not allowed.\"}\n\nIn order to alter the style of the response, you could write the following custom exception handler:\n\n    from rest_framework.views import exception_handler\n\n    def custom_exception_handler(exc, context):\n        # Call REST framework's default exception handler first,\n        # to get the standard error response.\n        response = exception_handler(exc, context)\n\n        # Now add the HTTP status code to the response.\n        if response is not None:\n            response.data['status_code'] = response.status_code\n\n        return response\n\nThe context argument is not used by the default handler, but can be useful if the exception handler needs further information such as the view currently being handled, which can be accessed as `context['view']`.\n\nThe exception handler must also be configured in your settings, using the `EXCEPTION_HANDLER` setting key. For example:\n\n    REST_FRAMEWORK = {\n        'EXCEPTION_HANDLER': 'my_project.my_app.utils.custom_exception_handler'\n    }\n\nIf not specified, the `'EXCEPTION_HANDLER'` setting defaults to the standard exception handler provided by REST framework:\n\n    REST_FRAMEWORK = {\n        'EXCEPTION_HANDLER': 'rest_framework.views.exception_handler'\n    }\n\nNote that the exception handler will only be called for responses generated by raised exceptions.  It will not be used for any responses returned directly by the view, such as the `HTTP_400_BAD_REQUEST` responses that are returned by the generic views when serializer validation fails.\n\n---\n\n## API Reference\n\n### APIException\n\n**Signature:** `APIException()`\n\nThe **base class** for all exceptions raised inside an `APIView` class or `@api_view`.\n\nTo provide a custom exception, subclass `APIException` and set the `.status_code`, `.default_detail`, and `.default_code` attributes on the class.\n\nFor example, if your API relies on a third party service that may sometimes be unreachable, you might want to implement an exception for the \"503 Service Unavailable\" HTTP response code.  You could do this like so:\n\n    from rest_framework.exceptions import APIException\n\n    class ServiceUnavailable(APIException):\n        status_code = 503\n        default_detail = 'Service temporarily unavailable, try again later.'\n        default_code = 'service_unavailable'\n\n#### Inspecting API exceptions\n\nThere are a number of different properties available for inspecting the status\nof an API exception. You can use these to build custom exception handling\nfor your project.\n\nThe available attributes and methods are:\n\n* `.detail` - Return the textual description of the error.\n* `.get_codes()` - Return the code identifier of the error.\n* `.get_full_details()` - Return both the textual description and the code identifier.\n\nIn most cases the error detail will be a simple item:\n\n    >>> print(exc.detail)\n    You do not have permission to perform this action.\n    >>> print(exc.get_codes())\n    permission_denied\n    >>> print(exc.get_full_details())\n    {'message':'You do not have permission to perform this action.','code':'permission_denied'}\n\nIn the case of validation errors the error detail will be either a list or\ndictionary of items:\n\n    >>> print(exc.detail)\n    {\"name\":\"This field is required.\",\"age\":\"A valid integer is required.\"}\n    >>> print(exc.get_codes())\n    {\"name\":\"required\",\"age\":\"invalid\"}\n    >>> print(exc.get_full_details())\n    {\"name\":{\"message\":\"This field is required.\",\"code\":\"required\"},\"age\":{\"message\":\"A valid integer is required.\",\"code\":\"invalid\"}}\n\n### ParseError\n\n**Signature:** `ParseError(detail=None, code=None)`\n\nRaised if the request contains malformed data when accessing `request.data`.\n\nBy default this exception results in a response with the HTTP status code \"400 Bad Request\".\n\n### AuthenticationFailed\n\n**Signature:** `AuthenticationFailed(detail=None, code=None)`\n\nRaised when an incoming request includes incorrect authentication.\n\nBy default this exception results in a response with the HTTP status code \"401 Unauthenticated\", but it may also result in a \"403 Forbidden\" response, depending on the authentication scheme in use.  See the [authentication documentation][authentication] for more details.\n\n### NotAuthenticated\n\n**Signature:** `NotAuthenticated(detail=None, code=None)`\n\nRaised when an unauthenticated request fails the permission checks.\n\nBy default this exception results in a response with the HTTP status code \"401 Unauthenticated\", but it may also result in a \"403 Forbidden\" response, depending on the authentication scheme in use.  See the [authentication documentation][authentication] for more details.\n\n### PermissionDenied\n\n**Signature:** `PermissionDenied(detail=None, code=None)`\n\nRaised when an authenticated request fails the permission checks.\n\nBy default this exception results in a response with the HTTP status code \"403 Forbidden\".\n\n### NotFound\n\n**Signature:** `NotFound(detail=None, code=None)`\n\nRaised when a resource does not exist at the given URL. This exception is equivalent to the standard `Http404` Django exception.\n\nBy default this exception results in a response with the HTTP status code \"404 Not Found\".\n\n### MethodNotAllowed\n\n**Signature:** `MethodNotAllowed(method, detail=None, code=None)`\n\nRaised when an incoming request occurs that does not map to a handler method on the view.\n\nBy default this exception results in a response with the HTTP status code \"405 Method Not Allowed\".\n\n### NotAcceptable\n\n**Signature:** `NotAcceptable(detail=None, code=None)`\n\nRaised when an incoming request occurs with an `Accept` header that cannot be satisfied by any of the available renderers.\n\nBy default this exception results in a response with the HTTP status code \"406 Not Acceptable\".\n\n### UnsupportedMediaType\n\n**Signature:** `UnsupportedMediaType(media_type, detail=None, code=None)`\n\nRaised if there are no parsers that can handle the content type of the request data when accessing `request.data`.\n\nBy default this exception results in a response with the HTTP status code \"415 Unsupported Media Type\".\n\n### Throttled\n\n**Signature:** `Throttled(wait=None, detail=None, code=None)`\n\nRaised when an incoming request fails the throttling checks.\n\nBy default this exception results in a response with the HTTP status code \"429 Too Many Requests\".\n\n### ValidationError\n\n**Signature:** `ValidationError(detail=None, code=None)`\n\nThe `ValidationError` exception is slightly different from the other `APIException` classes:\n\n* The `detail` argument may be a list or dictionary of error details, and may also be a nested data structure. By using a dictionary, you can specify field-level errors while performing object-level validation in the `validate()` method of a serializer. For example. `raise serializers.ValidationError({'name': 'Please enter a valid name.'})`\n* By convention you should import the serializers module and use a fully qualified `ValidationError` style, in order to differentiate it from Django's built-in validation error. For example. `raise serializers.ValidationError('This field must be an integer value.')`\n\nThe `ValidationError` class should be used for serializer and field validation, and by validator classes. It is also raised when calling `serializer.is_valid` with the `raise_exception` keyword argument:\n\n    serializer.is_valid(raise_exception=True)\n\nThe generic views use the `raise_exception=True` flag, which means that you can override the style of validation error responses globally in your API. To do so, use a custom exception handler, as described above.\n\nBy default this exception results in a response with the HTTP status code \"400 Bad Request\".\n\n\n---\n\n## Generic Error Views\n\nDjango REST Framework provides two error views suitable for providing generic JSON `500` Server Error and\n`400` Bad Request responses. (Django's default error views provide HTML responses, which may not be appropriate for an\nAPI-only application.)\n\nUse these as per [Django's Customizing error views documentation][django-custom-error-views].\n\n### `rest_framework.exceptions.server_error`\n\nReturns a response with status code `500` and `application/json` content type.\n\nSet as `handler500`:\n\n    handler500 = 'rest_framework.exceptions.server_error'\n\n### `rest_framework.exceptions.bad_request`\n\nReturns a response with status code `400` and `application/json` content type.\n\nSet as `handler400`:\n\n    handler400 = 'rest_framework.exceptions.bad_request'\n\n## Third party packages\n\nThe following third-party packages are also available.\n\n### DRF Standardized Errors\n\nThe [drf-standardized-errors][drf-standardized-errors] package provides an exception handler that generates the same format for all 4xx and 5xx responses. It is a drop-in replacement for the default exception handler and allows customizing the error response format without rewriting the whole exception handler. The standardized error response format is easier to document and easier to handle by API consumers.\n\n[cite]: https://doughellmann.com/blog/2009/06/19/python-exception-handling-techniques/\n[authentication]: authentication.md\n[django-custom-error-views]: https://docs.djangoproject.com/en/stable/topics/http/views/#customizing-error-views\n[drf-standardized-errors]: https://github.com/ghazi-git/drf-standardized-errors\n"
  },
  {
    "path": "docs/api-guide/fields.md",
    "content": "---\nsource:\n    - fields.py\n---\n\n# Serializer fields\n\n> Each field in a Form class is responsible not only for validating data, but also for \"cleaning\" it &mdash; normalizing it to a consistent format.\n>\n> &mdash; [Django documentation][cite]\n\nSerializer fields handle converting between primitive values and internal datatypes.  They also deal with validating input values, as well as retrieving and setting the values from their parent objects.\n\n!!! note\n    The serializer fields are declared in `fields.py`, but by convention you should import them using `from rest_framework import serializers` and refer to fields as `serializers.<FieldName>`.\n\n## Core arguments\n\nEach serializer field class constructor takes at least these arguments.  Some Field classes take additional, field-specific arguments, but the following should always be accepted:\n\n### `read_only`\n\nRead-only fields are included in the API output, but should not be included in the input during create or update operations. Any 'read_only' fields that are incorrectly included in the serializer input will be ignored.\n\nSet this to `True` to ensure that the field is used when serializing a representation, but is not used when creating or updating an instance during deserialization.\n\nDefaults to `False`\n\n### `write_only`\n\nSet this to `True` to ensure that the field may be used when updating or creating an instance, but is not included when serializing the representation.\n\nDefaults to `False`\n\n### `required`\n\nNormally an error will be raised if a field is not supplied during deserialization.\nSet to false if this field is not required to be present during deserialization.\n\nSetting this to `False` also allows the object attribute or dictionary key to be omitted from output when serializing the instance. If the key is not present it will simply not be included in the output representation.\n\nDefaults to `True`. If you're using [Model Serializer](https://www.django-rest-framework.org/api-guide/serializers/#modelserializer), the default value will be `False` when you have specified a `default`, or when the corresponding `Model` field has `blank=True` or `null=True` and is not part of a unique constraint at the same time. (Note that without a `default` value, [unique constraints will cause the field to be required](https://www.django-rest-framework.org/api-guide/validators/#optional-fields).)\n\n### `default`\n\nIf set, this gives the default value that will be used for the field if no input value is supplied. If not set the default behavior is to not populate the attribute at all.\n\nThe `default` is not applied during partial update operations. In the partial update case only fields that are provided in the incoming data will have a validated value returned.\n\nMay be set to a function or other callable, in which case the value will be evaluated each time it is used. When called, it will receive no arguments. If the callable has a `requires_context = True` attribute, then the serializer field will be passed as an argument.\n\nFor example:\n\n    class CurrentUserDefault:\n        \"\"\"\n        May be applied as a `default=...` value on a serializer field.\n        Returns the current user.\n        \"\"\"\n        requires_context = True\n\n        def __call__(self, serializer_field):\n            return serializer_field.context['request'].user\n\nWhen serializing the instance, default will be used if the object attribute or dictionary key is not present in the instance.\n\nNote that setting a `default` value implies that the field is not required. Including both the `default` and `required` keyword arguments is invalid and will raise an error.\n\n### `allow_null`\n\nNormally an error will be raised if `None` is passed to a serializer field. Set this keyword argument to `True` if `None` should be considered a valid value.\n\nNote that, without an explicit `default`, setting this argument to `True` will imply a `default` value of `null` for serialization output, but does not imply a default for input deserialization.\n\nDefaults to `False`\n\n### `source`\n\nThe name of the attribute that will be used to populate the field.  May be a method that only takes a `self` argument, such as `URLField(source='get_absolute_url')`, or may use dotted notation to traverse attributes, such as `EmailField(source='user.email')`.\n\nWhen serializing fields with dotted notation, it may be necessary to provide a `default` value if any object is not present or is empty during attribute traversal. Beware of possible n+1 problems when using source attribute if you are accessing a relational orm model. For example:\n\n    class CommentSerializer(serializers.Serializer):\n        email = serializers.EmailField(source=\"user.email\")\n\nThis case would require user object to be fetched from database when it is not prefetched. If that is not wanted, be sure to be using `prefetch_related` and `select_related` methods appropriately. For more information about the methods refer to [django documentation][django-docs-select-related].\n\nThe value `source='*'` has a special meaning, and is used to indicate that the entire object should be passed through to the field.  This can be useful for creating nested representations, or for fields which require access to the complete object in order to determine the output representation.\n\nDefaults to the name of the field.\n\n### `validators`\n\nA list of validator functions which should be applied to the incoming field input, and which either raise a validation error or simply return. Validator functions should typically raise `serializers.ValidationError`, but Django's built-in `ValidationError` is also supported for compatibility with validators defined in the Django codebase or third party Django packages.\n\n### `error_messages`\n\nA dictionary of error codes to error messages.\n\n### `label`\n\nA short text string that may be used as the name of the field in HTML form fields or other descriptive elements.\n\n### `help_text`\n\nA text string that may be used as a description of the field in HTML form fields or other descriptive elements.\n\n### `initial`\n\nA value that should be used for pre-populating the value of HTML form fields. You may pass a callable to it, just as\nyou may do with any regular Django `Field`:\n\n    import datetime\n    from rest_framework import serializers\n    class ExampleSerializer(serializers.Serializer):\n        day = serializers.DateField(initial=datetime.date.today)\n\n### `style`\n\nA dictionary of key-value pairs that can be used to control how renderers should render the field.\n\nTwo examples here are `'input_type'` and `'base_template'`:\n\n    # Use <input type=\"password\"> for the input.\n    password = serializers.CharField(\n        style={'input_type': 'password'}\n    )\n\n    # Use a radio input instead of a select input.\n    color_channel = serializers.ChoiceField(\n        choices=['red', 'green', 'blue'],\n        style={'base_template': 'radio.html'}\n    )\n\nFor more details see the [HTML & Forms][html-and-forms] documentation.\n\n---\n\n## Boolean fields\n\n### BooleanField\n\nA boolean representation.\n\nWhen using HTML encoded form input be aware that omitting a value will always be treated as setting a field to `False`, even if it has a `default=True` option specified. This is because HTML checkbox inputs represent the unchecked state by omitting the value, so REST framework treats omission as if it is an empty checkbox input.\n\nNote that Django 2.1 removed the `blank` kwarg from `models.BooleanField`.\nPrior to Django 2.1 `models.BooleanField` fields were always `blank=True`. Thus\nsince Django 2.1 default `serializers.BooleanField` instances will be generated\nwithout the `required` kwarg (i.e. equivalent to `required=True`) whereas with\nprevious versions of Django, default `BooleanField` instances will be generated\nwith a `required=False` option.  If you want to control this behavior manually,\nexplicitly declare the `BooleanField` on the serializer class, or use the\n`extra_kwargs` option to set the `required` flag.\n\nCorresponds to `django.db.models.fields.BooleanField`.\n\n**Signature:** `BooleanField()`\n\n---\n\n## String fields\n\n### CharField\n\nA text representation. Optionally validates the text to be shorter than `max_length` and longer than `min_length`.\n\nCorresponds to `django.db.models.fields.CharField` or `django.db.models.fields.TextField`.\n\n**Signature:** `CharField(max_length=None, min_length=None, allow_blank=False, trim_whitespace=True)`\n\n* `max_length` - Validates that the input contains no more than this number of characters.\n* `min_length` - Validates that the input contains no fewer than this number of characters.\n* `allow_blank` - If set to `True` then the empty string should be considered a valid value. If set to `False` then the empty string is considered invalid and will raise a validation error. Defaults to `False`.\n* `trim_whitespace` - If set to `True` then leading and trailing whitespace is trimmed. Defaults to `True`.\n\nThe `allow_null` option is also available for string fields, although its usage is discouraged in favor of `allow_blank`. It is valid to set both `allow_blank=True` and `allow_null=True`, but doing so means that there will be two differing types of empty value permissible for string representations, which can lead to data inconsistencies and subtle application bugs.\n\n### EmailField\n\nA text representation, validates the text to be a valid email address.\n\nCorresponds to `django.db.models.fields.EmailField`\n\n**Signature:** `EmailField(max_length=None, min_length=None, allow_blank=False)`\n\n### RegexField\n\nA text representation, that validates the given value matches against a certain regular expression.\n\nCorresponds to `django.forms.fields.RegexField`.\n\n**Signature:** `RegexField(regex, max_length=None, min_length=None, allow_blank=False)`\n\nThe mandatory `regex` argument may either be a string, or a compiled python regular expression object.\n\nUses Django's `django.core.validators.RegexValidator` for validation.\n\n### SlugField\n\nA `RegexField` that validates the input against the pattern `[a-zA-Z0-9_-]+`.\n\nCorresponds to `django.db.models.fields.SlugField`.\n\n**Signature:** `SlugField(max_length=50, min_length=None, allow_blank=False)`\n\n### URLField\n\nA `RegexField` that validates the input against a URL matching pattern. Expects fully qualified URLs of the form `http://<host>/<path>`.\n\nCorresponds to `django.db.models.fields.URLField`.  Uses Django's `django.core.validators.URLValidator` for validation.\n\n**Signature:** `URLField(max_length=200, min_length=None, allow_blank=False)`\n\n### UUIDField\n\nA field that ensures the input is a valid UUID string. The `to_internal_value` method will return a `uuid.UUID` instance. On output the field will return a string in the canonical hyphenated format, for example:\n\n    \"de305d54-75b4-431b-adb2-eb6b9e546013\"\n\n**Signature:** `UUIDField(format='hex_verbose')`\n\n* `format`: Determines the representation format of the uuid value\n    * `'hex_verbose'` - The canonical hex representation, including hyphens: `\"5ce0e9a5-5ffa-654b-cee0-1238041fb31a\"`\n    * `'hex'` - The compact hex representation of the UUID, not including hyphens: `\"5ce0e9a55ffa654bcee01238041fb31a\"`\n    * `'int'` - A 128 bit integer representation of the UUID: `\"123456789012312313134124512351145145114\"`\n    * `'urn'` - RFC 4122 URN representation of the UUID: `\"urn:uuid:5ce0e9a5-5ffa-654b-cee0-1238041fb31a\"`\n  Changing the `format` parameters only affects representation values. All formats are accepted by `to_internal_value`\n\n### FilePathField\n\nA field whose choices are limited to the filenames in a certain directory on the filesystem\n\nCorresponds to `django.forms.fields.FilePathField`.\n\n**Signature:** `FilePathField(path, match=None, recursive=False, allow_files=True, allow_folders=False, required=None, **kwargs)`\n\n* `path` - The absolute filesystem path to a directory from which this FilePathField should get its choice.\n* `match` - A regular expression, as a string, that FilePathField will use to filter filenames.\n* `recursive` - Specifies whether all subdirectories of path should be included.  Default is `False`.\n* `allow_files` - Specifies whether files in the specified location should be included. Default is `True`. Either this or `allow_folders` must be `True`.\n* `allow_folders` - Specifies whether folders in the specified location should be included. Default is `False`. Either this or `allow_files` must be `True`.\n\n### IPAddressField\n\nA field that ensures the input is a valid IPv4 or IPv6 string.\n\nCorresponds to `django.forms.fields.IPAddressField` and `django.forms.fields.GenericIPAddressField`.\n\n**Signature**: `IPAddressField(protocol='both', unpack_ipv4=False, **options)`\n\n* `protocol` Limits valid inputs to the specified protocol. Accepted values are 'both' (default), 'IPv4' or 'IPv6'. Matching is case-insensitive.\n* `unpack_ipv4` Unpacks IPv4 mapped addresses like ::ffff:192.0.2.1. If this option is enabled that address would be unpacked to 192.0.2.1. Default is disabled. Can only be used when protocol is set to 'both'.\n\n---\n\n## Numeric fields\n\n### IntegerField\n\nAn integer representation.\n\nCorresponds to `django.db.models.fields.IntegerField`, `django.db.models.fields.SmallIntegerField`, `django.db.models.fields.PositiveIntegerField` and `django.db.models.fields.PositiveSmallIntegerField`.\n\n**Signature**: `IntegerField(max_value=None, min_value=None)`\n\n* `max_value` Validate that the number provided is no greater than this value.\n* `min_value` Validate that the number provided is no less than this value.\n\n### BigIntegerField\n\nA biginteger representation.\n\nCorresponds to `django.db.models.fields.BigIntegerField`.\n\n**Signature**: `BigIntegerField(max_value=None, min_value=None, coerce_to_string=None)`\n\n* `max_value` Validate that the number provided is no greater than this value.\n* `min_value` Validate that the number provided is no less than this value.\n* `coerce_to_string` Set to `True` if string values should be returned for the representation, or `False` if `BigInteger` objects should be returned. Defaults to the same value as the `COERCE_BIGINT_TO_STRING` settings key, which will be `False` unless overridden. If `BigInteger` objects are returned by the serializer, then the final output format will be determined by the renderer.\n\n### FloatField\n\nA floating point representation.\n\nCorresponds to `django.db.models.fields.FloatField`.\n\n**Signature**: `FloatField(max_value=None, min_value=None)`\n\n* `max_value` Validate that the number provided is no greater than this value.\n* `min_value` Validate that the number provided is no less than this value.\n\n### DecimalField\n\nA decimal representation, represented in Python by a `Decimal` instance.\n\nCorresponds to `django.db.models.fields.DecimalField`.\n\n**Signature**: `DecimalField(max_digits, decimal_places, coerce_to_string=None, max_value=None, min_value=None)`\n\n* `max_digits` The maximum number of digits allowed in the number. It must be either `None` or an integer greater than or equal to `decimal_places`.\n* `decimal_places` The number of decimal places to store with the number.\n* `coerce_to_string` Set to `True` if string values should be returned for the representation, or `False` if `Decimal` objects should be returned. Defaults to the same value as the `COERCE_DECIMAL_TO_STRING` settings key, which will be `True` unless overridden. If `Decimal` objects are returned by the serializer, then the final output format will be determined by the renderer. Note that setting `localize` will force the value to `True`.\n* `max_value` Validate that the number provided is no greater than this value. Should be an integer or `Decimal` object.\n* `min_value` Validate that the number provided is no less than this value. Should be an integer or `Decimal` object.\n* `localize` Set to `True` to enable localization of input and output based on the current locale. This will also force `coerce_to_string` to `True`. Defaults to `False`. Note that data formatting is enabled if you have set `USE_L10N=True` in your settings file.\n* `rounding` Sets the rounding mode used when quantizing to the configured precision. Valid values are [`decimal` module rounding modes][python-decimal-rounding-modes]. Defaults to `None`.\n* `normalize_output` Will normalize the decimal value when serialized. This will strip all trailing zeroes and change the value's precision to the minimum required precision to be able to represent the value without losing data. Defaults to `False`.\n\n#### Example usage\n\nTo validate numbers up to 999 with a resolution of 2 decimal places, you would use:\n\n    serializers.DecimalField(max_digits=5, decimal_places=2)\n\nAnd to validate numbers up to anything less than one billion with a resolution of 10 decimal places:\n\n    serializers.DecimalField(max_digits=19, decimal_places=10)\n\n---\n\n## Date and time fields\n\n### DateTimeField\n\nA date and time representation.\n\nCorresponds to `django.db.models.fields.DateTimeField`.\n\n**Signature:** `DateTimeField(format=api_settings.DATETIME_FORMAT, input_formats=None, default_timezone=None)`\n\n* `format` - A string representing the output format. If not specified, this defaults to the same value as the `DATETIME_FORMAT` settings key, which will be `'iso-8601'` unless set. Setting to a format string indicates that `to_representation` return values should be coerced to string output. Format strings are described below. Setting this value to `None` indicates that Python `datetime` objects should be returned by `to_representation`. In this case the datetime encoding will be determined by the renderer.\n* `input_formats` - A list of strings representing the input formats which may be used to parse the date.  If not specified, the `DATETIME_INPUT_FORMATS` setting will be used, which defaults to `['iso-8601']`.\n* `default_timezone` - A `tzinfo` subclass (`zoneinfo` or `pytz`) representing the timezone. If not specified and the `USE_TZ` setting is enabled, this defaults to the [current timezone][django-current-timezone]. If `USE_TZ` is disabled, then datetime objects will be naive.\n\n#### `DateTimeField` format strings.\n\nFormat strings may either be [Python strftime formats][strftime] which explicitly specify the format, or the special string `'iso-8601'`, which indicates that [ISO 8601][iso8601] style datetimes should be used. (eg `'2013-01-29T12:34:56.000000Z'`)\n\nWhen a value of `None` is used for the format `datetime` objects will be returned by `to_representation` and the final output representation will be determined by the renderer class.\n\n#### `auto_now` and `auto_now_add` model fields.\n\nWhen using `ModelSerializer` or `HyperlinkedModelSerializer`, note that any model fields with `auto_now=True` or `auto_now_add=True` will use serializer fields that are `read_only=True` by default.\n\nIf you want to override this behavior, you'll need to declare the `DateTimeField` explicitly on the serializer.  For example:\n\n    class CommentSerializer(serializers.ModelSerializer):\n        created = serializers.DateTimeField()\n\n        class Meta:\n            model = Comment\n\n### DateField\n\nA date representation.\n\nCorresponds to `django.db.models.fields.DateField`\n\n**Signature:** `DateField(format=api_settings.DATE_FORMAT, input_formats=None)`\n\n* `format` - A string representing the output format.  If not specified, this defaults to the same value as the `DATE_FORMAT` settings key, which will be `'iso-8601'` unless set. Setting to a format string indicates that `to_representation` return values should be coerced to string output. Format strings are described below. Setting this value to `None` indicates that Python `date` objects should be returned by `to_representation`. In this case the date encoding will be determined by the renderer.\n* `input_formats` - A list of strings representing the input formats which may be used to parse the date.  If not specified, the `DATE_INPUT_FORMATS` setting will be used, which defaults to `['iso-8601']`.\n\n#### `DateField` format strings\n\nFormat strings may either be [Python strftime formats][strftime] which explicitly specify the format, or the special string `'iso-8601'`, which indicates that [ISO 8601][iso8601] style dates should be used. (eg `'2013-01-29'`)\n\n### TimeField\n\nA time representation.\n\nCorresponds to `django.db.models.fields.TimeField`\n\n**Signature:** `TimeField(format=api_settings.TIME_FORMAT, input_formats=None)`\n\n* `format` - A string representing the output format.  If not specified, this defaults to the same value as the `TIME_FORMAT` settings key, which will be `'iso-8601'` unless set. Setting to a format string indicates that `to_representation` return values should be coerced to string output. Format strings are described below. Setting this value to `None` indicates that Python `time` objects should be returned by `to_representation`. In this case the time encoding will be determined by the renderer.\n* `input_formats` - A list of strings representing the input formats which may be used to parse the date.  If not specified, the `TIME_INPUT_FORMATS` setting will be used, which defaults to `['iso-8601']`.\n\n#### `TimeField` format strings\n\nFormat strings may either be [Python strftime formats][strftime] which explicitly specify the format, or the special string `'iso-8601'`, which indicates that [ISO 8601][iso8601] style times should be used. (eg `'12:34:56.000000'`)\n\n### DurationField\n\nA Duration representation.\nCorresponds to `django.db.models.fields.DurationField`\n\nThe `validated_data` for these fields will contain a `datetime.timedelta` instance.\n\n**Signature:** `DurationField(format=api_settings.DURATION_FORMAT, max_value=None, min_value=None)`\n\n* `format` - A string representing the output format.  If not specified, this defaults to the same value as the `DURATION_FORMAT` settings key, which will be `'django'` unless set. Formats are described below. Setting this value to `None` indicates that Python `timedelta` objects should be returned by `to_representation`. In this case the date encoding will be determined by the renderer.\n* `max_value` Validate that the duration provided is no greater than this value.\n* `min_value` Validate that the duration provided is no less than this value.\n\n#### `DurationField` formats\nFormat may either be the special string `'iso-8601'`, which indicates that [ISO 8601][iso8601] style intervals should be used (eg `'P4DT1H15M20S'`), or `'django'` which indicates that Django interval format `'[DD] [HH:[MM:]]ss[.uuuuuu]'` should be used (eg: `'4 1:15:20'`).\n\n---\n\n## Choice selection fields\n\n### ChoiceField\n\nA field that can accept a value out of a limited set of choices.\n\nUsed by `ModelSerializer` to automatically generate fields if the corresponding model field includes a `choices=…` argument.\n\n**Signature:** `ChoiceField(choices)`\n\n* `choices` - A list of valid values, or a list of `(key, display_name)` tuples.\n* `allow_blank` - If set to `True` then the empty string should be considered a valid value. If set to `False` then the empty string is considered invalid and will raise a validation error. Defaults to `False`.\n* `html_cutoff` - If set this will be the maximum number of choices that will be displayed by a HTML select drop down. Can be used to ensure that automatically generated ChoiceFields with very large possible selections do not prevent a template from rendering. Defaults to `None`.\n* `html_cutoff_text` - If set this will display a textual indicator if the maximum number of items have been cutoff in an HTML select drop down. Defaults to `\"More than {count} items…\"`\n\nBoth the `allow_blank` and `allow_null` are valid options on `ChoiceField`, although it is highly recommended that you only use one and not both. `allow_blank` should be preferred for textual choices, and `allow_null` should be preferred for numeric or other non-textual choices.\n\n### MultipleChoiceField\n\nA field that can accept a list of zero, one or many values, chosen from a limited set of choices. Takes a single mandatory argument. `to_internal_value` returns a `list` containing the selected values, deduplicated.\n\n**Signature:** `MultipleChoiceField(choices)`\n\n* `choices` - A list of valid values, or a list of `(key, display_name)` tuples.\n* `allow_blank` - If set to `True` then the empty string should be considered a valid value. If set to `False` then the empty string is considered invalid and will raise a validation error. Defaults to `False`.\n* `html_cutoff` - If set this will be the maximum number of choices that will be displayed by a HTML select drop down. Can be used to ensure that automatically generated ChoiceFields with very large possible selections do not prevent a template from rendering. Defaults to `None`.\n* `html_cutoff_text` - If set this will display a textual indicator if the maximum number of items have been cutoff in an HTML select drop down. Defaults to `\"More than {count} items…\"`\n\nAs with `ChoiceField`, both the `allow_blank` and `allow_null` options are valid, although it is highly recommended that you only use one and not both. `allow_blank` should be preferred for textual choices, and `allow_null` should be preferred for numeric or other non-textual choices.\n\n---\n\n## File upload fields\n\n!!! note\n    The `FileField` and `ImageField` classes are only suitable for use with `MultiPartParser` or `FileUploadParser`. Most parsers, such as e.g. JSON don't support file uploads.\n    Django's regular [FILE_UPLOAD_HANDLERS] are used for handling uploaded files.\n\n### FileField\n\nA file representation.  Performs Django's standard FileField validation.\n\nCorresponds to `django.forms.fields.FileField`.\n\n**Signature:** `FileField(max_length=None, allow_empty_file=False, use_url=UPLOADED_FILES_USE_URL)`\n\n* `max_length` - Designates the maximum length for the file name.\n* `allow_empty_file` - Designates if empty files are allowed.\n* `use_url` - If set to `True` then URL string values will be used for the output representation. If set to `False` then filename string values will be used for the output representation. Defaults to the value of the `UPLOADED_FILES_USE_URL` settings key, which is `True` unless set otherwise.\n\n### ImageField\n\nAn image representation. Validates the uploaded file content as matching a known image format.\n\nCorresponds to `django.forms.fields.ImageField`.\n\n**Signature:** `ImageField(max_length=None, allow_empty_file=False, use_url=UPLOADED_FILES_USE_URL)`\n\n* `max_length` - Designates the maximum length for the file name.\n* `allow_empty_file` - Designates if empty files are allowed.\n* `use_url` - If set to `True` then URL string values will be used for the output representation. If set to `False` then filename string values will be used for the output representation. Defaults to the value of the `UPLOADED_FILES_USE_URL` settings key, which is `True` unless set otherwise.\n\nRequires either the `Pillow` package or `PIL` package.  The `Pillow` package is recommended, as `PIL` is no longer actively maintained.\n\n---\n\n## Composite fields\n\n### ListField\n\nA field class that validates a list of objects.\n\n**Signature**: `ListField(child=<A_FIELD_INSTANCE>, allow_empty=True, min_length=None, max_length=None)`\n\n* `child` - A field instance that should be used for validating the objects in the list. If this argument is not provided then objects in the list will not be validated.\n* `allow_empty` - Designates if empty lists are allowed.\n* `min_length` - Validates that the list contains no fewer than this number of elements.\n* `max_length` - Validates that the list contains no more than this number of elements.\n\nFor example, to validate a list of integers you might use something like the following:\n\n    scores = serializers.ListField(\n       child=serializers.IntegerField(min_value=0, max_value=100)\n    )\n\nThe `ListField` class also supports a declarative style that allows you to write reusable list field classes.\n\n    class StringListField(serializers.ListField):\n        child = serializers.CharField()\n\nWe can now reuse our custom `StringListField` class throughout our application, without having to provide a `child` argument to it.\n\n### DictField\n\nA field class that validates a dictionary of objects. The keys in `DictField` are always assumed to be string values.\n\n**Signature**: `DictField(child=<A_FIELD_INSTANCE>, allow_empty=True)`\n\n* `child` - A field instance that should be used for validating the values in the dictionary. If this argument is not provided then values in the mapping will not be validated.\n* `allow_empty` - Designates if empty dictionaries are allowed.\n\nFor example, to create a field that validates a mapping of strings to strings, you would write something like this:\n\n    document = DictField(child=CharField())\n\nYou can also use the declarative style, as with `ListField`. For example:\n\n    class DocumentField(DictField):\n        child = CharField()\n\n### HStoreField\n\nA preconfigured `DictField` that is compatible with Django's postgres `HStoreField`.\n\n**Signature**: `HStoreField(child=<A_FIELD_INSTANCE>, allow_empty=True)`\n\n* `child` - A field instance that is used for validating the values in the dictionary. The default child field accepts both empty strings and null values.\n* `allow_empty` - Designates if empty dictionaries are allowed.\n\nNote that the child field **must** be an instance of `CharField`, as the hstore extension stores values as strings.\n\n### JSONField\n\nA field class that validates that the incoming data structure consists of valid JSON primitives. In its alternate binary mode, it will represent and validate JSON-encoded binary strings.\n\n**Signature**: `JSONField(binary, encoder)`\n\n* `binary` - If set to `True` then the field will output and validate a JSON encoded string, rather than a primitive data structure. Defaults to `False`.\n* `encoder` - Use this JSON encoder to serialize input object. Defaults to `None`.\n\n---\n\n## Miscellaneous fields\n\n### ReadOnlyField\n\nA field class that simply returns the value of the field without modification.\n\nThis field is used by default with `ModelSerializer` when including field names that relate to an attribute rather than a model field.\n\n**Signature**: `ReadOnlyField()`\n\nFor example, if `has_expired` was a property on the `Account` model, then the following serializer would automatically generate it as a `ReadOnlyField`:\n\n    class AccountSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = Account\n            fields = ['id', 'account_name', 'has_expired']\n\n### HiddenField\n\nA field class that does not take a value based on user input, but instead takes its value from a default value or callable.\n\n**Signature**: `HiddenField()`\n\nFor example, to include a field that always provides the current time as part of the serializer validated data, you would use the following:\n\n    modified = serializers.HiddenField(default=timezone.now)\n\nThe `HiddenField` class is usually only needed if you have some validation that needs to run based on some pre-provided field values, but you do not want to expose all of those fields to the end user.\n\nFor further examples on `HiddenField` see the [validators](validators.md) documentation.\n\n!!! note\n    `HiddenField()` does not appear in `partial=True` serializer (when making `PATCH` request).\n\n### ModelField\n\nA generic field that can be tied to any arbitrary model field. The `ModelField` class delegates the task of serialization/deserialization to its associated model field.  This field can be used to create serializer fields for custom model fields, without having to create a new custom serializer field.\n\nThis field is used by `ModelSerializer` to correspond to custom model field classes.\n\n**Signature:** `ModelField(model_field=<Django ModelField instance>)`\n\nThe `ModelField` class is generally intended for internal use, but can be used by your API if needed.  In order to properly instantiate a `ModelField`, it must be passed a field that is attached to an instantiated model.  For example: `ModelField(model_field=MyModel()._meta.get_field('custom_field'))`\n\n### SerializerMethodField\n\nThis is a read-only field. It gets its value by calling a method on the serializer class it is attached to. It can be used to add any sort of data to the serialized representation of your object.\n\n**Signature**: `SerializerMethodField(method_name=None)`\n\n* `method_name` - The name of the method on the serializer to be called. If not included this defaults to `get_<field_name>`.\n\nThe serializer method referred to by the `method_name` argument should accept a single argument (in addition to `self`), which is the object being serialized. It should return whatever you want to be included in the serialized representation of the object. For example:\n\n    from django.contrib.auth.models import User\n    from django.utils.timezone import now\n    from rest_framework import serializers\n\n    class UserSerializer(serializers.ModelSerializer):\n        days_since_joined = serializers.SerializerMethodField()\n\n        class Meta:\n            model = User\n            fields = '__all__'\n\n        def get_days_since_joined(self, obj):\n            return (now() - obj.date_joined).days\n\n---\n\n## Custom fields\n\nIf you want to create a custom field, you'll need to subclass `Field` and then override either one or both of the `.to_representation()` and `.to_internal_value()` methods.  These two methods are used to convert between the initial datatype, and a primitive, serializable datatype. Primitive datatypes will typically be any of a number, string, boolean, `date`/`time`/`datetime` or `None`. They may also be any list or dictionary like object that only contains other primitive objects. Other types might be supported, depending on the renderer that you are using.\n\nThe `.to_representation()` method is called to convert the initial datatype into a primitive, serializable datatype.\n\nThe `.to_internal_value()` method is called to restore a primitive datatype into its internal python representation. This method should raise a `serializers.ValidationError` if the data is invalid.\n\n### Examples\n\n#### A Basic Custom Field\n\nLet's look at an example of serializing a class that represents an RGB color value:\n\n    class Color:\n        \"\"\"\n        A color represented in the RGB colorspace.\n        \"\"\"\n        def __init__(self, red, green, blue):\n            assert(red >= 0 and green >= 0 and blue >= 0)\n            assert(red < 256 and green < 256 and blue < 256)\n            self.red, self.green, self.blue = red, green, blue\n\n    class ColorField(serializers.Field):\n        \"\"\"\n        Color objects are serialized into 'rgb(#, #, #)' notation.\n        \"\"\"\n        def to_representation(self, value):\n            return \"rgb(%d, %d, %d)\" % (value.red, value.green, value.blue)\n\n        def to_internal_value(self, data):\n            data = data.strip('rgb(').rstrip(')')\n            red, green, blue = [int(col) for col in data.split(',')]\n            return Color(red, green, blue)\n\nBy default field values are treated as mapping to an attribute on the object.  If you need to customize how the field value is accessed and set you need to override `.get_attribute()` and/or `.get_value()`.\n\nAs an example, let's create a field that can be used to represent the class name of the object being serialized:\n\n    class ClassNameField(serializers.Field):\n        def get_attribute(self, instance):\n            # We pass the object instance onto `to_representation`,\n            # not just the field attribute.\n            return instance\n\n        def to_representation(self, value):\n            \"\"\"\n            Serialize the value's class name.\n            \"\"\"\n            return value.__class__.__name__\n\n#### Raising validation errors\n\nOur `ColorField` class above currently does not perform any data validation.\nTo indicate invalid data, we should raise a `serializers.ValidationError`, like so:\n\n    def to_internal_value(self, data):\n        if not isinstance(data, str):\n            msg = 'Incorrect type. Expected a string, but got %s'\n            raise ValidationError(msg % type(data).__name__)\n\n        if not re.match(r'^rgb\\([0-9]+,[0-9]+,[0-9]+\\)$', data):\n            raise ValidationError('Incorrect format. Expected `rgb(#,#,#)`.')\n\n        data = data.strip('rgb(').rstrip(')')\n        red, green, blue = [int(col) for col in data.split(',')]\n\n        if any([col > 255 or col < 0 for col in (red, green, blue)]):\n            raise ValidationError('Value out of range. Must be between 0 and 255.')\n\n        return Color(red, green, blue)\n\nThe `.fail()` method is a shortcut for raising `ValidationError` that takes a message string from the `error_messages` dictionary. For example:\n\n    default_error_messages = {\n        'incorrect_type': 'Incorrect type. Expected a string, but got {input_type}',\n        'incorrect_format': 'Incorrect format. Expected `rgb(#,#,#)`.',\n        'out_of_range': 'Value out of range. Must be between 0 and 255.'\n    }\n\n    def to_internal_value(self, data):\n        if not isinstance(data, str):\n            self.fail('incorrect_type', input_type=type(data).__name__)\n\n        if not re.match(r'^rgb\\([0-9]+,[0-9]+,[0-9]+\\)$', data):\n            self.fail('incorrect_format')\n\n        data = data.strip('rgb(').rstrip(')')\n        red, green, blue = [int(col) for col in data.split(',')]\n\n        if any([col > 255 or col < 0 for col in (red, green, blue)]):\n            self.fail('out_of_range')\n\n        return Color(red, green, blue)\n\nThis style keeps your error messages cleaner and more separated from your code, and should be preferred.\n\n#### Using `source='*'`\n\nHere we'll take an example of a _flat_ `DataPoint` model with `x_coordinate` and `y_coordinate` attributes.\n\n    class DataPoint(models.Model):\n        label = models.CharField(max_length=50)\n        x_coordinate = models.SmallIntegerField()\n        y_coordinate = models.SmallIntegerField()\n\nUsing a custom field and `source='*'` we can provide a nested representation of\nthe coordinate pair:\n\n    class CoordinateField(serializers.Field):\n\n        def to_representation(self, value):\n            ret = {\n                \"x\": value.x_coordinate,\n                \"y\": value.y_coordinate\n            }\n            return ret\n\n        def to_internal_value(self, data):\n            ret = {\n                \"x_coordinate\": data[\"x\"],\n                \"y_coordinate\": data[\"y\"],\n            }\n            return ret\n\n\n    class DataPointSerializer(serializers.ModelSerializer):\n        coordinates = CoordinateField(source='*')\n\n        class Meta:\n            model = DataPoint\n            fields = ['label', 'coordinates']\n\nNote that this example doesn't handle validation. Partly for that reason, in a\nreal project, the coordinate nesting might be better handled with a nested serializer\nusing `source='*'`, with two `IntegerField` instances, each with their own `source`\npointing to the relevant field.\n\nThe key points from the example, though, are:\n\n* `to_representation` is passed the entire `DataPoint` object and must map from that\nto the desired output.\n\n        >>> instance = DataPoint(label='Example', x_coordinate=1, y_coordinate=2)\n        >>> out_serializer = DataPointSerializer(instance)\n        >>> out_serializer.data\n        ReturnDict([('label', 'Example'), ('coordinates', {'x': 1, 'y': 2})])\n\n* Unless our field is to be read-only, `to_internal_value` must map back to a dict\nsuitable for updating our target object. With `source='*'`, the return from\n`to_internal_value` will update the root validated data dictionary, rather than a single key.\n\n        >>> data = {\n        ...     \"label\": \"Second Example\",\n        ...     \"coordinates\": {\n        ...         \"x\": 3,\n        ...         \"y\": 4,\n        ...     }\n        ... }\n        >>> in_serializer = DataPointSerializer(data=data)\n        >>> in_serializer.is_valid()\n        True\n        >>> in_serializer.validated_data\n        OrderedDict([('label', 'Second Example'),\n                     ('y_coordinate', 4),\n                     ('x_coordinate', 3)])\n\nFor completeness let's do the same thing again but with the nested serializer\napproach suggested above:\n\n    class NestedCoordinateSerializer(serializers.Serializer):\n        x = serializers.IntegerField(source='x_coordinate')\n        y = serializers.IntegerField(source='y_coordinate')\n\n\n    class DataPointSerializer(serializers.ModelSerializer):\n        coordinates = NestedCoordinateSerializer(source='*')\n\n        class Meta:\n            model = DataPoint\n            fields = ['label', 'coordinates']\n\nHere the mapping between the target and source attribute pairs (`x` and\n`x_coordinate`, `y` and `y_coordinate`) is handled in the `IntegerField`\ndeclarations. It's our `NestedCoordinateSerializer` that takes `source='*'`.\n\nOur new `DataPointSerializer` exhibits the same behavior as the custom field\napproach.\n\nSerializing:\n\n    >>> out_serializer = DataPointSerializer(instance)\n    >>> out_serializer.data\n    ReturnDict([('label', 'testing'),\n                ('coordinates', OrderedDict([('x', 1), ('y', 2)]))])\n\nDeserializing:\n\n    >>> in_serializer = DataPointSerializer(data=data)\n    >>> in_serializer.is_valid()\n    True\n    >>> in_serializer.validated_data\n    OrderedDict([('label', 'still testing'),\n                 ('x_coordinate', 3),\n                 ('y_coordinate', 4)])\n\nBut we also get the built-in validation for free:\n\n    >>> invalid_data = {\n    ...     \"label\": \"still testing\",\n    ...     \"coordinates\": {\n    ...         \"x\": 'a',\n    ...         \"y\": 'b',\n    ...     }\n    ... }\n    >>> invalid_serializer = DataPointSerializer(data=invalid_data)\n    >>> invalid_serializer.is_valid()\n    False\n    >>> invalid_serializer.errors\n    ReturnDict([('coordinates',\n                 {'x': ['A valid integer is required.'],\n                  'y': ['A valid integer is required.']})])\n\nFor this reason, the nested serializer approach would be the first to try. You\nwould use the custom field approach when the nested serializer becomes infeasible\nor overly complex.\n\n\n## Third party packages\n\nThe following third party packages are also available.\n\n### DRF Compound Fields\n\nThe [drf-compound-fields][drf-compound-fields] package provides \"compound\" serializer fields, such as lists of simple values, which can be described by other fields rather than serializers with the `many=True` option. Also provided are fields for typed dictionaries and values that can be either a specific type or a list of items of that type.\n\n### DRF Extra Fields\n\nThe [drf-extra-fields][drf-extra-fields] package provides extra serializer fields for REST framework, including `Base64ImageField` and `PointField` classes.\n\n### djangorestframework-recursive\n\nthe [djangorestframework-recursive][djangorestframework-recursive] package provides a `RecursiveField` for serializing and deserializing recursive structures\n\n### django-rest-framework-gis\n\nThe [django-rest-framework-gis][django-rest-framework-gis] package provides geographic addons for django rest framework like a `GeometryField` field and a GeoJSON serializer.\n\n[cite]: https://docs.djangoproject.com/en/stable/ref/forms/api/#django.forms.Form.cleaned_data\n[html-and-forms]: ../topics/html-and-forms.md\n[FILE_UPLOAD_HANDLERS]: https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-FILE_UPLOAD_HANDLERS\n[strftime]: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior\n[iso8601]: https://www.w3.org/TR/NOTE-datetime\n[drf-compound-fields]: https://drf-compound-fields.readthedocs.io\n[drf-extra-fields]: https://github.com/Hipo/drf-extra-fields\n[djangorestframework-recursive]: https://github.com/heywbj/django-rest-framework-recursive\n[django-rest-framework-gis]: https://github.com/djangonauts/django-rest-framework-gis\n[python-decimal-rounding-modes]: https://docs.python.org/3/library/decimal.html#rounding-modes\n[django-current-timezone]: https://docs.djangoproject.com/en/stable/topics/i18n/timezones/#default-time-zone-and-current-time-zone\n[django-docs-select-related]: https://docs.djangoproject.com/en/stable/ref/models/querysets/#django.db.models.query.QuerySet.select_related\n"
  },
  {
    "path": "docs/api-guide/filtering.md",
    "content": "---\nsource:\n    - filters.py\n---\n\n# Filtering\n\n> The root QuerySet provided by the Manager describes all objects in the database table.  Usually, though, you'll need to select only a subset of the complete set of objects.\n>\n> &mdash; [Django documentation][cite]\n\nThe default behavior of REST framework's generic list views is to return the entire queryset for a model manager.  Often you will want your API to restrict the items that are returned by the queryset.\n\nThe simplest way to filter the queryset of any view that subclasses `GenericAPIView` is to override the `.get_queryset()` method.\n\nOverriding this method allows you to customize the queryset returned by the view in a number of different ways.\n\n## Filtering against the current user\n\nYou might want to filter the queryset to ensure that only results relevant to the currently authenticated user making the request are returned.\n\nYou can do so by filtering based on the value of `request.user`.\n\nFor example:\n\n    from myapp.models import Purchase\n    from myapp.serializers import PurchaseSerializer\n    from rest_framework import generics\n\n    class PurchaseList(generics.ListAPIView):\n        serializer_class = PurchaseSerializer\n\n        def get_queryset(self):\n            \"\"\"\n            This view should return a list of all the purchases\n            for the currently authenticated user.\n            \"\"\"\n            user = self.request.user\n            return Purchase.objects.filter(purchaser=user)\n\n\n## Filtering against the URL\n\nAnother style of filtering might involve restricting the queryset based on some part of the URL.\n\nFor example if your URL config contained an entry like this:\n\n    re_path('^purchases/(?P<username>.+)/$', PurchaseList.as_view()),\n\nYou could then write a view that returned a purchase queryset filtered by the username portion of the URL:\n\n    class PurchaseList(generics.ListAPIView):\n        serializer_class = PurchaseSerializer\n\n        def get_queryset(self):\n            \"\"\"\n            This view should return a list of all the purchases for\n            the user as determined by the username portion of the URL.\n            \"\"\"\n            username = self.kwargs['username']\n            return Purchase.objects.filter(purchaser__username=username)\n\n## Filtering against query parameters\n\nA final example of filtering the initial queryset would be to determine the initial queryset based on query parameters in the url.\n\nWe can override `.get_queryset()` to deal with URLs such as `http://example.com/api/purchases?username=denvercoder9`, and filter the queryset only if the `username` parameter is included in the URL:\n\n    class PurchaseList(generics.ListAPIView):\n        serializer_class = PurchaseSerializer\n\n        def get_queryset(self):\n            \"\"\"\n            Optionally restricts the returned purchases to a given user,\n            by filtering against a `username` query parameter in the URL.\n            \"\"\"\n            queryset = Purchase.objects.all()\n            username = self.request.query_params.get('username')\n            if username is not None:\n                queryset = queryset.filter(purchaser__username=username)\n            return queryset\n\n---\n\n## Generic Filtering\n\nAs well as being able to override the default queryset, REST framework also includes support for generic filtering backends that allow you to easily construct complex searches and filters.\n\nGeneric filters can also present themselves as HTML controls in the browsable API and admin API.\n\n![Filter Example](../img/filter-controls.png)\n\n### Setting filter backends\n\nThe default filter backends may be set globally, using the `DEFAULT_FILTER_BACKENDS` setting. For example.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend']\n    }\n\nYou can also set the filter backends on a per-view, or per-viewset basis,\nusing the `GenericAPIView` class-based views.\n\n    import django_filters.rest_framework\n    from django.contrib.auth.models import User\n    from myapp.serializers import UserSerializer\n    from rest_framework import generics\n\n    class UserListView(generics.ListAPIView):\n        queryset = User.objects.all()\n        serializer_class = UserSerializer\n        filter_backends = [django_filters.rest_framework.DjangoFilterBackend]\n\n### Filtering and object lookups\n\nNote that if a filter backend is configured for a view, then as well as being used to filter list views, it will also be used to filter the querysets used for returning a single object.\n\nFor instance, given the previous example, and a product with an id of `4675`, the following URL would either return the corresponding object, or return a 404 response, depending on if the filtering conditions were met by the given product instance:\n\n    http://example.com/api/products/4675/?category=clothing&max_price=10.00\n\n### Overriding the initial queryset\n\nNote that you can use both an overridden `.get_queryset()` and generic filtering together, and everything will work as expected.  For example, if `Product` had a many-to-many relationship with `User`, named `purchase`, you might want to write a view like this:\n\n    class PurchasedProductsList(generics.ListAPIView):\n        \"\"\"\n        Return a list of all the products that the authenticated\n        user has ever purchased, with optional filtering.\n        \"\"\"\n        model = Product\n        serializer_class = ProductSerializer\n        filterset_class = ProductFilter\n\n        def get_queryset(self):\n            user = self.request.user\n            return user.purchase_set.all()\n\n---\n\n## API Guide\n\n### DjangoFilterBackend\n\nThe [`django-filter`][django-filter-docs] library includes a `DjangoFilterBackend` class which\nsupports highly customizable field filtering for REST framework.\n\nTo use `DjangoFilterBackend`, first install `django-filter`.\n\n    pip install django-filter\n\nThen add `'django_filters'` to Django's `INSTALLED_APPS`:\n\n    INSTALLED_APPS = [\n        ...\n        'django_filters',\n        ...\n    ]\n\nYou should now either add the filter backend to your settings:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend']\n    }\n\nOr add the filter backend to an individual View or ViewSet.\n\n    from django_filters.rest_framework import DjangoFilterBackend\n\n    class UserListView(generics.ListAPIView):\n        ...\n        filter_backends = [DjangoFilterBackend]\n\nIf all you need is simple equality-based filtering, you can set a `filterset_fields` attribute on the view, or viewset, listing the set of fields you wish to filter against.\n\n    class ProductList(generics.ListAPIView):\n        queryset = Product.objects.all()\n        serializer_class = ProductSerializer\n        filter_backends = [DjangoFilterBackend]\n        filterset_fields = ['category', 'in_stock']\n\nThis will automatically create a `FilterSet` class for the given fields, and will allow you to make requests such as:\n\n    http://example.com/api/products?category=clothing&in_stock=True\n\nFor more advanced filtering requirements you can specify a `FilterSet` class that should be used by the view.\nYou can read more about `FilterSet`s in the [django-filter documentation][django-filter-docs].\nIt's also recommended that you read the section on [DRF integration][django-filter-drf-docs].\n\n\n### SearchFilter\n\nThe `SearchFilter` class supports simple single query parameter based searching, and is based on the [Django admin's search functionality][search-django-admin].\n\nWhen in use, the browsable API will include a `SearchFilter` control:\n\n![Search Filter](../img/search-filter.png)\n\nThe `SearchFilter` class will only be applied if the view has a `search_fields` attribute set.  The `search_fields` attribute should be a list of names of text type fields on the model, such as `CharField` or `TextField`.\n\n    from rest_framework import filters\n\n    class UserListView(generics.ListAPIView):\n        queryset = User.objects.all()\n        serializer_class = UserSerializer\n        filter_backends = [filters.SearchFilter]\n        search_fields = ['username', 'email']\n\nThis will allow the client to filter the items in the list by making queries such as:\n\n    http://example.com/api/users?search=russell\n\nYou can also perform a related lookup on a ForeignKey or ManyToManyField with the lookup API double-underscore notation:\n\n    search_fields = ['username', 'email', 'profile__profession']\n\nFor [JSONField][JSONField] and [HStoreField][HStoreField] fields you can filter based on nested values within the data structure using the same double-underscore notation:\n\n    search_fields = ['data__breed', 'data__owner__other_pets__0__name']\n\nBy default, searches will use case-insensitive partial matches. The search parameter may contain multiple search terms, which should be whitespace and/or comma separated. If multiple search terms are used then objects will be returned in the list only if all the provided terms are matched. Searches may contain _quoted phrases_ with spaces, each phrase is considered as a single search term.\n\n\nThe search behavior may be specified by prefixing field names in `search_fields` with one of the following characters (which is equivalent to adding `__<lookup>` to the field):\n\n| Prefix | Lookup        |                    |\n| ------ | --------------| ------------------ |\n| `^`    | `istartswith` | Starts-with search.|\n| `=`    | `iexact`      | Exact matches.     |\n| `$`    | `iregex`      | Regex search.      |\n| `@`    | `search`      | Full-text search (Currently only supported Django's [PostgreSQL backend][postgres-search]). |\n| None   | `icontains`   | Contains search (Default).  |\n\nFor example:\n\n    search_fields = ['=username', '=email']\n\nBy default, the search parameter is named `'search'`, but this may be overridden with the `SEARCH_PARAM` setting in the `REST_FRAMEWORK` configuration.\n\nTo dynamically change search fields based on request content, it's possible to subclass the `SearchFilter` and override the `get_search_fields()` function. For example, the following subclass will only search on `title` if the query parameter `title_only` is in the request:\n\n    from rest_framework import filters\n\n    class CustomSearchFilter(filters.SearchFilter):\n        def get_search_fields(self, view, request):\n            if request.query_params.get('title_only'):\n                return ['title']\n            return super().get_search_fields(view, request)\n\nFor more details, see the [Django documentation][search-django-admin].\n\n---\n\n### OrderingFilter\n\nThe `OrderingFilter` class supports simple query parameter controlled ordering of results.\n\n![Ordering Filter](../img/ordering-filter.png)\n\nBy default, the query parameter is named `'ordering'`, but this may be overridden with the `ORDERING_PARAM` setting in the `REST_FRAMEWORK` configuration.\n\nFor example, to order users by username:\n\n    http://example.com/api/users?ordering=username\n\nThe client may also specify reverse orderings by prefixing the field name with '-', like so:\n\n    http://example.com/api/users?ordering=-username\n\nMultiple orderings may also be specified:\n\n    http://example.com/api/users?ordering=account,username\n\n#### Specifying which fields may be ordered against\n\nIt's recommended that you explicitly specify which fields the API should allow in the ordering filter.  You can do this by setting an `ordering_fields` attribute on the view, like so:\n\n    class UserListView(generics.ListAPIView):\n        queryset = User.objects.all()\n        serializer_class = UserSerializer\n        filter_backends = [filters.OrderingFilter]\n        ordering_fields = ['username', 'email']\n\nThis helps prevent unexpected data leakage, such as allowing users to order against a password hash field or other sensitive data.\n\nIf you *don't* specify an `ordering_fields` attribute on the view, the filter class will default to allowing the user to filter on any readable fields on the serializer specified by the `serializer_class` attribute.\n\nIf you are confident that the queryset being used by the view doesn't contain any sensitive data, you can also explicitly specify that a view should allow ordering on *any* model field or queryset aggregate, by using the special value `'__all__'`.\n\n    class BookingsListView(generics.ListAPIView):\n        queryset = Booking.objects.all()\n        serializer_class = BookingSerializer\n        filter_backends = [filters.OrderingFilter]\n        ordering_fields = '__all__'\n\n#### Specifying a default ordering\n\nIf an `ordering` attribute is set on the view, this will be used as the default ordering.\n\nTypically you'd instead control this by setting `order_by` on the initial queryset, but using the `ordering` parameter on the view allows you to specify the ordering in a way that it can then be passed automatically as context to a rendered template.  This makes it possible to automatically render column headers differently if they are being used to order the results.\n\n    class UserListView(generics.ListAPIView):\n        queryset = User.objects.all()\n        serializer_class = UserSerializer\n        filter_backends = [filters.OrderingFilter]\n        ordering_fields = ['username', 'email']\n        ordering = ['username']\n\nThe `ordering` attribute may be either a string or a list/tuple of strings.\n\n---\n\n## Custom generic filtering\n\nYou can also provide your own generic filtering backend, or write an installable app for other developers to use.\n\nTo do so override `BaseFilterBackend`, and override the `.filter_queryset(self, request, queryset, view)` method.  The method should return a new, filtered queryset.\n\nAs well as allowing clients to perform searches and filtering, generic filter backends can be useful for restricting which objects should be visible to any given request or user.\n\n### Example\n\nFor example, you might need to restrict users to only being able to see objects they created.\n\n    class IsOwnerFilterBackend(filters.BaseFilterBackend):\n        \"\"\"\n        Filter that only allows users to see their own objects.\n        \"\"\"\n        def filter_queryset(self, request, queryset, view):\n            return queryset.filter(owner=request.user)\n\nWe could achieve the same behavior by overriding `get_queryset()` on the views, but using a filter backend allows you to more easily add this restriction to multiple views, or to apply it across the entire API.\n\n### Customizing the interface\n\nGeneric filters may also present an interface in the browsable API. To do so you should implement a `to_html()` method which returns a rendered HTML representation of the filter. This method should have the following signature:\n\n`to_html(self, request, queryset, view)`\n\nThe method should return a rendered HTML string.\n\n## Third party packages\n\nThe following third party packages provide additional filter implementations.\n\n### Django REST framework filters package\n\nThe [django-rest-framework-filters package][django-rest-framework-filters] works together with the `DjangoFilterBackend` class, and allows you to easily create filters across relationships, or create multiple filter lookup types for a given field.\n\n### Django REST framework full word search filter\n\nThe [djangorestframework-word-filter][django-rest-framework-word-search-filter] developed as alternative to `filters.SearchFilter` which will search full word in text, or exact match.\n\n### Django URL Filter\n\n[django-url-filter][django-url-filter] provides a safe way to filter data via human-friendly URLs. It works very similar to DRF serializers and fields in a sense that they can be nested except they are called filtersets and filters. That provides easy way to filter related data. Also this library is generic-purpose so it can be used to filter other sources of data and not only Django `QuerySet`s.\n\n### drf-url-filters\n\n[drf-url-filter][drf-url-filter] is a simple Django app to apply filters on drf `ModelViewSet`'s `Queryset` in a clean, simple and configurable way. It also supports validations on incoming query params and their values. A beautiful python package `Voluptuous` is being used for validations on the incoming query parameters. The best part about voluptuous is you can define your own validations as per your query params requirements.\n\n[cite]: https://docs.djangoproject.com/en/stable/topics/db/queries/#retrieving-specific-objects-with-filters\n[django-filter-docs]: https://django-filter.readthedocs.io/en/latest/index.html\n[django-filter-drf-docs]: https://django-filter.readthedocs.io/en/latest/guide/rest_framework.html\n[search-django-admin]: https://docs.djangoproject.com/en/stable/ref/contrib/admin/#django.contrib.admin.ModelAdmin.search_fields\n[django-rest-framework-filters]: https://github.com/philipn/django-rest-framework-filters\n[django-rest-framework-word-search-filter]: https://github.com/trollknurr/django-rest-framework-word-search-filter\n[django-url-filter]: https://github.com/miki725/django-url-filter\n[drf-url-filter]: https://github.com/manjitkumar/drf-url-filters\n[HStoreField]: https://docs.djangoproject.com/en/stable/ref/contrib/postgres/fields/#hstorefield\n[JSONField]: https://docs.djangoproject.com/en/stable/ref/models/fields/#django.db.models.JSONField\n[postgres-search]: https://docs.djangoproject.com/en/stable/ref/contrib/postgres/search/\n"
  },
  {
    "path": "docs/api-guide/format-suffixes.md",
    "content": "---\nsource:\n    - urlpatterns.py\n---\n\n# Format suffixes\n\n> Section 6.2.1 does not say that content negotiation should be\nused all the time.\n>\n> &mdash; Roy Fielding, [REST discuss mailing list][cite]\n\nA common pattern for Web APIs is to use filename extensions on URLs to provide an endpoint for a given media type.  For example, 'http://example.com/api/users.json' to serve a JSON representation.\n\nAdding format-suffix patterns to each individual entry in the URLconf for your API is error-prone and non-DRY, so REST framework provides a shortcut to adding these patterns to your URLConf.\n\n## format_suffix_patterns\n\n**Signature**: format_suffix_patterns(urlpatterns, suffix_required=False, allowed=None)\n\nReturns a URL pattern list which includes format suffix patterns appended to each of the URL patterns provided.\n\nArguments:\n\n* **urlpatterns**: Required.  A URL pattern list.\n* **suffix_required**: Optional.  A boolean indicating if suffixes in the URLs should be optional or mandatory.  Defaults to `False`, meaning that suffixes are optional by default.\n* **allowed**: Optional.  A list or tuple of valid format suffixes.  If not provided, a wildcard format suffix pattern will be used.\n\nExample:\n\n    from rest_framework.urlpatterns import format_suffix_patterns\n    from blog import views\n\n    urlpatterns = [\n        path('', views.apt_root),\n        path('comments/', views.comment_list),\n        path('comments/<int:pk>/', views.comment_detail)\n    ]\n\n    urlpatterns = format_suffix_patterns(urlpatterns, allowed=['json', 'html'])\n\nWhen using `format_suffix_patterns`, you must make sure to add the `'format'` keyword argument to the corresponding views.  For example:\n\n    @api_view(['GET', 'POST'])\n    def comment_list(request, format=None):\n        # do stuff...\n\nOr with class-based views:\n\n    class CommentList(APIView):\n        def get(self, request, format=None):\n            # do stuff...\n\n        def post(self, request, format=None):\n            # do stuff...\n\nThe name of the kwarg used may be modified by using the `FORMAT_SUFFIX_KWARG` setting.\n\nAlso note that `format_suffix_patterns` does not support descending into `include` URL patterns.\n\n### Using with `i18n_patterns`\n\nIf using the `i18n_patterns` function provided by Django, as well as `format_suffix_patterns` you should make sure that the `i18n_patterns` function is applied as the final, or outermost function. For example:\n\n    urlpatterns = [\n        …\n    ]\n\n    urlpatterns = i18n_patterns(\n        format_suffix_patterns(urlpatterns, allowed=['json', 'html'])\n    )\n\n---\n\n## Query parameter formats\n\nAn alternative to the format suffixes is to include the requested format in a query parameter. REST framework provides this option by default, and it is used in the browsable API to switch between differing available representations.\n\nTo select a representation using its short format, use the `format` query parameter. For example: `http://example.com/organizations/?format=csv`.\n\nThe name of this query parameter can be modified using the `URL_FORMAT_OVERRIDE` setting. Set the value to `None` to disable this behavior.\n\n---\n\n## Accept headers vs. format suffixes\n\nThere seems to be a view among some of the Web community that filename extensions are not a RESTful pattern, and that `HTTP Accept` headers should always be used instead.\n\nIt is actually a misconception.  For example, take the following quote from Roy Fielding discussing the relative merits of query parameter media-type indicators vs. file extension media-type indicators:\n\n&ldquo;That's why I always prefer extensions.  Neither choice has anything to do with REST.&rdquo; &mdash; Roy Fielding, [REST discuss mailing list][cite2]\n\nThe quote does not mention Accept headers, but it does make it clear that format suffixes should be considered an acceptable pattern.\n\n[cite]: http://tech.groups.yahoo.com/group/rest-discuss/message/5857\n[cite2]: https://groups.yahoo.com/neo/groups/rest-discuss/conversations/topics/14844\n"
  },
  {
    "path": "docs/api-guide/generic-views.md",
    "content": "---\nsource:\n    - mixins.py\n    - generics.py\n---\n\n# Generic views\n\n> Django’s generic views... were developed as a shortcut for common usage patterns... They take certain common idioms and patterns found in view development and abstract them so that you can quickly write common views of data without having to repeat yourself.\n>\n> &mdash; [Django Documentation][cite]\n\nOne of the key benefits of class-based views is the way they allow you to compose bits of reusable behavior.  REST framework takes advantage of this by providing a number of pre-built views that provide for commonly used patterns.\n\nThe generic views provided by REST framework allow you to quickly build API views that map closely to your database models.\n\nIf the generic views don't suit the needs of your API, you can drop down to using the regular `APIView` class, or reuse the mixins and base classes used by the generic views to compose your own set of reusable generic views.\n\n## Examples\n\nTypically when using the generic views, you'll override the view, and set several class attributes.\n\n    from django.contrib.auth.models import User\n    from myapp.serializers import UserSerializer\n    from rest_framework import generics\n    from rest_framework.permissions import IsAdminUser\n\n    class UserList(generics.ListCreateAPIView):\n        queryset = User.objects.all()\n        serializer_class = UserSerializer\n        permission_classes = [IsAdminUser]\n\nFor more complex cases you might also want to override various methods on the view class.  For example.\n\n    class UserList(generics.ListCreateAPIView):\n        queryset = User.objects.all()\n        serializer_class = UserSerializer\n        permission_classes = [IsAdminUser]\n\n        def list(self, request):\n            # Note the use of `get_queryset()` instead of `self.queryset`\n            queryset = self.get_queryset()\n            serializer = UserSerializer(queryset, many=True)\n            return Response(serializer.data)\n\nFor very simple cases you might want to pass through any class attributes using the `.as_view()` method.  For example, your URLconf might include something like the following entry:\n\n    path('users/', ListCreateAPIView.as_view(queryset=User.objects.all(), serializer_class=UserSerializer), name='user-list')\n\n---\n\n## API Reference\n\n### GenericAPIView\n\nThis class extends REST framework's `APIView` class, adding commonly required behavior for standard list and detail views.\n\nEach of the concrete generic views provided is built by combining `GenericAPIView`, with one or more mixin classes.\n\n#### Attributes\n\n**Basic settings**:\n\nThe following attributes control the basic view behavior.\n\n* `queryset` - The queryset that should be used for returning objects from this view.  Typically, you must either set this attribute, or override the `get_queryset()` method. If you are overriding a view method, it is important that you call `get_queryset()` instead of accessing this property directly, as `queryset` will get evaluated once, and those results will be cached for all subsequent requests.\n* `serializer_class` - The serializer class that should be used for validating and deserializing input, and for serializing output.  Typically, you must either set this attribute, or override the `get_serializer_class()` method.\n* `lookup_field` - The model field that should be used for performing object lookup of individual model instances.  Defaults to `'pk'`.  Note that when using hyperlinked APIs you'll need to ensure that *both* the API views *and* the serializer classes set the lookup fields if you need to use a custom value.\n* `lookup_url_kwarg` - The URL keyword argument that should be used for object lookup.  The URL conf should include a keyword argument corresponding to this value.  If unset this defaults to using the same value as `lookup_field`.\n\n**Pagination**:\n\nThe following attributes are used to control pagination when used with list views.\n\n* `pagination_class` - The pagination class that should be used when paginating list results. Defaults to the same value as the `DEFAULT_PAGINATION_CLASS` setting, which is `'rest_framework.pagination.PageNumberPagination'`. Setting `pagination_class=None` will disable pagination on this view.\n\n**Filtering**:\n\n* `filter_backends` - A list of filter backend classes that should be used for filtering the queryset.  Defaults to the same value as the `DEFAULT_FILTER_BACKENDS` setting.\n\n#### Methods\n\n**Base methods**:\n\n##### `get_queryset(self)`\n\nReturns the queryset that should be used for list views, and that should be used as the base for lookups in detail views.  Defaults to returning the queryset specified by the `queryset` attribute.\n\nThis method should always be used rather than accessing `self.queryset` directly, as `self.queryset` gets evaluated only once, and those results are cached for all subsequent requests.\n\nMay be overridden to provide dynamic behavior, such as returning a queryset, that is specific to the user making the request.\n\nFor example:\n\n    def get_queryset(self):\n        user = self.request.user\n        return user.accounts.all()\n\n!!! tip\n    If the `serializer_class` used in the generic view spans ORM relations, leading to an N+1 problem, you could optimize your queryset in this method using `select_related` and `prefetch_related`. To get more information about N+1 problem and use cases of the mentioned methods refer to related section in [django documentation][django-docs-select-related].\n\n#### Avoiding N+1 Queries\n\nWhen listing objects (e.g. using `ListAPIView` or `ModelViewSet`), serializers may trigger an N+1 query pattern if related objects are accessed individually for each item.\n\nTo prevent this, optimize the queryset in `get_queryset()` or by setting the `queryset` class attribute using [`select_related()`](https://docs.djangoproject.com/en/stable/ref/models/querysets/#select-related) and [`prefetch_related()`](https://docs.djangoproject.com/en/stable/ref/models/querysets/#prefetch-related), depending on the type of relationship.\n\n**For ForeignKey and OneToOneField**:\n\nUse `select_related()` to fetch related objects in the same query:\n\n    def get_queryset(self):\n        return Order.objects.select_related(\"customer\", \"billing_address\")\n\n**For reverse and many-to-many relationships**:\n\nUse `prefetch_related()` to efficiently load collections of related objects:\n\n    def get_queryset(self):\n        return Book.objects.prefetch_related(\"categories\", \"reviews__user\")\n\n**Combining both**:\n\n    def get_queryset(self):\n        return (\n            Order.objects\n            .select_related(\"customer\")\n            .prefetch_related(\"items__product\")\n        )\n\nThese optimizations reduce repeated database access and improve list view performance.\n\n---\n\n##### `get_object(self)`\n\nReturns an object instance that should be used for detail views.  Defaults to using the `lookup_field` parameter to filter the base queryset.\n\nMay be overridden to provide more complex behavior, such as object lookups based on more than one URL kwarg.\n\nFor example:\n\n    def get_object(self):\n        queryset = self.get_queryset()\n        filter = {}\n        for field in self.multiple_lookup_fields:\n            filter[field] = self.kwargs[field]\n\n        obj = get_object_or_404(queryset, **filter)\n        self.check_object_permissions(self.request, obj)\n        return obj\n\nNote that if your API doesn't include any object level permissions, you may optionally exclude the `self.check_object_permissions`, and simply return the object from the `get_object_or_404` lookup.\n\n##### `filter_queryset(self, queryset)`\n\nGiven a queryset, filter it with whichever filter backends are in use, returning a new queryset.\n\nFor example:\n\n    def filter_queryset(self, queryset):\n        filter_backends = [CategoryFilter]\n\n        if 'geo_route' in self.request.query_params:\n            filter_backends = [GeoRouteFilter, CategoryFilter]\n        elif 'geo_point' in self.request.query_params:\n            filter_backends = [GeoPointFilter, CategoryFilter]\n\n        for backend in list(filter_backends):\n            queryset = backend().filter_queryset(self.request, queryset, view=self)\n\n        return queryset\n\n##### `get_serializer_class(self)`\n\nReturns the class that should be used for the serializer.  Defaults to returning the `serializer_class` attribute.\n\nMay be overridden to provide dynamic behavior, such as using different serializers for read and write operations, or providing different serializers to different types of users.\n\nFor example:\n\n    def get_serializer_class(self):\n        if self.request.user.is_staff:\n            return FullAccountSerializer\n        return BasicAccountSerializer\n\n**Save and deletion hooks**:\n\nThe following methods are provided by the mixin classes, and provide easy overriding of the object save or deletion behavior.\n\n* `perform_create(self, serializer)` - Called by `CreateModelMixin` when saving a new object instance.\n* `perform_update(self, serializer)` - Called by `UpdateModelMixin` when saving an existing object instance.\n* `perform_destroy(self, instance)` - Called by `DestroyModelMixin` when deleting an object instance.\n\nThese hooks are particularly useful for setting attributes that are implicit in the request, but are not part of the request data.  For instance, you might set an attribute on the object based on the request user, or based on a URL keyword argument.\n\n    def perform_create(self, serializer):\n        serializer.save(user=self.request.user)\n\nThese override points are also particularly useful for adding behavior that occurs before or after saving an object, such as emailing a confirmation, or logging the update.\n\n    def perform_update(self, serializer):\n        instance = serializer.save()\n        send_email_confirmation(user=self.request.user, modified=instance)\n\nYou can also use these hooks to provide additional validation, by raising a `ValidationError()`. This can be useful if you need some validation logic to apply at the point of database save. For example:\n\n    def perform_create(self, serializer):\n        queryset = SignupRequest.objects.filter(user=self.request.user)\n        if queryset.exists():\n            raise ValidationError('You have already signed up')\n        serializer.save(user=self.request.user)\n\n**Other methods**:\n\nYou won't typically need to override the following methods, although you might need to call into them if you're writing custom views using `GenericAPIView`.\n\n* `get_serializer_context(self)` - Returns a dictionary containing any extra context that should be supplied to the serializer.  Defaults to including `'request'`, `'view'` and `'format'` keys.\n* `get_serializer(self, instance=None, data=None, many=False, partial=False)` - Returns a serializer instance.\n* `get_paginated_response(self, data)` - Returns a paginated style `Response` object.\n* `paginate_queryset(self, queryset)` - Paginate a queryset if required, either returning a page object, or `None` if pagination is not configured for this view.\n* `filter_queryset(self, queryset)` - Given a queryset, filter it with whichever filter backends are in use, returning a new queryset.\n\n---\n\n## Mixins\n\nThe mixin classes provide the actions that are used to provide the basic view behavior.  Note that the mixin classes provide action methods rather than defining the handler methods, such as `.get()` and `.post()`, directly.  This allows for more flexible composition of behavior.\n\nThe mixin classes can be imported from `rest_framework.mixins`.\n\n### ListModelMixin\n\nProvides a `.list(request, *args, **kwargs)` method, that implements listing a queryset.\n\nIf the queryset is populated, this returns a `200 OK` response, with a serialized representation of the queryset as the body of the response.  The response data may optionally be paginated.\n\n### CreateModelMixin\n\nProvides a `.create(request, *args, **kwargs)` method, that implements creating and saving a new model instance.\n\nIf an object is created this returns a `201 Created` response, with a serialized representation of the object as the body of the response.  If the representation contains a key named `url`, then the `Location` header of the response will be populated with that value.\n\nIf the request data provided for creating the object was invalid, a `400 Bad Request` response will be returned, with the error details as the body of the response.\n\n### RetrieveModelMixin\n\nProvides a `.retrieve(request, *args, **kwargs)` method, that implements returning an existing model instance in a response.\n\nIf an object can be retrieved this returns a `200 OK` response, with a serialized representation of the object as the body of the response.  Otherwise, it will return a `404 Not Found`.\n\n### UpdateModelMixin\n\nProvides a `.update(request, *args, **kwargs)` method, that implements updating and saving an existing model instance.\n\nAlso provides a `.partial_update(request, *args, **kwargs)` method, which is similar to the `update` method, except that all fields for the update will be optional.  This allows support for HTTP `PATCH` requests.\n\nIf an object is updated this returns a `200 OK` response, with a serialized representation of the object as the body of the response.\n\nIf the request data provided for updating the object was invalid, a `400 Bad Request` response will be returned, with the error details as the body of the response.\n\n### DestroyModelMixin\n\nProvides a `.destroy(request, *args, **kwargs)` method, that implements deletion of an existing model instance.\n\nIf an object is deleted this returns a `204 No Content` response, otherwise it will return a `404 Not Found`.\n\n---\n\n## Concrete View Classes\n\nThe following classes are the concrete generic views.  If you're using generic views this is normally the level you'll be working at unless you need heavily customized behavior.\n\nThe view classes can be imported from `rest_framework.generics`.\n\n### CreateAPIView\n\nUsed for **create-only** endpoints.\n\nProvides a `post` method handler.\n\nExtends: [GenericAPIView], [CreateModelMixin]\n\n### ListAPIView\n\nUsed for **read-only** endpoints to represent a **collection of model instances**.\n\nProvides a `get` method handler.\n\nExtends: [GenericAPIView], [ListModelMixin]\n\n### RetrieveAPIView\n\nUsed for **read-only** endpoints to represent a **single model instance**.\n\nProvides a `get` method handler.\n\nExtends: [GenericAPIView], [RetrieveModelMixin]\n\n### DestroyAPIView\n\nUsed for **delete-only** endpoints for a **single model instance**.\n\nProvides a `delete` method handler.\n\nExtends: [GenericAPIView], [DestroyModelMixin]\n\n### UpdateAPIView\n\nUsed for **update-only** endpoints for a **single model instance**.\n\nProvides `put` and `patch` method handlers.\n\nExtends: [GenericAPIView], [UpdateModelMixin]\n\n### ListCreateAPIView\n\nUsed for **read-write** endpoints to represent a **collection of model instances**.\n\nProvides `get` and `post` method handlers.\n\nExtends: [GenericAPIView], [ListModelMixin], [CreateModelMixin]\n\n### RetrieveUpdateAPIView\n\nUsed for **read or update** endpoints to represent a **single model instance**.\n\nProvides `get`, `put` and `patch` method handlers.\n\nExtends: [GenericAPIView], [RetrieveModelMixin], [UpdateModelMixin]\n\n### RetrieveDestroyAPIView\n\nUsed for **read or delete** endpoints to represent a **single model instance**.\n\nProvides `get` and `delete` method handlers.\n\nExtends: [GenericAPIView], [RetrieveModelMixin], [DestroyModelMixin]\n\n### RetrieveUpdateDestroyAPIView\n\nUsed for **read-write-delete** endpoints to represent a **single model instance**.\n\nProvides `get`, `put`, `patch` and `delete` method handlers.\n\nExtends: [GenericAPIView], [RetrieveModelMixin], [UpdateModelMixin], [DestroyModelMixin]\n\n---\n\n## Customizing the generic views\n\nOften you'll want to use the existing generic views, but use some slightly customized behavior.  If you find yourself reusing some bit of customized behavior in multiple places, you might want to refactor the behavior into a common class that you can then just apply to any view or viewset as needed.\n\n### Creating custom mixins\n\nFor example, if you need to lookup objects based on multiple fields in the URL conf, you could create a mixin class like the following:\n\n    class MultipleFieldLookupMixin:\n        \"\"\"\n        Apply this mixin to any view or viewset to get multiple field filtering\n        based on a `lookup_fields` attribute, instead of the default single field filtering.\n        \"\"\"\n        def get_object(self):\n            queryset = self.get_queryset()             # Get the base queryset\n            queryset = self.filter_queryset(queryset)  # Apply any filter backends\n            filter = {}\n            for field in self.lookup_fields:\n                if self.kwargs.get(field): # Ignore empty fields.\n                    filter[field] = self.kwargs[field]\n            obj = get_object_or_404(queryset, **filter)  # Lookup the object\n            self.check_object_permissions(self.request, obj)\n            return obj\n\nYou can then simply apply this mixin to a view or viewset anytime you need to apply the custom behavior.\n\n    class RetrieveUserView(MultipleFieldLookupMixin, generics.RetrieveAPIView):\n        queryset = User.objects.all()\n        serializer_class = UserSerializer\n        lookup_fields = ['account', 'username']\n\nUsing custom mixins is a good option if you have custom behavior that needs to be used.\n\n### Creating custom base classes\n\nIf you are using a mixin across multiple views, you can take this a step further and create your own set of base views that can then be used throughout your project.  For example:\n\n    class BaseRetrieveView(MultipleFieldLookupMixin,\n                           generics.RetrieveAPIView):\n        pass\n\n    class BaseRetrieveUpdateDestroyView(MultipleFieldLookupMixin,\n                                        generics.RetrieveUpdateDestroyAPIView):\n        pass\n\nUsing custom base classes is a good option if you have custom behavior that consistently needs to be repeated across a large number of views throughout your project.\n\n---\n\n## PUT as create\n\nPrior to version 3.0 the REST framework mixins treated `PUT` as either an update or a create operation, depending on if the object already existed or not.\n\nAllowing `PUT` as create operations is problematic, as it necessarily exposes information about the existence or non-existence of objects. It's also not obvious that transparently allowing re-creating of previously deleted instances is necessarily a better default behavior than simply returning `404` responses.\n\nBoth styles \"`PUT` as 404\" and \"`PUT` as create\" can be valid in different circumstances, but from version 3.0 onwards we now use 404 behavior as the default, due to it being simpler and more obvious.\n\n---\n\n## Third party packages\n\nThe following third party packages provide additional generic view implementations.\n\n### Django Rest Multiple Models\n\n[Django Rest Multiple Models][django-rest-multiple-models] provides a generic view (and mixin) for sending multiple serialized models and/or querysets via a single API request.\n\n\n[cite]: https://docs.djangoproject.com/en/stable/ref/class-based-views/#base-vs-generic-views\n[GenericAPIView]: #genericapiview\n[ListModelMixin]: #listmodelmixin\n[CreateModelMixin]: #createmodelmixin\n[RetrieveModelMixin]: #retrievemodelmixin\n[UpdateModelMixin]: #updatemodelmixin\n[DestroyModelMixin]: #destroymodelmixin\n[django-rest-multiple-models]: https://github.com/MattBroach/DjangoRestMultipleModels\n[django-docs-select-related]: https://docs.djangoproject.com/en/stable/ref/models/querysets/#django.db.models.query.QuerySet.select_related\n"
  },
  {
    "path": "docs/api-guide/metadata.md",
    "content": "---\nsource:\n    - metadata.py\n---\n\n# Metadata\n\n> [The `OPTIONS`] method allows a client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.\n>\n> &mdash; [RFC7231, Section 4.3.7.][cite]\n\nREST framework includes a configurable mechanism for determining how your API should respond to `OPTIONS` requests. This allows you to return API schema or other resource information.\n\nThere are not currently any widely adopted conventions for exactly what style of response should be returned for HTTP `OPTIONS` requests, so we provide an ad-hoc style that returns some useful information.\n\nHere's an example response that demonstrates the information that is returned by default.\n\n    HTTP 200 OK\n    Allow: GET, POST, HEAD, OPTIONS\n    Content-Type: application/json\n\n    {\n        \"name\": \"To Do List\",\n        \"description\": \"List existing 'To Do' items, or create a new item.\",\n        \"renders\": [\n            \"application/json\",\n            \"text/html\"\n        ],\n        \"parses\": [\n            \"application/json\",\n            \"application/x-www-form-urlencoded\",\n            \"multipart/form-data\"\n        ],\n        \"actions\": {\n            \"POST\": {\n                \"note\": {\n                    \"type\": \"string\",\n                    \"required\": false,\n                    \"read_only\": false,\n                    \"label\": \"title\",\n                    \"max_length\": 100\n                }\n            }\n        }\n    }\n\n## Setting the metadata scheme\n\nYou can set the metadata class globally using the `'DEFAULT_METADATA_CLASS'` settings key:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_METADATA_CLASS': 'rest_framework.metadata.SimpleMetadata'\n    }\n\nOr you can set the metadata class individually for a view:\n\n    class APIRoot(APIView):\n        metadata_class = APIRootMetadata\n\n        def get(self, request, format=None):\n            return Response({\n                ...\n            })\n\nThe REST framework package only includes a single metadata class implementation, named `SimpleMetadata`. If you want to use an alternative style you'll need to implement a custom metadata class.\n\n## Creating schema endpoints\n\nIf you have specific requirements for creating schema endpoints that are accessed with regular `GET` requests, you might consider reusing the metadata API for doing so.\n\nFor example, the following additional route could be used on a viewset to provide a linkable schema endpoint.\n\n    @action(methods=['GET'], detail=False)\n    def api_schema(self, request):\n        meta = self.metadata_class()\n        data = meta.determine_metadata(request, self)\n        return Response(data)\n\nThere are a couple of reasons that you might choose to take this approach, including that `OPTIONS` responses [are not cacheable][no-options].\n\n---\n\n## Custom metadata classes\n\nIf you want to provide a custom metadata class you should override `BaseMetadata` and implement the `determine_metadata(self, request, view)` method.\n\nUseful things that you might want to do could include returning schema information, using a format such as [JSON schema][json-schema], or returning debug information to admin users.\n\n### Example\n\nThe following class could be used to limit the information that is returned to `OPTIONS` requests.\n\n    class MinimalMetadata(BaseMetadata):\n        \"\"\"\n        Don't include field and other information for `OPTIONS` requests.\n        Just return the name and description.\n        \"\"\"\n        def determine_metadata(self, request, view):\n            return {\n                'name': view.get_view_name(),\n                'description': view.get_view_description()\n            }\n\nThen configure your settings to use this custom class:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_METADATA_CLASS': 'myproject.apps.core.MinimalMetadata'\n    }\n\n## Third party packages\n\nThe following third party packages provide additional metadata implementations.\n\n### DRF-schema-adapter\n\n[drf-schema-adapter][drf-schema-adapter] is a set of tools that makes it easier to provide schema information to frontend frameworks and libraries. It provides a metadata mixin as well as 2 metadata classes and several adapters suitable to generate [json-schema][json-schema] as well as schema information readable by various libraries.\n\nYou can also write your own adapter to work with your specific frontend.\nIf you wish to do so, it also provides an exporter that can export those schema information to json files.\n\n[cite]: https://tools.ietf.org/html/rfc7231#section-4.3.7\n[no-options]: https://www.mnot.net/blog/2012/10/29/NO_OPTIONS\n[json-schema]: https://json-schema.org/\n[drf-schema-adapter]: https://github.com/drf-forms/drf-schema-adapter\n"
  },
  {
    "path": "docs/api-guide/pagination.md",
    "content": "---\nsource:\n    - pagination.py\n---\n\n# Pagination\n\n> Django provides a few classes that help you manage paginated data – that is, data that’s split across several pages, with “Previous/Next” links.\n>\n> &mdash; [Django documentation][cite]\n\nREST framework includes support for customizable pagination styles. This allows you to modify how large result sets are split into individual pages of data.\n\nThe pagination API can support either:\n\n* Pagination links that are provided as part of the content of the response.\n* Pagination links that are included in response headers, such as `Content-Range` or `Link`.\n\nThe built-in styles currently all use links included as part of the content of the response. This style is more accessible when using the browsable API.\n\nPagination is only performed automatically if you're using the generic views or viewsets. If you're using a regular `APIView`, you'll need to call into the pagination API yourself to ensure you return a paginated response. See the source code for the `mixins.ListModelMixin` and `generics.GenericAPIView` classes for an example.\n\nPagination can be turned off by setting the pagination class to `None`.\n\n## Setting the pagination style\n\nThe pagination style may be set globally, using the `DEFAULT_PAGINATION_CLASS` and `PAGE_SIZE` setting keys. For example, to use the built-in limit/offset pagination, you would do something like this:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',\n        'PAGE_SIZE': 100\n    }\n\nNote that you need to set both the pagination class, and the page size that should be used.  Both `DEFAULT_PAGINATION_CLASS` and `PAGE_SIZE` are `None` by default.\n\nYou can also set the pagination class on an individual view by using the `pagination_class` attribute. Typically you'll want to use the same pagination style throughout your API, although you might want to vary individual aspects of the pagination, such as default or maximum page size, on a per-view basis.\n\n## Modifying the pagination style\n\nIf you want to modify particular aspects of the pagination style, you'll want to override one of the pagination classes, and set the attributes that you want to change.\n\n    class LargeResultsSetPagination(PageNumberPagination):\n        page_size = 1000\n        page_size_query_param = 'page_size'\n        max_page_size = 10000\n\n    class StandardResultsSetPagination(PageNumberPagination):\n        page_size = 100\n        page_size_query_param = 'page_size'\n        max_page_size = 1000\n\nYou can then apply your new style to a view using the `pagination_class` attribute:\n\n    class BillingRecordsView(generics.ListAPIView):\n        queryset = Billing.objects.all()\n        serializer_class = BillingRecordsSerializer\n        pagination_class = LargeResultsSetPagination\n\nOr apply the style globally, using the `DEFAULT_PAGINATION_CLASS` settings key. For example:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PAGINATION_CLASS': 'apps.core.pagination.StandardResultsSetPagination'\n    }\n\n---\n\n## API Reference\n\n### PageNumberPagination\n\nThis pagination style accepts a single number page number in the request query parameters.\n\n**Request**:\n\n    GET https://api.example.org/accounts/?page=4\n\n**Response**:\n\n    HTTP 200 OK\n    {\n        \"count\": 1023,\n        \"next\": \"https://api.example.org/accounts/?page=5\",\n        \"previous\": \"https://api.example.org/accounts/?page=3\",\n        \"results\": [\n           …\n        ]\n    }\n\n#### Setup\n\nTo enable the `PageNumberPagination` style globally, use the following configuration, and set the `PAGE_SIZE` as desired:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',\n        'PAGE_SIZE': 100\n    }\n\nOn `GenericAPIView` subclasses you may also set the `pagination_class` attribute to select `PageNumberPagination` on a per-view basis.\n\nBy default, the query parameter name used for pagination is `page`.\nThis can be customized by subclassing `PageNumberPagination` and overriding the `page_query_param` attribute.\n\nFor example:\n\n    from rest_framework.pagination import PageNumberPagination\n\n    class CustomPagination(PageNumberPagination):\n        page_query_param = 'p'\n\nWith this configuration, clients would request pages using `?p=2` instead of `?page=2`.\n\n#### Configuration\n\nThe `PageNumberPagination` class includes a number of attributes that may be overridden to modify the pagination style.\n\nTo set these attributes you should override the `PageNumberPagination` class, and then enable your custom pagination class as above.\n\n* `django_paginator_class` - The Django Paginator class to use. Default is `django.core.paginator.Paginator`, which should be fine for most use cases.\n* `page_size` - A numeric value indicating the page size. If set, this overrides the `PAGE_SIZE` setting. Defaults to the same value as the `PAGE_SIZE` settings key.\n* `page_query_param` - A string value indicating the name of the query parameter to use for the pagination control.\n* `page_size_query_param` - If set, this is a string value indicating the name of a query parameter that allows the client to set the page size on a per-request basis. Defaults to `None`, indicating that the client may not control the requested page size.\n* `max_page_size` - If set, this is a numeric value indicating the maximum allowable requested page size. This attribute is only valid if `page_size_query_param` is also set.\n* `last_page_strings` - A list or tuple of string values indicating values that may be used with the `page_query_param` to request the final page in the set. Defaults to `('last',)`. For example, use `?page=last` to go directly to the last page.\n* `template` - The name of a template to use when rendering pagination controls in the browsable API. May be overridden to modify the rendering style, or set to `None` to disable HTML pagination controls completely. Defaults to `\"rest_framework/pagination/numbers.html\"`.\n\n---\n\n### LimitOffsetPagination\n\nThis pagination style mirrors the syntax used when looking up multiple database records. The client includes both a \"limit\" and an\n\"offset\" query parameter. The limit indicates the maximum number of items to return, and is equivalent to the `page_size` in other styles. The offset indicates the starting position of the query in relation to the complete set of unpaginated items.\n\n**Request**:\n\n    GET https://api.example.org/accounts/?limit=100&offset=400\n\n**Response**:\n\n    HTTP 200 OK\n    {\n        \"count\": 1023,\n        \"next\": \"https://api.example.org/accounts/?limit=100&offset=500\",\n        \"previous\": \"https://api.example.org/accounts/?limit=100&offset=300\",\n        \"results\": [\n           …\n        ]\n    }\n\n#### Setup\n\nTo enable the `LimitOffsetPagination` style globally, use the following configuration:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination'\n    }\n\nOptionally, you may also set a `PAGE_SIZE` key. If the `PAGE_SIZE` parameter is also used then the `limit` query parameter will be optional, and may be omitted by the client.\n\nOn `GenericAPIView` subclasses you may also set the `pagination_class` attribute to select `LimitOffsetPagination` on a per-view basis.\n\n#### Configuration\n\nThe `LimitOffsetPagination` class includes a number of attributes that may be overridden to modify the pagination style.\n\nTo set these attributes you should override the `LimitOffsetPagination` class, and then enable your custom pagination class as above.\n\n* `default_limit` - A numeric value indicating the limit to use if one is not provided by the client in a query parameter. Defaults to the same value as the `PAGE_SIZE` settings key.\n* `limit_query_param` - A string value indicating the name of the \"limit\" query parameter. Defaults to `'limit'`.\n* `offset_query_param` - A string value indicating the name of the \"offset\" query parameter. Defaults to `'offset'`.\n* `max_limit` - If set this is a numeric value indicating the maximum allowable limit that may be requested by the client. Defaults to `None`.\n* `template` - The name of a template to use when rendering pagination controls in the browsable API. May be overridden to modify the rendering style, or set to `None` to disable HTML pagination controls completely. Defaults to `\"rest_framework/pagination/numbers.html\"`.\n\n---\n\n### CursorPagination\n\nThe cursor-based pagination presents an opaque \"cursor\" indicator that the client may use to page through the result set. This pagination style only presents forward and reverse controls, and does not allow the client to navigate to arbitrary positions.\n\nCursor based pagination requires that there is a unique, unchanging ordering of items in the result set. This ordering might typically be a creation timestamp on the records, as this presents a consistent ordering to paginate against.\n\nCursor based pagination is more complex than other schemes. It also requires that the result set presents a fixed ordering, and does not allow the client to arbitrarily index into the result set. However it does provide the following benefits:\n\n* Provides a consistent pagination view. When used properly `CursorPagination` ensures that the client will never see the same item twice when paging through records, even when new items are being inserted by other clients during the pagination process.\n* Supports usage with very large datasets. With extremely large datasets pagination using offset-based pagination styles may become inefficient or unusable. Cursor based pagination schemes instead have fixed-time properties, and do not slow down as the dataset size increases.\n\n#### Details and limitations\n\nProper use of cursor based pagination requires a little attention to detail. You'll need to think about what ordering you want the scheme to be applied against. The default is to order by `\"-created\"`. This assumes that **there must be a 'created' timestamp field** on the model instances, and will present a \"timeline\" style paginated view, with the most recently added items first.\n\nYou can modify the ordering by overriding the `'ordering'` attribute on the pagination class, or by using the `OrderingFilter` filter class together with `CursorPagination`. When used with `OrderingFilter` you should strongly consider restricting the fields that the user may order by.\n\nProper usage of cursor pagination should have an ordering field that satisfies the following:\n\n* Should be an unchanging value, such as a timestamp, slug, or other field that is only set once, on creation.\n* Should be unique, or nearly unique. Millisecond precision timestamps are a good example. This implementation of cursor pagination uses a smart \"position plus offset\" style that allows it to properly support not-strictly-unique values as the ordering.\n* Should be a non-nullable value that can be coerced to a string.\n* Should not be a float. Precision errors easily lead to incorrect results.\n  Hint: use decimals instead.\n  (If you already have a float field and must paginate on that, an\n  [example `CursorPagination` subclass that uses decimals to limit precision is available here][float_cursor_pagination_example].)\n* The field should have a database index.\n\nUsing an ordering field that does not satisfy these constraints will generally still work, but you'll be losing some of the benefits of cursor pagination.\n\nFor more technical details on the implementation we use for cursor pagination, the [\"Building cursors for the Disqus API\"][disqus-cursor-api] blog post gives a good overview of the basic approach.\n\n#### Setup\n\nTo enable the `CursorPagination` style globally, use the following configuration, modifying the `PAGE_SIZE` as desired:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.CursorPagination',\n        'PAGE_SIZE': 100\n    }\n\nOn `GenericAPIView` subclasses you may also set the `pagination_class` attribute to select `CursorPagination` on a per-view basis.\n\n#### Configuration\n\nThe `CursorPagination` class includes a number of attributes that may be overridden to modify the pagination style.\n\nTo set these attributes you should override the `CursorPagination` class, and then enable your custom pagination class as above.\n\n* `page_size` = A numeric value indicating the page size. If set, this overrides the `PAGE_SIZE` setting. Defaults to the same value as the `PAGE_SIZE` settings key.\n* `cursor_query_param` = A string value indicating the name of the \"cursor\" query parameter. Defaults to `'cursor'`.\n* `ordering` = This should be a string, or list of strings, indicating the field against which the cursor based pagination will be applied. For example: `ordering = 'slug'`. Defaults to `-created`. This value may also be overridden by using `OrderingFilter` on the view.\n* `template` = The name of a template to use when rendering pagination controls in the browsable API. May be overridden to modify the rendering style, or set to `None` to disable HTML pagination controls completely. Defaults to `\"rest_framework/pagination/previous_and_next.html\"`.\n\n---\n\n## Custom pagination styles\n\nTo create a custom pagination serializer class, you should inherit the subclass `pagination.BasePagination`, override the `paginate_queryset(self, queryset, request, view=None)`, and `get_paginated_response(self, data)` methods:\n\n* The `paginate_queryset` method is passed to the initial queryset and should return an iterable object. That object contains only the data in the requested page.\n* The `get_paginated_response` method is passed to the serialized page data and should return a `Response` instance.\n\nNote that the `paginate_queryset` method may set state on the pagination instance, that may later be used by the `get_paginated_response` method.\n\n### Example\n\nSuppose we want to replace the default pagination output style with a modified format that includes the next and previous links under in a nested 'links' key. We could specify a custom pagination class like so:\n\n    class CustomPagination(pagination.PageNumberPagination):\n        def get_paginated_response(self, data):\n            return Response({\n                'links': {\n                    'next': self.get_next_link(),\n                    'previous': self.get_previous_link()\n                },\n                'count': self.page.paginator.count,\n                'results': data\n            })\n\nWe'd then need to set up the custom class in our configuration:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PAGINATION_CLASS': 'my_project.apps.core.pagination.CustomPagination',\n        'PAGE_SIZE': 100\n    }\n\nNote that if you care about how the ordering of keys is displayed in responses in the browsable API you might choose to use an `OrderedDict` when constructing the body of paginated responses, but this is optional.\n\n### Using your custom pagination class\n\nTo have your custom pagination class be used by default, use the `DEFAULT_PAGINATION_CLASS` setting:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PAGINATION_CLASS': 'my_project.apps.core.pagination.LinkHeaderPagination',\n        'PAGE_SIZE': 100\n    }\n\nAPI responses for list endpoints will now include a `Link` header, instead of including the pagination links as part of the body of the response, for example:\n\n![Link Header][link-header]\n\n*A custom pagination style, using the 'Link' header*\n\n---\n\n## HTML pagination controls\n\nBy default using the pagination classes will cause HTML pagination controls to be displayed in the browsable API. There are two built-in display styles. The `PageNumberPagination` and `LimitOffsetPagination` classes display a list of page numbers with previous and next controls. The `CursorPagination` class displays a simpler style that only displays a previous and next control.\n\n### Customizing the controls\n\nYou can override the templates that render the HTML pagination controls. The two built-in styles are:\n\n* `rest_framework/pagination/numbers.html`\n* `rest_framework/pagination/previous_and_next.html`\n\nProviding a template with either of these paths in a global template directory will override the default rendering for the relevant pagination classes.\n\nAlternatively you can disable HTML pagination controls completely by subclassing on of the existing classes, setting `template = None` as an attribute on the class. You'll then need to configure your `DEFAULT_PAGINATION_CLASS` settings key to use your custom class as the default pagination style.\n\n#### Low-level API\n\nThe low-level API for determining if a pagination class should display the controls or not is exposed as a `display_page_controls` attribute on the pagination instance. Custom pagination classes should be set to `True` in the `paginate_queryset` method if they require the HTML pagination controls to be displayed.\n\nThe `.to_html()` and `.get_html_context()` methods may also be overridden in a custom pagination class in order to further customize how the controls are rendered.\n\n---\n\n## Third party packages\n\nThe following third party packages are also available.\n\n### DRF-extensions\n\nThe [`DRF-extensions` package][drf-extensions] includes a [`PaginateByMaxMixin` mixin class][paginate-by-max-mixin] that allows your API clients to specify `?page_size=max` to obtain the maximum allowed page size.\n\n### drf-proxy-pagination\n\nThe [`drf-proxy-pagination` package][drf-proxy-pagination] includes a `ProxyPagination` class which allows to choose pagination class with a query parameter.\n\n### link-header-pagination\n\nThe [`django-rest-framework-link-header-pagination` package][drf-link-header-pagination] includes a `LinkHeaderPagination` class which provides pagination via an HTTP `Link` header as described in [GitHub REST API documentation][github-traversing-with-pagination].\n\n[cite]: https://docs.djangoproject.com/en/stable/topics/pagination/\n[link-header]: ../img/link-header-pagination.png\n[drf-extensions]: https://chibisov.github.io/drf-extensions/docs/\n[paginate-by-max-mixin]: https://chibisov.github.io/drf-extensions/docs/#paginatebymaxmixin\n[drf-proxy-pagination]: https://github.com/tuffnatty/drf-proxy-pagination\n[drf-link-header-pagination]: https://github.com/tbeadle/django-rest-framework-link-header-pagination\n[disqus-cursor-api]: https://cra.mr/2011/03/08/building-cursors-for-the-disqus-api\n[float_cursor_pagination_example]: https://gist.github.com/keturn/8bc88525a183fd41c73ffb729b8865be#file-fpcursorpagination-py\n[github-traversing-with-pagination]: https://docs.github.com/en/rest/guides/traversing-with-pagination\n"
  },
  {
    "path": "docs/api-guide/parsers.md",
    "content": "---\nsource:\n    - parsers.py\n---\n\n# Parsers\n\n> Machine interacting web services tend to use more\nstructured formats for sending data than form-encoded, since they're\nsending more complex data than simple forms\n>\n> &mdash; Malcom Tredinnick, [Django developers group][cite]\n\nREST framework includes a number of built-in Parser classes, that allow you to accept requests with various media types.  There is also support for defining your own custom parsers, which gives you the flexibility to design the media types that your API accepts.\n\n## How the parser is determined\n\nThe set of valid parsers for a view is always defined as a list of classes.  When `request.data` is accessed, REST framework will examine the `Content-Type` header on the incoming request, and determine which parser to use to parse the request content.\n\n!!! note\n    When developing client applications always remember to make sure you're setting the `Content-Type` header when sending data in an HTTP request.\n\n    If you don't set the content type, most clients will default to using `'application/x-www-form-urlencoded'`, which may not be what you want.\n\n    As an example, if you are sending `json` encoded data using jQuery with the [.ajax() method][jquery-ajax], you should make sure to include the `contentType: 'application/json'` setting.\n\n## Setting the parsers\n\nThe default set of parsers may be set globally, using the `DEFAULT_PARSER_CLASSES` setting. For example, the following settings would allow only requests with `JSON` content, instead of the default of JSON or form data.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PARSER_CLASSES': [\n            'rest_framework.parsers.JSONParser',\n        ]\n    }\n\nYou can also set the parsers used for an individual view, or viewset,\nusing the `APIView` class-based views.\n\n    from rest_framework.parsers import JSONParser\n    from rest_framework.response import Response\n    from rest_framework.views import APIView\n\n    class ExampleView(APIView):\n        \"\"\"\n        A view that can accept POST requests with JSON content.\n        \"\"\"\n        parser_classes = [JSONParser]\n\n        def post(self, request, format=None):\n            return Response({'received data': request.data})\n\nOr, if you're using the `@api_view` decorator with function based views.\n\n    from rest_framework.decorators import api_view\n    from rest_framework.decorators import parser_classes\n    from rest_framework.parsers import JSONParser\n\n    @api_view(['POST'])\n    @parser_classes([JSONParser])\n    def example_view(request, format=None):\n        \"\"\"\n        A view that can accept POST requests with JSON content.\n        \"\"\"\n        return Response({'received data': request.data})\n\n---\n\n## API Reference\n\n### JSONParser\n\nParses `JSON` request content. `request.data` will be populated with a dictionary of data.\n\n**.media_type**: `application/json`\n\n### FormParser\n\nParses HTML form content.  `request.data` will be populated with a `QueryDict` of data.\n\nYou will typically want to use both `FormParser` and `MultiPartParser` together in order to fully support HTML form data.\n\n**.media_type**: `application/x-www-form-urlencoded`\n\n### MultiPartParser\n\nParses multipart HTML form content, which supports file uploads. `request.data` and `request.FILES` will be populated with a `QueryDict` and `MultiValueDict` respectively.\n\nYou will typically want to use both `FormParser` and `MultiPartParser` together in order to fully support HTML form data.\n\n**.media_type**: `multipart/form-data`\n\n### FileUploadParser\n\nParses raw file upload content.  The `request.data` property will be a dictionary with a single key `'file'` containing the uploaded file.\n\nIf the view used with `FileUploadParser` is called with a `filename` URL keyword argument, then that argument will be used as the filename.\n\nIf it is called without a `filename` URL keyword argument, then the client must set the filename in the `Content-Disposition` HTTP header.  For example `Content-Disposition: attachment; filename=upload.jpg`.\n\n**.media_type**: `*/*`\n\n!!! note\n\n    * The `FileUploadParser` is for usage with native clients that can upload the file as a raw data request.  For web-based uploads, or for native clients with multipart upload support, you should use the `MultiPartParser` instead.\n    * Since this parser's `media_type` matches any content type, `FileUploadParser` should generally be the only parser set on an API view.\n    * `FileUploadParser` respects Django's standard `FILE_UPLOAD_HANDLERS` setting, and the `request.upload_handlers` attribute.  See the [Django documentation][upload-handlers] for more details.\n\n#### Basic usage example\n\n    # views.py\n    class FileUploadView(views.APIView):\n        parser_classes = [FileUploadParser]\n\n        def put(self, request, filename, format=None):\n            file_obj = request.data['file']\n            # ...\n            # do some stuff with uploaded file\n            # ...\n            return Response(status=204)\n\n    # urls.py\n    urlpatterns = [\n        # ...\n        re_path(r'^upload/(?P<filename>[^/]+)$', FileUploadView.as_view())\n    ]\n\n---\n\n## Custom parsers\n\nTo implement a custom parser, you should override `BaseParser`, set the `.media_type` property, and implement the `.parse(self, stream, media_type, parser_context)` method.\n\nThe method should return the data that will be used to populate the `request.data` property.\n\nThe arguments passed to `.parse()` are:\n\n### stream\n\nA stream-like object representing the body of the request.\n\n### media_type\n\nOptional.  If provided, this is the media type of the incoming request content.\n\nDepending on the request's `Content-Type:` header, this may be more specific than the renderer's `media_type` attribute, and may include media type parameters.  For example `\"text/plain; charset=utf-8\"`.\n\n### parser_context\n\nOptional.  If supplied, this argument will be a dictionary containing any additional context that may be required to parse the request content.\n\nBy default this will include the following keys: `view`, `request`, `args`, `kwargs`.\n\n### Example\n\nThe following is an example plaintext parser that will populate the `request.data` property with a string representing the body of the request.\n\n    class PlainTextParser(BaseParser):\n        \"\"\"\n        Plain text parser.\n        \"\"\"\n        media_type = 'text/plain'\n\n        def parse(self, stream, media_type=None, parser_context=None):\n            \"\"\"\n            Simply return a string representing the body of the request.\n            \"\"\"\n            return stream.read()\n\n---\n\n## Third party packages\n\nThe following third party packages are also available.\n\n### YAML\n\n[REST framework YAML][rest-framework-yaml] provides [YAML][yaml] parsing and rendering support. It was previously included directly in the REST framework package, and is now instead supported as a third-party package.\n\n#### Installation & configuration\n\nInstall using pip.\n\n    $ pip install djangorestframework-yaml\n\nModify your REST framework settings.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PARSER_CLASSES': [\n            'rest_framework_yaml.parsers.YAMLParser',\n        ],\n        'DEFAULT_RENDERER_CLASSES': [\n            'rest_framework_yaml.renderers.YAMLRenderer',\n        ],\n    }\n\n### XML\n\n[REST Framework XML][rest-framework-xml] provides a simple informal XML format. It was previously included directly in the REST framework package, and is now instead supported as a third-party package.\n\n#### Installation & configuration\n\nInstall using pip.\n\n    $ pip install djangorestframework-xml\n\nModify your REST framework settings.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PARSER_CLASSES': [\n            'rest_framework_xml.parsers.XMLParser',\n        ],\n        'DEFAULT_RENDERER_CLASSES': [\n            'rest_framework_xml.renderers.XMLRenderer',\n        ],\n    }\n\n### MessagePack\n\n[MessagePack][messagepack] is a fast, efficient binary serialization format.  [Juan Riaza][juanriaza] maintains the [djangorestframework-msgpack][djangorestframework-msgpack] package which provides MessagePack renderer and parser support for REST framework.\n\n### CamelCase JSON\n\n[djangorestframework-camel-case] provides camel case JSON renderers and parsers for REST framework.  This allows serializers to use Python-style underscored field names, but be exposed in the API as Javascript-style camel case field names.  It is maintained by [Vitaly Babiy][vbabiy].\n\n[jquery-ajax]: https://api.jquery.com/jQuery.ajax/\n[cite]: https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion\n[upload-handlers]: https://docs.djangoproject.com/en/stable/topics/http/file-uploads/#upload-handlers\n[rest-framework-yaml]: https://jpadilla.github.io/django-rest-framework-yaml/\n[rest-framework-xml]: https://jpadilla.github.io/django-rest-framework-xml/\n[yaml]: http://www.yaml.org/\n[messagepack]: https://github.com/juanriaza/django-rest-framework-msgpack\n[juanriaza]: https://github.com/juanriaza\n[vbabiy]: https://github.com/vbabiy\n[djangorestframework-msgpack]: https://github.com/juanriaza/django-rest-framework-msgpack\n[djangorestframework-camel-case]: https://github.com/vbabiy/djangorestframework-camel-case\n"
  },
  {
    "path": "docs/api-guide/permissions.md",
    "content": "---\nsource:\n    - permissions.py\n---\n\n# Permissions\n\n> Authentication or identification by itself is not usually sufficient to gain access to information or code.  For that, the entity requesting access must have authorization.\n>\n> &mdash; [Apple Developer Documentation][cite]\n\nTogether with [authentication] and [throttling], permissions determine whether a request should be granted or denied access.\n\nPermission checks are always run at the very start of the view, before any other code is allowed to proceed.  Permission checks will typically use the authentication information in the `request.user` and `request.auth` properties to determine if the incoming request should be permitted.\n\nPermissions are used to grant or deny access for different classes of users to different parts of the API.\n\nThe simplest style of permission would be to allow access to any authenticated user, and deny access to any unauthenticated user. This corresponds to the `IsAuthenticated` class in REST framework.\n\nA slightly less strict style of permission would be to allow full access to authenticated users, but allow read-only access to unauthenticated users. This corresponds to the `IsAuthenticatedOrReadOnly` class in REST framework.\n\n## How permissions are determined\n\nPermissions in REST framework are always defined as a list of permission classes.\n\nBefore running the main body of the view each permission in the list is checked.\nIf any permission check fails, an `exceptions.PermissionDenied` or `exceptions.NotAuthenticated` exception will be raised, and the main body of the view will not run.\n\nWhen the permission checks fail, either a \"403 Forbidden\" or a \"401 Unauthorized\" response will be returned, according to the following rules:\n\n* The request was successfully authenticated, but permission was denied. *&mdash; An HTTP 403 Forbidden response will be returned.*\n* The request was not successfully authenticated, and the highest priority authentication class *does not* use `WWW-Authenticate` headers. *&mdash; An HTTP 403 Forbidden response will be returned.*\n* The request was not successfully authenticated, and the highest priority authentication class *does* use `WWW-Authenticate` headers. *&mdash; An HTTP 401 Unauthorized response, with an appropriate `WWW-Authenticate` header will be returned.*\n\n## Object level permissions\n\nREST framework permissions also support object-level permissioning.  Object level permissions are used to determine if a user should be allowed to act on a particular object, which will typically be a model instance.\n\nObject level permissions are run by REST framework's generic views when `.get_object()` is called.\nAs with view level permissions, an `exceptions.PermissionDenied` exception will be raised if the user is not allowed to act on the given object.\n\nIf you're writing your own views and want to enforce object level permissions,\nor if you override the `get_object` method on a generic view, then you'll need to explicitly call the `.check_object_permissions(request, obj)` method on the view at the point at which you've retrieved the object.\n\nThis will either raise a `PermissionDenied` or `NotAuthenticated` exception, or simply return if the view has the appropriate permissions.\n\nFor example:\n\n    def get_object(self):\n        obj = get_object_or_404(self.get_queryset(), pk=self.kwargs[\"pk\"])\n        self.check_object_permissions(self.request, obj)\n        return obj\n\n!!! note\n    With the exception of `DjangoObjectPermissions`, the provided\n    permission classes in `rest_framework.permissions` **do not** implement the\n    methods necessary to check object permissions.\n\n    If you wish to use the provided permission classes in order to check object\n    permissions, **you must** subclass them and implement the\n    `has_object_permission()` method described in the [_Custom\n    permissions_](#custom-permissions) section (below).\n\n#### Limitations of object level permissions\n\nFor performance reasons the generic views will not automatically apply object level permissions to each instance in a queryset when returning a list of objects.\n\nOften when you're using object level permissions you'll also want to [filter the queryset][filtering] appropriately, to ensure that users only have visibility onto instances that they are permitted to view.\n\nBecause the `get_object()` method is not called, object level permissions from the `has_object_permission()` method **are not applied** when creating objects. In order to restrict object creation you need to implement the permission check either in your Serializer class or override the `perform_create()` method of your ViewSet class.\n\n## Setting the permission policy\n\nThe default permission policy may be set globally, using the `DEFAULT_PERMISSION_CLASSES` setting.  For example.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PERMISSION_CLASSES': [\n            'rest_framework.permissions.IsAuthenticated',\n        ]\n    }\n\nIf not specified, this setting defaults to allowing unrestricted access:\n\n    'DEFAULT_PERMISSION_CLASSES': [\n       'rest_framework.permissions.AllowAny',\n    ]\n\nYou can also set the authentication policy on a per-view, or per-viewset basis,\nusing the `APIView` class-based views.\n\n    from rest_framework.permissions import IsAuthenticated\n    from rest_framework.response import Response\n    from rest_framework.views import APIView\n\n    class ExampleView(APIView):\n        permission_classes = [IsAuthenticated]\n\n        def get(self, request, format=None):\n            content = {\n                'status': 'request was permitted'\n            }\n            return Response(content)\n\nOr, if you're using the `@api_view` decorator with function based views.\n\n    from rest_framework.decorators import api_view, permission_classes\n    from rest_framework.permissions import IsAuthenticated\n    from rest_framework.response import Response\n\n    @api_view(['GET'])\n    @permission_classes([IsAuthenticated])\n    def example_view(request, format=None):\n        content = {\n            'status': 'request was permitted'\n        }\n        return Response(content)\n\n!!! note\n    When you set new permission classes via the class attribute or decorators you're telling the view to ignore the default list set in the ``settings.py`` file.\n\nProvided they inherit from `rest_framework.permissions.BasePermission`, permissions can be composed using standard Python bitwise operators. For example, `IsAuthenticatedOrReadOnly` could be written:\n\n    from rest_framework.permissions import BasePermission, IsAuthenticated, SAFE_METHODS\n    from rest_framework.response import Response\n    from rest_framework.views import APIView\n\n    class ReadOnly(BasePermission):\n        def has_permission(self, request, view):\n            return request.method in SAFE_METHODS\n\n    class ExampleView(APIView):\n        permission_classes = [IsAuthenticated | ReadOnly]\n\n        def get(self, request, format=None):\n            content = {\n                'status': 'request was permitted'\n            }\n            return Response(content)\n\n!!! note\n    Composition of permissions supports the `&` (and), `|` (or) and `~` (not) operators, and also allows the use of brackets `(` `)` to group expressions.\n\n    Operators follow the same precedence and associativity rules as standard logical operators (`~` highest, then `&`, then `|`).\n\n\n## API Reference\n\n### AllowAny\n\nThe `AllowAny` permission class will allow unrestricted access, **regardless of if the request was authenticated or unauthenticated**.\n\nThis permission is not strictly required, since you can achieve the same result by using an empty list or tuple for the permissions setting, but you may find it useful to specify this class because it makes the intention explicit.\n\n### IsAuthenticated\n\nThe `IsAuthenticated` permission class will deny permission to any unauthenticated user, and allow permission otherwise.\n\nThis permission is suitable if you want your API to only be accessible to registered users.\n\n### IsAdminUser\n\nThe `IsAdminUser` permission class will deny permission to any user, unless `user.is_staff` is `True` in which case permission will be allowed.\n\nThis permission is suitable if you want your API to only be accessible to a subset of trusted administrators.\n\n### IsAuthenticatedOrReadOnly\n\nThe `IsAuthenticatedOrReadOnly` will allow authenticated users to perform any request.  Requests for unauthenticated users will only be permitted if the request method is one of the \"safe\" methods; `GET`, `HEAD` or `OPTIONS`.\n\nThis permission is suitable if you want to your API to allow read permissions to anonymous users, and only allow write permissions to authenticated users.\n\n### DjangoModelPermissions\n\nThis permission class ties into Django's standard `django.contrib.auth` [model permissions][contribauth].  This permission must only be applied to views that have a `.queryset` property or `get_queryset()` method. Authorization will only be granted if the user *is authenticated* and has the *relevant model permissions* assigned. The appropriate model is determined by checking `get_queryset().model` or `queryset.model`.\n\n* `POST` requests require the user to have the `add` permission on the model.\n* `PUT` and `PATCH` requests require the user to have the `change` permission on the model.\n* `DELETE` requests require the user to have the `delete` permission on the model.\n\nThe default behavior can also be overridden to support custom model permissions.  For example, you might want to include a `view` model permission for `GET` requests.\n\nTo use custom model permissions, override `DjangoModelPermissions` and set the `.perms_map` property.  Refer to the source code for details.\n\n### DjangoModelPermissionsOrAnonReadOnly\n\nSimilar to `DjangoModelPermissions`, but also allows unauthenticated users to have read-only access to the API.\n\n### DjangoObjectPermissions\n\nThis permission class ties into Django's standard [object permissions framework][objectpermissions] that allows per-object permissions on models.  In order to use this permission class, you'll also need to add a permission backend that supports object-level permissions, such as [django-guardian][guardian].\n\nAs with `DjangoModelPermissions`, this permission must only be applied to views that have a `.queryset` property or `.get_queryset()` method. Authorization will only be granted if the user *is authenticated* and has the *relevant per-object permissions* and *relevant model permissions* assigned.\n\n* `POST` requests require the user to have the `add` permission on the model instance.\n* `PUT` and `PATCH` requests require the user to have the `change` permission on the model instance.\n* `DELETE` requests require the user to have the `delete` permission on the model instance.\n\nNote that `DjangoObjectPermissions` **does not** require the `django-guardian` package, and should support other object-level backends equally well.\n\nAs with `DjangoModelPermissions` you can use custom model permissions by overriding `DjangoObjectPermissions` and setting the `.perms_map` property.  Refer to the source code for details.\n\n!!! note\n    If you need object level `view` permissions for `GET`, `HEAD` and `OPTIONS` requests and are using django-guardian for your object-level permissions backend, you'll want to consider using the `DjangoObjectPermissionsFilter` class provided by the [`djangorestframework-guardian` package][django-rest-framework-guardian]. It ensures that list endpoints only return results including objects for which the user has appropriate view permissions.\n\n## Custom permissions\n\nTo implement a custom permission, override `BasePermission` and implement either, or both, of the following methods:\n\n* `.has_permission(self, request, view)`\n* `.has_object_permission(self, request, view, obj)`\n\nThe methods should return `True` if the request should be granted access, and `False` otherwise.\n\nIf you need to test if a request is a read operation or a write operation, you should check the request method against the constant `SAFE_METHODS`, which is a tuple containing `'GET'`, `'OPTIONS'` and `'HEAD'`.  For example:\n\n    if request.method in permissions.SAFE_METHODS:\n        # Check permissions for read-only request\n    else:\n        # Check permissions for write request\n\n!!! note\n    The instance-level `has_object_permission` method will only be called if the view-level `has_permission` checks have already passed. Also note that in order for the instance-level checks to run, the view code should explicitly call `.check_object_permissions(request, obj)`. If you are using the generic views then this will be handled for you by default. (Function-based views will need to check object permissions explicitly, raising `PermissionDenied` on failure.)\n\nCustom permissions will raise a `PermissionDenied` exception if the test fails. To change the error message associated with the exception, implement a `message` attribute directly on your custom permission. Otherwise the `default_detail` attribute from `PermissionDenied` will be used. Similarly, to change the code identifier associated with the exception, implement a `code` attribute directly on your custom permission - otherwise the `default_code` attribute from `PermissionDenied` will be used.\n\n    from rest_framework import permissions\n\n    class CustomerAccessPermission(permissions.BasePermission):\n        message = 'Adding customers not allowed.'\n\n        def has_permission(self, request, view):\n             ...\n\n### Examples\n\nThe following is an example of a permission class that checks the incoming request's IP address against a blocklist, and denies the request if the IP has been blocked.\n\n    from rest_framework import permissions\n\n    class BlocklistPermission(permissions.BasePermission):\n        \"\"\"\n        Global permission check for blocked IPs.\n        \"\"\"\n\n        def has_permission(self, request, view):\n            ip_addr = request.META['REMOTE_ADDR']\n            blocked = Blocklist.objects.filter(ip_addr=ip_addr).exists()\n            return not blocked\n\nAs well as global permissions, that are run against all incoming requests, you can also create object-level permissions, that are only run against operations that affect a particular object instance.  For example:\n\n    class IsOwnerOrReadOnly(permissions.BasePermission):\n        \"\"\"\n        Object-level permission to only allow owners of an object to edit it.\n        Assumes the model instance has an `owner` attribute.\n        \"\"\"\n\n        def has_object_permission(self, request, view, obj):\n            # Read permissions are allowed to any request,\n            # so we'll always allow GET, HEAD or OPTIONS requests.\n            if request.method in permissions.SAFE_METHODS:\n                return True\n\n            # Instance must have an attribute named `owner`.\n            return obj.owner == request.user\n\nNote that the generic views will check the appropriate object level permissions, but if you're writing your own custom views, you'll need to make sure you check the object level permission checks yourself.  You can do so by calling `self.check_object_permissions(request, obj)` from the view once you have the object instance.  This call will raise an appropriate `APIException` if any object-level permission checks fail, and will otherwise simply return.\n\nAlso note that the generic views will only check the object-level permissions for views that retrieve a single model instance.  If you require object-level filtering of list views, you'll need to filter the queryset separately.  See the [filtering documentation][filtering] for more details.\n\n## Overview of access restriction methods\n\nREST framework offers three different methods to customize access restrictions on a case-by-case basis. These apply in different scenarios and have different effects and limitations.\n\n * `queryset`/`get_queryset()`: Limits the general visibility of existing objects from the database. The queryset limits which objects will be listed and which objects can be modified or deleted. The `get_queryset()` method can apply different querysets based on the current action.\n * `permission_classes`/`get_permissions()`: General permission checks based on the current action, request and targeted object. Object level permissions can only be applied to retrieve, modify and deletion actions. Permission checks for list and create will be applied to the entire object type. (In case of list: subject to restrictions in the queryset.)\n * `serializer_class`/`get_serializer()`: Instance level restrictions that apply to all objects on input and output. The serializer may have access to the request context. The `get_serializer()` method can apply different serializers based on the current action.\n\nThe following table lists the access restriction methods and the level of control they offer over which actions.\n\n|                                    | `queryset` | `permission_classes` | `serializer_class` |\n|------------------------------------|------------|----------------------|--------------------|\n| Action: list                       | global     | global               | object-level*      |\n| Action: create                     | no         | global               | object-level       |\n| Action: retrieve                   | global     | object-level         | object-level       |\n| Action: update                     | global     | object-level         | object-level       |\n| Action: partial_update             | global     | object-level         | object-level       |\n| Action: destroy                    | global     | object-level         | no                 |\n| Can reference action in decision   | no**       | yes                  | no**               |\n| Can reference request in decision  | no**       | yes                  | yes                |\n\n \\* A Serializer class should not raise PermissionDenied in a list action, or the entire list would not be returned. <br>\n \\** The `get_*()` methods have access to the current view and can return different Serializer or QuerySet instances based on the request or action.\n\n---\n\n## Third party packages\n\nThe following third party packages are also available.\n\n### DRF - Access Policy\n\nThe [Django REST - Access Policy][drf-access-policy] package provides a way to define complex access rules in declarative policy classes that are attached to view sets or function-based views. The policies are defined in JSON in a format similar to AWS' Identity & Access Management policies. \n\n### Composed Permissions\n\nThe [Composed Permissions][composed-permissions] package provides a simple way to define complex and multi-depth (with logic operators) permission objects, using small and reusable components.\n\n### REST Condition\n\nThe [REST Condition][rest-condition] package is another extension for building complex permissions in a simple and convenient way. The extension allows you to combine permissions with logical operators.\n\n### DRY Rest Permissions\n\nThe [DRY Rest Permissions][dry-rest-permissions] package provides the ability to define different permissions for individual default and custom actions. This package is made for apps with permissions that are derived from relationships defined in the app's data model. It also supports permission checks being returned to a client app through the API's serializer. Additionally it supports adding permissions to the default and custom list actions to restrict the data they retrieve per user.\n\n### Django Rest Framework Roles\n\nThe [Django Rest Framework Roles][django-rest-framework-roles] package makes it easier to parameterize your API over multiple types of users.\n\n### Rest Framework Roles\n\nThe [Rest Framework Roles][rest-framework-roles] makes it super easy to protect views based on roles. Most importantly allows you to decouple accessibility logic from models and views in a clean human-readable way.\n\n### Django REST Framework API Key\n\nThe [Django REST Framework API Key][djangorestframework-api-key] package provides permissions classes, models and helpers to add API key authorization to your API. It can be used to authorize internal or third-party backends and services (i.e. _machines_) which do not have a user account. API keys are stored securely using Django's password hashing infrastructure, and they can be viewed, edited and revoked at anytime in the Django admin.\n\n### Django Rest Framework Role Filters\n\nThe [Django Rest Framework Role Filters][django-rest-framework-role-filters] package provides simple filtering over multiple types of roles.\n\n### Django Rest Framework PSQ\n\nThe [Django Rest Framework PSQ][drf-psq] package is an extension that gives support for having action-based **permission_classes**, **serializer_class**, and **queryset** dependent on permission-based rules.\n\n### Axioms DRF PY\n\nThe [Axioms DRF PY][axioms-drf-py] package is an extension that provides support for authentication and claim-based fine-grained authorization (**scopes**, **roles**, **groups**, **permissions**, etc. including object-level checks) using JWT tokens issued by an OAuth2/OIDC Authorization Server including AWS Cognito, Auth0, Okta, Microsoft Entra, etc.\n\n\n[cite]: https://developer.apple.com/library/mac/#documentation/security/Conceptual/AuthenticationAndAuthorizationGuide/Authorization/Authorization.html\n[authentication]: authentication.md\n[throttling]: throttling.md\n[filtering]: filtering.md\n[contribauth]: https://docs.djangoproject.com/en/stable/topics/auth/customizing/#custom-permissions\n[objectpermissions]: https://docs.djangoproject.com/en/stable/topics/auth/customizing/#handling-object-permissions\n[guardian]: https://github.com/lukaszb/django-guardian\n[filtering]: filtering.md\n[composed-permissions]: https://github.com/niwibe/djangorestframework-composed-permissions\n[rest-condition]: https://github.com/caxap/rest_condition\n[dry-rest-permissions]: https://github.com/FJNR-inc/dry-rest-permissions\n[django-rest-framework-roles]: https://github.com/computer-lab/django-rest-framework-roles\n[rest-framework-roles]: https://github.com/Pithikos/rest-framework-roles\n[djangorestframework-api-key]: https://florimondmanca.github.io/djangorestframework-api-key/\n[django-rest-framework-role-filters]: https://github.com/allisson/django-rest-framework-role-filters\n[django-rest-framework-guardian]: https://github.com/rpkilby/django-rest-framework-guardian\n[drf-access-policy]: https://github.com/rsinger86/drf-access-policy\n[drf-psq]: https://github.com/drf-psq/drf-psq\n[axioms-drf-py]: https://github.com/abhishektiwari/axioms-drf-py\n"
  },
  {
    "path": "docs/api-guide/relations.md",
    "content": "---\nsource:\n    - relations.py\n---\n\n# Serializer relations\n\n> Data structures, not algorithms, are central to programming.\n>\n> &mdash; [Rob Pike][cite]\n\nRelational fields are used to represent model relationships.  They can be applied to `ForeignKey`, `ManyToManyField` and `OneToOneField` relationships, as well as to reverse relationships, and custom relationships such as `GenericForeignKey`.\n\n!!! note\n    The relational fields are declared in `relations.py`, but by convention you should import them from the `serializers` module, using `from rest_framework import serializers` and refer to fields as `serializers.<FieldName>`.\n\n!!! note\n    REST Framework does not attempt to automatically optimize querysets passed to serializers in terms of `select_related` and `prefetch_related` since it would be too much magic. A serializer with a field spanning an ORM relation through its source attribute could require an additional database hit to fetch related objects from the database. It is the programmer's responsibility to optimize queries to avoid additional database hits which could occur while using such a serializer.\n\n    For example, the following serializer would lead to a database hit each time evaluating the tracks field if it is not prefetched:\n    \n        class AlbumSerializer(serializers.ModelSerializer):\n            tracks = serializers.SlugRelatedField(\n                many=True,\n                read_only=True,\n                slug_field='title'\n            )\n    \n            class Meta:\n                model = Album\n                fields = ['album_name', 'artist', 'tracks']\n    \n        # For each album object, tracks should be fetched from database\n        qs = Album.objects.all()\n        print(AlbumSerializer(qs, many=True).data)\n    \n    If `AlbumSerializer` is used to serialize a fairly large queryset with `many=True` then it could be a serious performance problem. Optimizing the queryset passed to `AlbumSerializer` with:\n    \n        qs = Album.objects.prefetch_related('tracks')\n        # No additional database hits required\n        print(AlbumSerializer(qs, many=True).data)\n    \n    would solve the issue.\n\n## Inspecting relationships.\n\nWhen using the `ModelSerializer` class, serializer fields and relationships will be automatically generated for you. Inspecting these automatically generated fields can be a useful tool for determining how to customize the relationship style.\n\nTo do so, open the Django shell, using `python manage.py shell`, then import the serializer class, instantiate it, and print the object representation…\n\n    >>> from myapp.serializers import AccountSerializer\n    >>> serializer = AccountSerializer()\n    >>> print(repr(serializer))\n    AccountSerializer():\n        id = IntegerField(label='ID', read_only=True)\n        name = CharField(allow_blank=True, max_length=100, required=False)\n        owner = PrimaryKeyRelatedField(queryset=User.objects.all())\n\n## API Reference\n\nIn order to explain the various types of relational fields, we'll use a couple of simple models for our examples.  Our models will be for music albums, and the tracks listed on each album.\n\n    class Album(models.Model):\n        album_name = models.CharField(max_length=100)\n        artist = models.CharField(max_length=100)\n\n    class Track(models.Model):\n        album = models.ForeignKey(Album, related_name='tracks', on_delete=models.CASCADE)\n        order = models.IntegerField()\n        title = models.CharField(max_length=100)\n        duration = models.IntegerField()\n\n        class Meta:\n            unique_together = ['album', 'order']\n            ordering = ['order']\n\n        def __str__(self):\n            return '%d: %s' % (self.order, self.title)\n\n### StringRelatedField\n\n`StringRelatedField` may be used to represent the target of the relationship using its `__str__` method.\n\nFor example, the following serializer:\n\n    class AlbumSerializer(serializers.ModelSerializer):\n        tracks = serializers.StringRelatedField(many=True)\n\n        class Meta:\n            model = Album\n            fields = ['album_name', 'artist', 'tracks']\n\nWould serialize to the following representation:\n\n    {\n        'album_name': 'Things We Lost In The Fire',\n        'artist': 'Low',\n        'tracks': [\n            '1: Sunflower',\n            '2: Whitetail',\n            '3: Dinosaur Act',\n            ...\n        ]\n    }\n\nThis field is read only.\n\n**Arguments**:\n\n* `many` - If applied to a to-many relationship, you should set this argument to `True`.\n\n### PrimaryKeyRelatedField\n\n`PrimaryKeyRelatedField` may be used to represent the target of the relationship using its primary key.\n\nFor example, the following serializer:\n\n    class AlbumSerializer(serializers.ModelSerializer):\n        tracks = serializers.PrimaryKeyRelatedField(many=True, read_only=True)\n\n        class Meta:\n            model = Album\n            fields = ['album_name', 'artist', 'tracks']\n\nWould serialize to a representation like this:\n\n    {\n        'album_name': 'Undun',\n        'artist': 'The Roots',\n        'tracks': [\n            89,\n            90,\n            91,\n            ...\n        ]\n    }\n\nBy default this field is read-write, although you can change this behavior using the `read_only` flag.\n\n**Arguments**:\n\n* `queryset` - The queryset used for model instance lookups when validating the field input. Relationships must either set a queryset explicitly, or set `read_only=True`.\n* `many` - If applied to a to-many relationship, you should set this argument to `True`.\n* `allow_null` - If set to `True`, the field will accept values of `None` or the empty string for nullable relationships. Defaults to `False`.\n* `pk_field` - Set to a field to control serialization/deserialization of the primary key's value. For example, `pk_field=UUIDField(format='hex')` would serialize a UUID primary key into its compact hex representation.\n\n\n### HyperlinkedRelatedField\n\n`HyperlinkedRelatedField` may be used to represent the target of the relationship using a hyperlink.\n\nFor example, the following serializer:\n\n    class AlbumSerializer(serializers.ModelSerializer):\n        tracks = serializers.HyperlinkedRelatedField(\n            many=True,\n            read_only=True,\n            view_name='track-detail'\n        )\n\n        class Meta:\n            model = Album\n            fields = ['album_name', 'artist', 'tracks']\n\nWould serialize to a representation like this:\n\n    {\n        'album_name': 'Graceland',\n        'artist': 'Paul Simon',\n        'tracks': [\n            'http://www.example.com/api/tracks/45/',\n            'http://www.example.com/api/tracks/46/',\n            'http://www.example.com/api/tracks/47/',\n            ...\n        ]\n    }\n\nBy default this field is read-write, although you can change this behavior using the `read_only` flag.\n\n!!! note\n    This field is designed for objects that map to a URL that accepts a single URL keyword argument, as set using the `lookup_field` and `lookup_url_kwarg` arguments.\n\n    This is suitable for URLs that contain a single primary key or slug argument as part of the URL.\n\n    If you require more complex hyperlinked representation you'll need to customize the field, as described in the [custom hyperlinked fields](#custom-hyperlinked-fields) section, below.\n\n**Arguments**:\n\n* `view_name` - The view name that should be used as the target of the relationship.  If you're using [the standard router classes][routers] this will be a string with the format `<modelname>-detail`. **required**.\n* `queryset` - The queryset used for model instance lookups when validating the field input. Relationships must either set a queryset explicitly, or set `read_only=True`.\n* `many` - If applied to a to-many relationship, you should set this argument to `True`.\n* `allow_null` - If set to `True`, the field will accept values of `None` or the empty string for nullable relationships. Defaults to `False`.\n* `lookup_field` - The field on the target that should be used for the lookup.  Should correspond to a URL keyword argument on the referenced view.  Default is `'pk'`.\n* `lookup_url_kwarg` - The name of the keyword argument defined in the URL conf that corresponds to the lookup field. Defaults to using the same value as `lookup_field`.\n* `format` - If using format suffixes, hyperlinked fields will use the same format suffix for the target unless overridden by using the `format` argument.\n\n### SlugRelatedField\n\n`SlugRelatedField` may be used to represent the target of the relationship using a field on the target.\n\nFor example, the following serializer:\n\n    class AlbumSerializer(serializers.ModelSerializer):\n        tracks = serializers.SlugRelatedField(\n            many=True,\n            read_only=True,\n            slug_field='title'\n         )\n\n        class Meta:\n            model = Album\n            fields = ['album_name', 'artist', 'tracks']\n\nWould serialize to a representation like this:\n\n    {\n        'album_name': 'Dear John',\n        'artist': 'Loney Dear',\n        'tracks': [\n            'Airport Surroundings',\n            'Everything Turns to You',\n            'I Was Only Going Out',\n            ...\n        ]\n    }\n\nBy default this field is read-write, although you can change this behavior using the `read_only` flag.\n\nWhen using `SlugRelatedField` as a read-write field, you will normally want to ensure that the slug field corresponds to a model field with `unique=True`.\n\n**Arguments**:\n\n* `slug_field` - The field on the target that should be used to represent it.  This should be a field that uniquely identifies any given instance.  For example, `username`.  **required**\n* `queryset` - The queryset used for model instance lookups when validating the field input. Relationships must either set a queryset explicitly, or set `read_only=True`.\n* `many` - If applied to a to-many relationship, you should set this argument to `True`.\n* `allow_null` - If set to `True`, the field will accept values of `None` or the empty string for nullable relationships. Defaults to `False`.\n\n### HyperlinkedIdentityField\n\nThis field can be applied as an identity relationship, such as the `'url'` field on a HyperlinkedModelSerializer.  It can also be used for an attribute on the object.  For example, the following serializer:\n\n    class AlbumSerializer(serializers.HyperlinkedModelSerializer):\n        track_listing = serializers.HyperlinkedIdentityField(view_name='track-list')\n\n        class Meta:\n            model = Album\n            fields = ['album_name', 'artist', 'track_listing']\n\nWould serialize to a representation like this:\n\n    {\n        'album_name': 'The Eraser',\n        'artist': 'Thom Yorke',\n        'track_listing': 'http://www.example.com/api/track_list/12/',\n    }\n\nThis field is always read-only.\n\n**Arguments**:\n\n* `view_name` - The view name that should be used as the target of the relationship.  If you're using [the standard router classes][routers] this will be a string with the format `<model_name>-detail`.  **required**.\n* `lookup_field` - The field on the target that should be used for the lookup.  Should correspond to a URL keyword argument on the referenced view.  Default is `'pk'`.\n* `lookup_url_kwarg` - The name of the keyword argument defined in the URL conf that corresponds to the lookup field. Defaults to using the same value as `lookup_field`.\n* `format` - If using format suffixes, hyperlinked fields will use the same format suffix for the target unless overridden by using the `format` argument.\n\n---\n\n## Nested relationships\n\nAs opposed to previously discussed _references_ to another entity, the referred entity can instead also be embedded or _nested_\nin the representation of the object that refers to it.\nSuch nested relationships can be expressed by using serializers as fields.\n\nIf the field is used to represent a to-many relationship, you should add the `many=True` flag to the serializer field.\n\n### Example\n\nFor example, the following serializer:\n\n    class TrackSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = Track\n            fields = ['order', 'title', 'duration']\n\n    class AlbumSerializer(serializers.ModelSerializer):\n        tracks = TrackSerializer(many=True, read_only=True)\n\n        class Meta:\n            model = Album\n            fields = ['album_name', 'artist', 'tracks']\n\nWould serialize to a nested representation like this:\n\n    >>> album = Album.objects.create(album_name=\"The Gray Album\", artist='Danger Mouse')\n    >>> Track.objects.create(album=album, order=1, title='Public Service Announcement', duration=245)\n    <Track: Track object>\n    >>> Track.objects.create(album=album, order=2, title='What More Can I Say', duration=264)\n    <Track: Track object>\n    >>> Track.objects.create(album=album, order=3, title='Encore', duration=159)\n    <Track: Track object>\n    >>> serializer = AlbumSerializer(instance=album)\n    >>> serializer.data\n    {\n        'album_name': 'The Gray Album',\n        'artist': 'Danger Mouse',\n        'tracks': [\n            {'order': 1, 'title': 'Public Service Announcement', 'duration': 245},\n            {'order': 2, 'title': 'What More Can I Say', 'duration': 264},\n            {'order': 3, 'title': 'Encore', 'duration': 159},\n            ...\n        ],\n    }\n\n### Writable nested serializers\n\nBy default nested serializers are read-only. If you want to support write-operations to a nested serializer field you'll need to create `create()` and/or `update()` methods in order to explicitly specify how the child relationships should be saved:\n\n    class TrackSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = Track\n            fields = ['order', 'title', 'duration']\n\n    class AlbumSerializer(serializers.ModelSerializer):\n        tracks = TrackSerializer(many=True)\n\n        class Meta:\n            model = Album\n            fields = ['album_name', 'artist', 'tracks']\n\n        def create(self, validated_data):\n            tracks_data = validated_data.pop('tracks')\n            album = Album.objects.create(**validated_data)\n            for track_data in tracks_data:\n                Track.objects.create(album=album, **track_data)\n            return album\n\n    >>> data = {\n        'album_name': 'The Gray Album',\n        'artist': 'Danger Mouse',\n        'tracks': [\n            {'order': 1, 'title': 'Public Service Announcement', 'duration': 245},\n            {'order': 2, 'title': 'What More Can I Say', 'duration': 264},\n            {'order': 3, 'title': 'Encore', 'duration': 159},\n        ],\n    }\n    >>> serializer = AlbumSerializer(data=data)\n    >>> serializer.is_valid()\n    True\n    >>> serializer.save()\n    <Album: Album object>\n\n---\n\n## Custom relational fields\n\nIn rare cases where none of the existing relational styles fit the representation you need,\nyou can implement a completely custom relational field, that describes exactly how the\noutput representation should be generated from the model instance.\n\nTo implement a custom relational field, you should override `RelatedField`, and implement the `.to_representation(self, value)` method. This method takes the target of the field as the `value` argument, and should return the representation that should be used to serialize the target. The `value` argument will typically be a model instance.\n\nIf you want to implement a read-write relational field, you must also implement the [`.to_internal_value(self, data)` method][to_internal_value].\n\nTo provide a dynamic queryset based on the `context`, you can also override `.get_queryset(self)` instead of specifying `.queryset` on the class or when initializing the field.\n\n### Example\n\nFor example, we could define a relational field to serialize a track to a custom string representation, using its ordering, title, and duration:\n\n    import time\n\n    class TrackListingField(serializers.RelatedField):\n        def to_representation(self, value):\n            duration = time.strftime('%M:%S', time.gmtime(value.duration))\n            return 'Track %d: %s (%s)' % (value.order, value.name, duration)\n\n    class AlbumSerializer(serializers.ModelSerializer):\n        tracks = TrackListingField(many=True)\n\n        class Meta:\n            model = Album\n            fields = ['album_name', 'artist', 'tracks']\n\nThis custom field would then serialize to the following representation:\n\n    {\n        'album_name': 'Sometimes I Wish We Were an Eagle',\n        'artist': 'Bill Callahan',\n        'tracks': [\n            'Track 1: Jim Cain (04:39)',\n            'Track 2: Eid Ma Clack Shaw (04:19)',\n            'Track 3: The Wind and the Dove (04:34)',\n            ...\n        ]\n    }\n\n---\n\n## Custom hyperlinked fields\n\nIn some cases you may need to customize the behavior of a hyperlinked field, in order to represent URLs that require more than a single lookup field.\n\nYou can achieve this by overriding `HyperlinkedRelatedField`. There are two methods that may be overridden:\n\n**get_url(self, obj, view_name, request, format)**\n\nThe `get_url` method is used to map the object instance to its URL representation.\n\nMay raise a `NoReverseMatch` if the `view_name` and `lookup_field`\nattributes are not configured to correctly match the URL conf.\n\n**get_object(self, view_name, view_args, view_kwargs)**\n\nIf you want to support a writable hyperlinked field then you'll also want to override `get_object`, in order to map incoming URLs back to the object they represent. For read-only hyperlinked fields there is no need to override this method.\n\nThe return value of this method should the object that corresponds to the matched URL conf arguments.\n\nMay raise an `ObjectDoesNotExist` exception.\n\n### Example\n\nSay we have a URL for a customer object that takes two keyword arguments, like so:\n\n    /api/<organization_slug>/customers/<customer_pk>/\n\nThis cannot be represented with the default implementation, which accepts only a single lookup field.\n\nIn this case we'd need to override `HyperlinkedRelatedField` to get the behavior we want:\n\n    from rest_framework import serializers\n    from rest_framework.reverse import reverse\n\n    class CustomerHyperlink(serializers.HyperlinkedRelatedField):\n        # We define these as class attributes, so we don't need to pass them as arguments.\n        view_name = 'customer-detail'\n        queryset = Customer.objects.all()\n\n        def get_url(self, obj, view_name, request, format):\n            url_kwargs = {\n                'organization_slug': obj.organization.slug,\n                'customer_pk': obj.pk\n            }\n            return reverse(view_name, kwargs=url_kwargs, request=request, format=format)\n\n        def get_object(self, view_name, view_args, view_kwargs):\n            lookup_kwargs = {\n               'organization__slug': view_kwargs['organization_slug'],\n               'pk': view_kwargs['customer_pk']\n            }\n            return self.get_queryset().get(**lookup_kwargs)\n\nNote that if you wanted to use this style together with the generic views then you'd also need to override `.get_object` on the view in order to get the correct lookup behavior.\n\nGenerally we recommend a flat style for API representations where possible, but the nested URL style can also be reasonable when used in moderation.\n\n---\n\n## Further notes\n\n### The `queryset` argument\n\nThe `queryset` argument is only ever required for *writable* relationship field, in which case it is used for performing the model instance lookup, that maps from the primitive user input, into a model instance.\n\nIn version 2.x a serializer class could *sometimes* automatically determine the `queryset` argument *if* a `ModelSerializer` class was being used.\n\nThis behavior is now replaced with *always* using an explicit `queryset` argument for writable relational fields.\n\nDoing so reduces the amount of hidden 'magic' that `ModelSerializer` provides, makes the behavior of the field more clear, and ensures that it is trivial to move between using the `ModelSerializer` shortcut, or using fully explicit `Serializer` classes.\n\n### Customizing the HTML display\n\nThe built-in `__str__` method of the model will be used to generate string representations of the objects used to populate the `choices` property. These choices are used to populate select HTML inputs in the browsable API.\n\nTo provide customized representations for such inputs, override `display_value()` of a `RelatedField` subclass. This method will receive a model object, and should return a string suitable for representing it. For example:\n\n    class TrackPrimaryKeyRelatedField(serializers.PrimaryKeyRelatedField):\n        def display_value(self, instance):\n            return 'Track: %s' % (instance.title)\n\n### Select field cutoffs\n\nWhen rendered in the browsable API relational fields will default to only displaying a maximum of 1000 selectable items. If more items are present then a disabled option with \"More than 1000 items…\" will be displayed.\n\nThis behavior is intended to prevent a template from being unable to render in an acceptable timespan due to a very large number of relationships being displayed.\n\nThere are two keyword arguments you can use to control this behavior:\n\n* `html_cutoff` - If set this will be the maximum number of choices that will be displayed by a HTML select drop down. Set to `None` to disable any limiting. Defaults to `1000`.\n* `html_cutoff_text` - If set this will display a textual indicator if the maximum number of items have been cutoff in an HTML select drop down. Defaults to `\"More than {count} items…\"`\n\nYou can also control these globally using the settings `HTML_SELECT_CUTOFF` and `HTML_SELECT_CUTOFF_TEXT`.\n\nIn cases where the cutoff is being enforced you may want to instead use a plain input field in the HTML form. You can do so using the `style` keyword argument. For example:\n\n    assigned_to = serializers.SlugRelatedField(\n       queryset=User.objects.all(),\n       slug_field='username',\n       style={'base_template': 'input.html'}\n    )\n\n### Reverse relations\n\nNote that reverse relationships are not automatically included by the `ModelSerializer` and `HyperlinkedModelSerializer` classes.  To include a reverse relationship, you must explicitly add it to the fields list.  For example:\n\n    class AlbumSerializer(serializers.ModelSerializer):\n        class Meta:\n            fields = ['tracks', ...]\n\nYou'll normally want to ensure that you've set an appropriate `related_name` argument on the relationship, that you can use as the field name.  For example:\n\n    class Track(models.Model):\n        album = models.ForeignKey(Album, related_name='tracks', on_delete=models.CASCADE)\n        ...\n\nIf you have not set a related name for the reverse relationship, you'll need to use the automatically generated related name in the `fields` argument.  For example:\n\n    class AlbumSerializer(serializers.ModelSerializer):\n        class Meta:\n            fields = ['track_set', ...]\n\nSee the Django documentation on [reverse relationships][reverse-relationships] for more details.\n\n### Generic relationships\n\nIf you want to serialize a generic foreign key, you need to define a custom field, to determine explicitly how you want to serialize the targets of the relationship.\n\nFor example, given the following model for a tag, which has a generic relationship with other arbitrary models:\n\n    class TaggedItem(models.Model):\n        \"\"\"\n        Tags arbitrary model instances using a generic relation.\n\n        See: https://docs.djangoproject.com/en/stable/ref/contrib/contenttypes/\n        \"\"\"\n        tag_name = models.SlugField()\n        content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)\n        object_id = models.PositiveIntegerField()\n        tagged_object = GenericForeignKey('content_type', 'object_id')\n\n        def __str__(self):\n            return self.tag_name\n\nAnd the following two models, which may have associated tags:\n\n    class Bookmark(models.Model):\n        \"\"\"\n        A bookmark consists of a URL, and 0 or more descriptive tags.\n        \"\"\"\n        url = models.URLField()\n        tags = GenericRelation(TaggedItem)\n\n\n    class Note(models.Model):\n        \"\"\"\n        A note consists of some text, and 0 or more descriptive tags.\n        \"\"\"\n        text = models.CharField(max_length=1000)\n        tags = GenericRelation(TaggedItem)\n\nWe could define a custom field that could be used to serialize tagged instances, using the type of each instance to determine how it should be serialized:\n\n    class TaggedObjectRelatedField(serializers.RelatedField):\n        \"\"\"\n        A custom field to use for the `tagged_object` generic relationship.\n        \"\"\"\n\n        def to_representation(self, value):\n            \"\"\"\n            Serialize tagged objects to a simple textual representation.\n            \"\"\"\n            if isinstance(value, Bookmark):\n                return 'Bookmark: ' + value.url\n            elif isinstance(value, Note):\n                return 'Note: ' + value.text\n            raise Exception('Unexpected type of tagged object')\n\nIf you need the target of the relationship to have a nested representation, you can use the required serializers inside the `.to_representation()` method:\n\n        def to_representation(self, value):\n            \"\"\"\n            Serialize bookmark instances using a bookmark serializer,\n            and note instances using a note serializer.\n            \"\"\"\n            if isinstance(value, Bookmark):\n                serializer = BookmarkSerializer(value)\n            elif isinstance(value, Note):\n                serializer = NoteSerializer(value)\n            else:\n                raise Exception('Unexpected type of tagged object')\n\n            return serializer.data\n\nNote that reverse generic keys, expressed using the `GenericRelation` field, can be serialized using the regular relational field types, since the type of the target in the relationship is always known.\n\nFor more information see [the Django documentation on generic relations][generic-relations].\n\n### ManyToManyFields with a Through Model\n\nBy default, relational fields that target a ``ManyToManyField`` with a\n``through`` model specified are set to read-only.\n\nIf you explicitly specify a relational field pointing to a\n``ManyToManyField`` with a through model, be sure to set ``read_only``\nto ``True``.\n\nIf you wish to represent [extra fields on a through model][django-intermediary-manytomany] then you may serialize the through model as [a nested object][dealing-with-nested-objects].\n\n---\n\n## Third Party Packages\n\nThe following third party packages are also available.\n\n### DRF Nested Routers\n\nThe [drf-nested-routers package][drf-nested-routers] provides routers and relationship fields for working with nested resources.\n\n### Rest Framework Generic Relations\n\nThe [rest-framework-generic-relations][drf-nested-relations] library provides read/write serialization for generic foreign keys.\n\nThe [rest-framework-gm2m-relations][drf-gm2m-relations] library provides read/write serialization for [django-gm2m][django-gm2m-field].\n\n[cite]: http://users.ece.utexas.edu/~adnan/pike.html\n[reverse-relationships]: https://docs.djangoproject.com/en/stable/topics/db/queries/#following-relationships-backward\n[routers]: https://www.django-rest-framework.org/api-guide/routers#defaultrouter\n[generic-relations]: https://docs.djangoproject.com/en/stable/ref/contrib/contenttypes/#id1\n[drf-nested-routers]: https://github.com/alanjds/drf-nested-routers\n[drf-nested-relations]: https://github.com/Ian-Foote/rest-framework-generic-relations\n[drf-gm2m-relations]: https://github.com/mojtabaakbari221b/rest-framework-gm2m-relations\n[django-gm2m-field]: https://github.com/tkhyn/django-gm2m\n[django-intermediary-manytomany]: https://docs.djangoproject.com/en/stable/topics/db/models/#intermediary-manytomany\n[dealing-with-nested-objects]: https://www.django-rest-framework.org/api-guide/serializers/#dealing-with-nested-objects\n[to_internal_value]: https://www.django-rest-framework.org/api-guide/serializers/#to_internal_valueself-data\n"
  },
  {
    "path": "docs/api-guide/renderers.md",
    "content": "---\nsource:\n    - renderers.py\n---\n\n# Renderers\n\n> Before a TemplateResponse instance can be returned to the client, it must be rendered. The rendering process takes the intermediate representation of template and context, and turns it into the final byte stream that can be served to the client.\n>\n> &mdash; [Django documentation][cite]\n\nREST framework includes a number of built in Renderer classes, that allow you to return responses with various media types.  There is also support for defining your own custom renderers, which gives you the flexibility to design your own media types.\n\n## How the renderer is determined\n\nThe set of valid renderers for a view is always defined as a list of classes.  When a view is entered REST framework will perform content negotiation on the incoming request, and determine the most appropriate renderer to satisfy the request.\n\nThe basic process of content negotiation involves examining the request's `Accept` header, to determine which media types it expects in the response.  Optionally, format suffixes on the URL may be used to explicitly request a particular representation.  For example the URL `http://example.com/api/users_count.json` might be an endpoint that always returns JSON data.\n\nFor more information see the documentation on [content negotiation][conneg].\n\n## Setting the renderers\n\nThe default set of renderers may be set globally, using the `DEFAULT_RENDERER_CLASSES` setting.  For example, the following settings would use `JSON` as the main media type and also include the self describing API.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_RENDERER_CLASSES': [\n            'rest_framework.renderers.JSONRenderer',\n            'rest_framework.renderers.BrowsableAPIRenderer',\n        ]\n    }\n\nYou can also set the renderers used for an individual view, or viewset,\nusing the `APIView` class-based views.\n\n    from django.contrib.auth.models import User\n    from rest_framework.renderers import JSONRenderer\n    from rest_framework.response import Response\n    from rest_framework.views import APIView\n\n    class UserCountView(APIView):\n        \"\"\"\n        A view that returns the count of active users in JSON.\n        \"\"\"\n        renderer_classes = [JSONRenderer]\n\n        def get(self, request, format=None):\n            user_count = User.objects.filter(active=True).count()\n            content = {'user_count': user_count}\n            return Response(content)\n\nOr, if you're using the `@api_view` decorator with function based views.\n\n    @api_view(['GET'])\n    @renderer_classes([JSONRenderer])\n    def user_count_view(request, format=None):\n        \"\"\"\n        A view that returns the count of active users in JSON.\n        \"\"\"\n        user_count = User.objects.filter(active=True).count()\n        content = {'user_count': user_count}\n        return Response(content)\n\n## Ordering of renderer classes\n\nIt's important when specifying the renderer classes for your API to think about what priority you want to assign to each media type.  If a client underspecifies the representations it can accept, such as sending an `Accept: */*` header, or not including an `Accept` header at all, then REST framework will select the first renderer in the list to use for the response.\n\nFor example if your API serves JSON responses and the HTML browsable API, you might want to make `JSONRenderer` your default renderer, in order to send `JSON` responses to clients that do not specify an `Accept` header.\n\nIf your API includes views that can serve both regular webpages and API responses depending on the request, then you might consider making `TemplateHTMLRenderer` your default renderer, in order to play nicely with older browsers that send [broken accept headers][browser-accept-headers].\n\n---\n\n## API Reference\n\n### JSONRenderer\n\nRenders the request data into `JSON`, using utf-8 encoding.\n\nNote that the default style is to include unicode characters, and render the response using a compact style with no unnecessary whitespace:\n\n    {\"unicode black star\":\"★\",\"value\":999}\n\nThe client may additionally include an `'indent'` media type parameter, in which case the returned `JSON` will be indented.  For example `Accept: application/json; indent=4`.\n\n    {\n        \"unicode black star\": \"★\",\n        \"value\": 999\n    }\n\nThe default JSON encoding style can be altered using the `UNICODE_JSON` and `COMPACT_JSON` settings keys.\n\n**.media_type**: `application/json`\n\n**.format**: `'json'`\n\n**.charset**: `None`\n\n### TemplateHTMLRenderer\n\nRenders data to HTML, using Django's standard template rendering.\nUnlike other renderers, the data passed to the `Response` does not need to be serialized.  Also, unlike other renderers, you may want to include a `template_name` argument when creating the `Response`.\n\nThe TemplateHTMLRenderer will create a `RequestContext`, using the `response.data` as the context dict, and determine a template name to use to render the context.\n\n!!! note\n    When used with a view that makes use of a serializer the `Response` sent for rendering may not be a dictionary and will need to be wrapped in a dict before returning to allow the `TemplateHTMLRenderer` to render it. For example:\n\n        response.data = {'results': response.data}\n\nThe template name is determined by (in order of preference):\n\n1. An explicit `template_name` argument passed to the response.\n2. An explicit `.template_name` attribute set on this class.\n3. The return result of calling `view.get_template_names()`.\n\nAn example of a view that uses `TemplateHTMLRenderer`:\n\n    class UserDetail(generics.RetrieveAPIView):\n        \"\"\"\n        A view that returns a templated HTML representation of a given user.\n        \"\"\"\n        queryset = User.objects.all()\n        renderer_classes = [TemplateHTMLRenderer]\n\n        def get(self, request, *args, **kwargs):\n            self.object = self.get_object()\n            return Response({'user': self.object}, template_name='user_detail.html')\n\nYou can use `TemplateHTMLRenderer` either to return regular HTML pages using REST framework, or to return both HTML and API responses from a single endpoint.\n\nIf you're building websites that use `TemplateHTMLRenderer` along with other renderer classes, you should consider listing `TemplateHTMLRenderer` as the first class in the `renderer_classes` list, so that it will be prioritized first even for browsers that send poorly formed `ACCEPT:` headers.\n\nSee the [_HTML & Forms_ Topic Page][html-and-forms] for further examples of `TemplateHTMLRenderer` usage.\n\n**.media_type**: `text/html`\n\n**.format**: `'html'`\n\n**.charset**: `utf-8`\n\nSee also: `StaticHTMLRenderer`\n\n### StaticHTMLRenderer\n\nA simple renderer that simply returns pre-rendered HTML.  Unlike other renderers, the data passed to the response object should be a string representing the content to be returned.\n\nAn example of a view that uses `StaticHTMLRenderer`:\n\n    @api_view(['GET'])\n    @renderer_classes([StaticHTMLRenderer])\n    def simple_html_view(request):\n        data = '<html><body><h1>Hello, world</h1></body></html>'\n        return Response(data)\n\nYou can use `StaticHTMLRenderer` either to return regular HTML pages using REST framework, or to return both HTML and API responses from a single endpoint.\n\n**.media_type**: `text/html`\n\n**.format**: `'html'`\n\n**.charset**: `utf-8`\n\nSee also: `TemplateHTMLRenderer`\n\n### BrowsableAPIRenderer\n\nRenders data into HTML for the Browsable API:\n\n![The BrowsableAPIRenderer](../img/quickstart.png)\n\nThis renderer will determine which other renderer would have been given highest priority, and use that to display an API style response within the HTML page.\n\n**.media_type**: `text/html`\n\n**.format**: `'api'`\n\n**.charset**: `utf-8`\n\n**.template**: `'rest_framework/api.html'`\n\n#### Customizing BrowsableAPIRenderer\n\nBy default the response content will be rendered with the highest priority renderer apart from `BrowsableAPIRenderer`.  If you need to customize this behavior, for example to use HTML as the default return format, but use JSON in the browsable API, you can do so by overriding the `get_default_renderer()` method.  For example:\n\n    class CustomBrowsableAPIRenderer(BrowsableAPIRenderer):\n        def get_default_renderer(self, view):\n            return JSONRenderer()\n\n### AdminRenderer\n\nRenders data into HTML for an admin-like display:\n\n![The AdminRender view](../img/admin.png)\n\nThis renderer is suitable for CRUD-style web APIs that should also present a user-friendly interface for managing the data.\n\nNote that views that have nested or list serializers for their input won't work well with the `AdminRenderer`, as the HTML forms are unable to properly support them.\n\n!!! note\n    The `AdminRenderer` is only able to include links to detail pages when a properly configured `URL_FIELD_NAME` (`url` by default) attribute is present in the data. For `HyperlinkedModelSerializer` this will be the case, but for `ModelSerializer` or plain `Serializer` classes you'll need to make sure to include the field explicitly. \n\n    For example here we use models `get_absolute_url` method:\n\n        class AccountSerializer(serializers.ModelSerializer):\n            url = serializers.CharField(source='get_absolute_url', read_only=True)\n    \n            class Meta:\n                model = Account\n\n\n**.media_type**: `text/html`\n\n**.format**: `'admin'`\n\n**.charset**: `utf-8`\n\n**.template**: `'rest_framework/admin.html'`\n\n### HTMLFormRenderer\n\nRenders data returned by a serializer into an HTML form. The output of this renderer does not include the enclosing `<form>` tags, a hidden CSRF input or any submit buttons.\n\nThis renderer is not intended to be used directly, but can instead be used in templates by passing a serializer instance to the `render_form` template tag.\n\n    {% load rest_framework %}\n\n    <form action=\"/submit-report/\" method=\"post\">\n        {% csrf_token %}\n        {% render_form serializer %}\n        <input type=\"submit\" value=\"Save\" />\n    </form>\n\nFor more information see the [HTML & Forms][html-and-forms] documentation.\n\n**.media_type**: `text/html`\n\n**.format**: `'form'`\n\n**.charset**: `utf-8`\n\n**.template**: `'rest_framework/horizontal/form.html'`\n\n### MultiPartRenderer\n\nThis renderer is used for rendering HTML multipart form data.  **It is not suitable as a response renderer**, but is instead used for creating test requests, using REST framework's [test client and test request factory][testing].\n\n**.media_type**: `multipart/form-data; boundary=BoUnDaRyStRiNg`\n\n**.format**: `'multipart'`\n\n**.charset**: `utf-8`\n\n---\n\n## Custom renderers\n\nTo implement a custom renderer, you should override `BaseRenderer`, set the `.media_type` and `.format` properties, and implement the `.render(self, data, accepted_media_type=None, renderer_context=None)` method.\n\nThe method should return a bytestring, which will be used as the body of the HTTP response.\n\nThe arguments passed to the `.render()` method are:\n\n- `data`: the request data, as set by the `Response()` instantiation.\n\n- `accepted_media_type=None`: optional.  If provided, this is the accepted media type, as determined by the content negotiation stage. Depending on the client's `Accept:` header, this may be more specific than the renderer's `media_type` attribute, and may include media type parameters.  For example `\"application/json; nested=true\"`.\n\n- `renderer_context=None`: optional.  If provided, this is a dictionary of contextual information provided by the view. By default this will include the following keys: `view`, `request`, `response`, `args`, `kwargs`.\n\n### Example\n\nThe following is an example plaintext renderer that will return a response with the `data` parameter as the content of the response.\n\n    from django.utils.encoding import smart_str\n    from rest_framework import renderers\n\n\n    class PlainTextRenderer(renderers.BaseRenderer):\n        media_type = 'text/plain'\n        format = 'txt'\n\n        def render(self, data, accepted_media_type=None, renderer_context=None):\n            return smart_str(data, encoding=self.charset)\n\n### Setting the character set\n\nBy default renderer classes are assumed to be using the `UTF-8` encoding.  To use a different encoding, set the `charset` attribute on the renderer.\n\n    class PlainTextRenderer(renderers.BaseRenderer):\n        media_type = 'text/plain'\n        format = 'txt'\n        charset = 'iso-8859-1'\n\n        def render(self, data, accepted_media_type=None, renderer_context=None):\n            return data.encode(self.charset)\n\nNote that if a renderer class returns a unicode string, then the response content will be coerced into a bytestring by the `Response` class, with the `charset` attribute set on the renderer used to determine the encoding.\n\nIf the renderer returns a bytestring representing raw binary content, you should set a charset value of `None`, which will ensure the `Content-Type` header of the response will not have a `charset` value set.\n\nIn some cases you may also want to set the `render_style` attribute to `'binary'`.  Doing so will also ensure that the browsable API will not attempt to display the binary content as a string.\n\n    class JPEGRenderer(renderers.BaseRenderer):\n        media_type = 'image/jpeg'\n        format = 'jpg'\n        charset = None\n        render_style = 'binary'\n\n        def render(self, data, accepted_media_type=None, renderer_context=None):\n            return data\n\n---\n\n## Advanced renderer usage\n\nYou can do some pretty flexible things using REST framework's renderers.  Some examples...\n\n* Provide either flat or nested representations from the same endpoint, depending on the requested media type.\n* Serve both regular HTML webpages, and JSON based API responses from the same endpoints.\n* Specify multiple types of HTML representation for API clients to use.\n* Underspecify a renderer's media type, such as using `media_type = 'image/*'`, and use the `Accept` header to vary the encoding of the response.\n\n### Varying behavior by media type\n\nIn some cases you might want your view to use different serialization styles depending on the accepted media type.  If you need to do this you can access `request.accepted_renderer` to determine the negotiated renderer that will be used for the response.\n\nFor example:\n\n    @api_view(['GET'])\n    @renderer_classes([TemplateHTMLRenderer, JSONRenderer])\n    def list_users(request):\n        \"\"\"\n        A view that can return JSON or HTML representations\n        of the users in the system.\n        \"\"\"\n        queryset = Users.objects.filter(active=True)\n\n        if request.accepted_renderer.format == 'html':\n            # TemplateHTMLRenderer takes a context dict,\n            # and additionally requires a 'template_name'.\n            # It does not require serialization.\n            data = {'users': queryset}\n            return Response(data, template_name='list_users.html')\n\n        # JSONRenderer requires serialized data as normal.\n        serializer = UserSerializer(instance=queryset)\n        data = serializer.data\n        return Response(data)\n\n### Underspecifying the media type\n\nIn some cases you might want a renderer to serve a range of media types.\nIn this case you can underspecify the media types it should respond to, by using a `media_type` value such as `image/*`, or `*/*`.\n\nIf you underspecify the renderer's media type, you should make sure to specify the media type explicitly when you return the response, using the `content_type` attribute.  For example:\n\n    return Response(data, content_type='image/png')\n\n### Designing your media types\n\nFor the purposes of many Web APIs, simple `JSON` responses with hyperlinked relations may be sufficient.  If you want to fully embrace RESTful design and [HATEOAS] you'll need to consider the design and usage of your media types in more detail.\n\nIn [the words of Roy Fielding][quote], \"A REST API should spend almost all of its descriptive effort in defining the media type(s) used for representing resources and driving application state, or in defining extended relation names and/or hypertext-enabled mark-up for existing standard media types.\".\n\nFor good examples of custom media types, see GitHub's use of a custom [application/vnd.github+json] media type, and Mike Amundsen's IANA approved [application/vnd.collection+json] JSON-based hypermedia.\n\n### HTML error views\n\nTypically a renderer will behave the same regardless of if it's dealing with a regular response, or with a response caused by an exception being raised, such as an `Http404` or `PermissionDenied` exception, or a subclass of `APIException`.\n\nIf you're using either the `TemplateHTMLRenderer` or the `StaticHTMLRenderer` and an exception is raised, the behavior is slightly different, and mirrors [Django's default handling of error views][django-error-views].\n\nExceptions raised and handled by an HTML renderer will attempt to render using one of the following methods, by order of precedence.\n\n* Load and render a template named `{status_code}.html`.\n* Load and render a template named `api_exception.html`.\n* Render the HTTP status code and text, for example \"404 Not Found\".\n\nTemplates will render with a `RequestContext` which includes the `status_code` and `details` keys.\n\n!!! note\n    If `DEBUG=True`, Django's standard traceback error page will be displayed instead of rendering the HTTP status code and text.\n\n## Third party packages\n\nThe following third party packages are also available.\n\n### YAML\n\n[REST framework YAML][rest-framework-yaml] provides [YAML][yaml] parsing and rendering support. It was previously included directly in the REST framework package, and is now instead supported as a third-party package.\n\n#### Installation & configuration\n\nInstall using pip.\n\n    $ pip install djangorestframework-yaml\n\nModify your REST framework settings.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PARSER_CLASSES': [\n            'rest_framework_yaml.parsers.YAMLParser',\n        ],\n        'DEFAULT_RENDERER_CLASSES': [\n            'rest_framework_yaml.renderers.YAMLRenderer',\n        ],\n    }\n\n### XML\n\n[REST Framework XML][rest-framework-xml] provides a simple informal XML format. It was previously included directly in the REST framework package, and is now instead supported as a third-party package.\n\n#### Installation & configuration\n\nInstall using pip.\n\n    $ pip install djangorestframework-xml\n\nModify your REST framework settings.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_PARSER_CLASSES': [\n            'rest_framework_xml.parsers.XMLParser',\n        ],\n        'DEFAULT_RENDERER_CLASSES': [\n            'rest_framework_xml.renderers.XMLRenderer',\n        ],\n    }\n\n### JSONP\n\n[REST framework JSONP][rest-framework-jsonp] provides JSONP rendering support. It was previously included directly in the REST framework package, and is now instead supported as a third-party package.\n\n!!! warning\n    If you require cross-domain AJAX requests, you should generally be using the more modern approach of [CORS][cors] as an alternative to `JSONP`. See the [CORS documentation][cors-docs] for more details.\n\n    The `jsonp` approach is essentially a browser hack, and is [only appropriate for globally readable API endpoints][jsonp-security], where `GET` requests are unauthenticated and do not require any user permissions.\n\n#### Installation & configuration\n\nInstall using pip.\n\n    $ pip install djangorestframework-jsonp\n\nModify your REST framework settings.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_RENDERER_CLASSES': [\n            'rest_framework_jsonp.renderers.JSONPRenderer',\n        ],\n    }\n\n### MessagePack\n\n[MessagePack][messagepack] is a fast, efficient binary serialization format.  [Juan Riaza][juanriaza] maintains the [djangorestframework-msgpack][djangorestframework-msgpack] package which provides MessagePack renderer and parser support for REST framework.\n\n### Microsoft Excel: XLSX (Binary Spreadsheet Endpoints)\n\nXLSX is the world's most popular binary spreadsheet format. [Tim Allen][flipperpa] of [The Wharton School][wharton] maintains [drf-excel][drf-excel], which renders an endpoint as an XLSX spreadsheet using OpenPyXL, and allows the client to download it. Spreadsheets can be styled on a per-view basis.\n\n#### Installation & configuration\n\nInstall using pip.\n\n    $ pip install drf-excel\n\nModify your REST framework settings.\n\n    REST_FRAMEWORK = {\n        ...\n\n        'DEFAULT_RENDERER_CLASSES': [\n            'rest_framework.renderers.JSONRenderer',\n            'rest_framework.renderers.BrowsableAPIRenderer',\n            'drf_excel.renderers.XLSXRenderer',\n        ],\n    }\n\nTo avoid having a file streamed without a filename (which the browser will often default to the filename \"download\", with no extension), we need to use a mixin to override the `Content-Disposition` header. If no filename is provided, it will default to `export.xlsx`. For example:\n\n    from rest_framework.viewsets import ReadOnlyModelViewSet\n    from drf_excel.mixins import XLSXFileMixin\n    from drf_excel.renderers import XLSXRenderer\n\n    from .models import MyExampleModel\n    from .serializers import MyExampleSerializer\n\n    class MyExampleViewSet(XLSXFileMixin, ReadOnlyModelViewSet):\n        queryset = MyExampleModel.objects.all()\n        serializer_class = MyExampleSerializer\n        renderer_classes = [XLSXRenderer]\n        filename = 'my_export.xlsx'\n\n### CSV\n\nComma-separated values are a plain-text tabular data format, that can be easily imported into spreadsheet applications. [Mjumbe Poe][mjumbewu] maintains the [djangorestframework-csv][djangorestframework-csv] package which provides CSV renderer support for REST framework.\n\n### UltraJSON\n\n[UltraJSON][ultrajson] is an optimized C JSON encoder which can give significantly faster JSON rendering. [Adam Mertz][Amertz08] maintains [drf_ujson2][drf_ujson2], a fork of the now unmaintained [drf-ujson-renderer][drf-ujson-renderer], which implements JSON rendering using the UJSON package.\n\n### CamelCase JSON\n\n[djangorestframework-camel-case] provides camel case JSON renderers and parsers for REST framework.  This allows serializers to use Python-style underscored field names, but be exposed in the API as Javascript-style camel case field names.  It is maintained by [Vitaly Babiy][vbabiy].\n\n### Pandas (CSV, Excel, PNG)\n\n[Django REST Pandas] provides a serializer and renderers that support additional data processing and output via the [Pandas] DataFrame API.  Django REST Pandas includes renderers for Pandas-style CSV files, Excel workbooks (both `.xls` and `.xlsx`), and a number of [other formats]. It is maintained by [S. Andrew Sheppard][sheppard] as part of the [wq Project][wq].\n\n### LaTeX\n\n[Rest Framework Latex] provides a renderer that outputs PDFs using Lualatex. It is maintained by [Pebble (S/F Software)][mypebble].\n\n\n[cite]: https://docs.djangoproject.com/en/stable/ref/template-response/#the-rendering-process\n[conneg]: content-negotiation.md\n[html-and-forms]: ../topics/html-and-forms.md\n[browser-accept-headers]: http://www.gethifi.com/blog/browser-rest-http-accept-headers\n[testing]: testing.md\n[HATEOAS]: http://timelessrepo.com/haters-gonna-hateoas\n[quote]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven\n[application/vnd.github+json]: https://developer.github.com/v3/media/\n[application/vnd.collection+json]: http://www.amundsen.com/media-types/collection/\n[django-error-views]: https://docs.djangoproject.com/en/stable/topics/http/views/#customizing-error-views\n[rest-framework-jsonp]: https://jpadilla.github.io/django-rest-framework-jsonp/\n[cors]: https://www.w3.org/TR/cors/\n[cors-docs]: https://www.django-rest-framework.org/topics/ajax-csrf-cors/\n[jsonp-security]: https://stackoverflow.com/questions/613962/is-jsonp-safe-to-use\n[rest-framework-yaml]: https://jpadilla.github.io/django-rest-framework-yaml/\n[rest-framework-xml]: https://jpadilla.github.io/django-rest-framework-xml/\n[messagepack]: https://msgpack.org/\n[juanriaza]: https://github.com/juanriaza\n[mjumbewu]: https://github.com/mjumbewu\n[flipperpa]: https://github.com/flipperpa\n[wharton]: https://github.com/wharton\n[drf-excel]: https://github.com/wharton/drf-excel\n[vbabiy]: https://github.com/vbabiy\n[rest-framework-yaml]: https://jpadilla.github.io/django-rest-framework-yaml/\n[rest-framework-xml]: https://jpadilla.github.io/django-rest-framework-xml/\n[yaml]: http://www.yaml.org/\n[djangorestframework-msgpack]: https://github.com/juanriaza/django-rest-framework-msgpack\n[djangorestframework-csv]: https://github.com/mjumbewu/django-rest-framework-csv\n[ultrajson]: https://github.com/esnme/ultrajson\n[Amertz08]: https://github.com/Amertz08\n[drf-ujson-renderer]: https://github.com/gizmag/drf-ujson-renderer\n[drf_ujson2]: https://github.com/Amertz08/drf_ujson2\n[djangorestframework-camel-case]: https://github.com/vbabiy/djangorestframework-camel-case\n[Django REST Pandas]: https://github.com/wq/django-rest-pandas\n[Pandas]: https://pandas.pydata.org/\n[other formats]: https://github.com/wq/django-rest-pandas#supported-formats\n[sheppard]: https://github.com/sheppard\n[wq]: https://github.com/wq\n[mypebble]: https://github.com/mypebble\n[Rest Framework Latex]: https://github.com/mypebble/rest-framework-latex\n"
  },
  {
    "path": "docs/api-guide/requests.md",
    "content": "---\nsource:\n    - request.py\n---\n\n> If you're doing REST-based web service stuff ... you should ignore request.POST.\n>\n> &mdash; Malcom Tredinnick, [Django developers group][cite]\n\nREST framework's `Request` class extends the standard `HttpRequest`, adding support for REST framework's flexible request parsing and request authentication.\n\n---\n\n## Request parsing\n\nREST framework's Request objects provide flexible request parsing that allows you to treat requests with JSON data or other media types in the same way that you would normally deal with form data.\n\n### .data\n\n`request.data` returns the parsed content of the request body.  This is similar to the standard `request.POST` and `request.FILES` attributes except that:\n\n* It includes all parsed content, including *file and non-file* inputs.\n* It supports parsing the content of HTTP methods other than `POST`, meaning that you can access the content of `PUT` and `PATCH` requests.\n* It supports REST framework's flexible request parsing, rather than just supporting form data.  For example you can handle incoming [JSON data] similarly to how you handle incoming [form data].\n\nFor more details see the [parsers documentation].\n\n### .query_params\n\n`request.query_params` is a more correctly named synonym for `request.GET`.\n\nFor clarity inside your code, we recommend using `request.query_params` instead of the Django's standard `request.GET`. Doing so will help keep your codebase more correct and obvious - any HTTP method type may include query parameters, not just `GET` requests.\n\n### .parsers\n\nThe `APIView` class or `@api_view` decorator will ensure that this property is automatically set to a list of `Parser` instances, based on the `parser_classes` set on the view or based on the `DEFAULT_PARSER_CLASSES` setting.\n\nYou won't typically need to access this property.\n\n!!! note\n    If a client sends malformed content, then accessing `request.data` may raise a `ParseError`.  By default REST framework's `APIView` class or `@api_view` decorator will catch the error and return a `400 Bad Request` response.\n\n    If a client sends a request with a content-type that cannot be parsed then a `UnsupportedMediaType` exception will be raised, which by default will be caught and return a `415 Unsupported Media Type` response.\n\n## Content negotiation\n\nThe request exposes some properties that allow you to determine the result of the content negotiation stage. This allows you to implement behavior such as selecting a different serialization schemes for different media types.\n\n### .accepted_renderer\n\nThe renderer instance that was selected by the content negotiation stage.\n\n### .accepted_media_type\n\nA string representing the media type that was accepted by the content negotiation stage.\n\n---\n\n## Authentication\n\nREST framework provides flexible, per-request authentication, that gives you the ability to:\n\n* Use different authentication policies for different parts of your API.\n* Support the use of multiple authentication policies.\n* Provide both user and token information associated with the incoming request.\n\n### .user\n\n`request.user` typically returns an instance of `django.contrib.auth.models.User`, although the behavior depends on the authentication policy being used.\n\nIf the request is unauthenticated the default value of `request.user` is an instance of `django.contrib.auth.models.AnonymousUser`.\n\nFor more details see the [authentication documentation].\n\n### .auth\n\n`request.auth` returns any additional authentication context.  The exact behavior of `request.auth` depends on the authentication policy being used, but it may typically be an instance of the token that the request was authenticated against.\n\nIf the request is unauthenticated, or if no additional context is present, the default value of `request.auth` is `None`.\n\nFor more details see the [authentication documentation].\n\n### .authenticators\n\nThe `APIView` class or `@api_view` decorator will ensure that this property is automatically set to a list of `Authentication` instances, based on the `authentication_classes` set on the view or based on the `DEFAULT_AUTHENTICATORS` setting.\n\nYou won't typically need to access this property.\n\n!!! note\n    You may see a `WrappedAttributeError` raised when calling the `.user` or `.auth` properties. These errors originate from an authenticator as a standard `AttributeError`, however it's necessary that they be re-raised as a different exception type in order to prevent them from being suppressed by the outer property access. Python will not recognize that the `AttributeError` originates from the authenticator and will instead assume that the request object does not have a `.user` or `.auth` property. The authenticator will need to be fixed.\n\n## Browser enhancements\n\nREST framework supports a few browser enhancements such as browser-based `PUT`, `PATCH` and `DELETE` forms.\n\n### .method\n\n`request.method` returns the **uppercased** string representation of the request's HTTP method.\n\nBrowser-based `PUT`, `PATCH` and `DELETE` forms are transparently supported.\n\nFor more information see the [browser enhancements documentation].\n\n### .content_type\n\n`request.content_type`, returns a string object representing the media type of the HTTP request's body, or an empty string if no media type was provided.\n\nYou won't typically need to directly access the request's content type, as you'll normally rely on REST framework's default request parsing behavior.\n\nIf you do need to access the content type of the request you should use the `.content_type` property in preference to using `request.META.get('HTTP_CONTENT_TYPE')`, as it provides transparent support for browser-based non-form content.\n\nFor more information see the [browser enhancements documentation].\n\n### .stream\n\n`request.stream` returns a stream representing the content of the request body.\n\nYou won't typically need to directly access the request's content, as you'll normally rely on REST framework's default request parsing behavior.\n\n---\n\n## Standard HttpRequest attributes\n\nAs REST framework's `Request` extends Django's `HttpRequest`, all the other standard attributes and methods are also available.  For example the `request.META` and `request.session` dictionaries are available as normal.\n\nNote that due to implementation reasons the `Request` class does not inherit from `HttpRequest` class, but instead extends the class using composition.\n\n\n[cite]: https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion\n[parsers documentation]: parsers.md\n[JSON data]: parsers.md#jsonparser\n[form data]: parsers.md#formparser\n[authentication documentation]: authentication.md\n[browser enhancements documentation]: ../topics/browser-enhancements.md\n"
  },
  {
    "path": "docs/api-guide/responses.md",
    "content": "---\nsource:\n    - response.py\n---\n\n# Responses\n\n> Unlike basic HttpResponse objects, TemplateResponse objects retain the details of the context that was provided by the view to compute the response.  The final output of the response is not computed until it is needed, later in the response process.\n>\n> &mdash; [Django documentation][cite]\n\nREST framework supports HTTP content negotiation by providing a `Response` class which allows you to return content that can be rendered into multiple content types, depending on the client request.\n\nThe `Response` class subclasses Django's `SimpleTemplateResponse`.  `Response` objects are initialized with data, which should consist of native Python primitives.  REST framework then uses standard HTTP content negotiation to determine how it should render the final response content.\n\nThere's no requirement for you to use the `Response` class, you can also return regular `HttpResponse` or `StreamingHttpResponse` objects from your views if required.  Using the `Response` class simply provides a nicer interface for returning content-negotiated Web API responses, that can be rendered to multiple formats.\n\nUnless you want to heavily customize REST framework for some reason, you should always use an `APIView` class or `@api_view` function for views that return `Response` objects.  Doing so ensures that the view can perform content negotiation and select the appropriate renderer for the response, before it is returned from the view.\n\n---\n\n## Creating responses\n\n### Response()\n\n**Signature:** `Response(data, status=None, template_name=None, headers=None, content_type=None)`\n\nUnlike regular `HttpResponse` objects, you do not instantiate `Response` objects with rendered content.  Instead you pass in unrendered data, which may consist of any Python primitives.\n\nThe renderers used by the `Response` class cannot natively handle complex datatypes such as Django model instances, so you need to serialize the data into primitive datatypes before creating the `Response` object.\n\nYou can use REST framework's `Serializer` classes to perform this data serialization, or use your own custom serialization.\n\nArguments:\n\n* `data`: The serialized data for the response.\n* `status`: A status code for the response.  Defaults to 200.  See also [status codes][statuscodes].\n* `template_name`: A template name to use if `HTMLRenderer` is selected.\n* `headers`: A dictionary of HTTP headers to use in the response.\n* `content_type`: The content type of the response.  Typically, this will be set automatically by the renderer as determined by content negotiation, but there may be some cases where you need to specify the content type explicitly.\n\n---\n\n## Attributes\n\n### .data\n\nThe unrendered, serialized data of the response.\n\n### .status_code\n\nThe numeric status code of the HTTP response.\n\n### .content\n\nThe rendered content of the response.  The `.render()` method must have been called before `.content` can be accessed.\n\n### .template_name\n\nThe `template_name`, if supplied.  Only required if `HTMLRenderer` or some other custom template renderer is the accepted renderer for the response.\n\n### .accepted_renderer\n\nThe renderer instance that will be used to render the response.\n\nSet automatically by the `APIView` or `@api_view` immediately before the response is returned from the view.\n\n### .accepted_media_type\n\nThe media type that was selected by the content negotiation stage.\n\nSet automatically by the `APIView` or `@api_view` immediately before the response is returned from the view.\n\n### .renderer_context\n\nA dictionary of additional context information that will be passed to the renderer's `.render()` method.\n\nSet automatically by the `APIView` or `@api_view` immediately before the response is returned from the view.\n\n---\n\n## Standard HttpResponse attributes\n\nThe `Response` class extends `SimpleTemplateResponse`, and all the usual attributes and methods are also available on the response.  For example you can set headers on the response in the standard way:\n\n    response = Response()\n    response['Cache-Control'] = 'no-cache'\n\n### .render()\n\n**Signature:** `.render()`\n\nAs with any other `TemplateResponse`, this method is called to render the serialized data of the response into the final response content.  When `.render()` is called, the response content will be set to the result of calling the `.render(data, accepted_media_type, renderer_context)` method on the `accepted_renderer` instance.\n\nYou won't typically need to call `.render()` yourself, as it's handled by Django's standard response cycle.\n\n[cite]: https://docs.djangoproject.com/en/stable/ref/template-response/\n[statuscodes]: status-codes.md\n"
  },
  {
    "path": "docs/api-guide/reverse.md",
    "content": "---\nsource:\n    - reverse.py\n---\n\n# Returning URLs\n\n> The central feature that distinguishes the REST architectural style from other network-based styles is its emphasis on a uniform interface between components.\n>\n> &mdash; Roy Fielding, [Architectural Styles and the Design of Network-based Software Architectures][cite]\n\nAs a rule, it's probably better practice to return absolute URIs from your Web APIs, such as `http://example.com/foobar`, rather than returning relative URIs, such as `/foobar`.\n\nThe advantages of doing so are:\n\n* It's more explicit.\n* It leaves less work for your API clients.\n* There's no ambiguity about the meaning of the string when it's found in representations such as JSON that do not have a native URI type.\n* It makes it easy to do things like markup HTML representations with hyperlinks.\n\nREST framework provides two utility functions to make it more simple to return absolute URIs from your Web API.\n\nThere's no requirement for you to use them, but if you do then the self-describing API will be able to automatically hyperlink its output for you, which makes browsing the API much easier.\n\n## reverse\n\n**Signature:** `reverse(viewname, *args, **kwargs)`\n\nHas the same behavior as [`django.urls.reverse`][reverse], except that it returns a fully qualified URL, using the request to determine the host and port.\n\nYou should **include the request as a keyword argument** to the function, for example:\n\n    from rest_framework.reverse import reverse\n    from rest_framework.views import APIView\n    from django.utils.timezone import now\n\n    class APIRootView(APIView):\n        def get(self, request):\n            year = now().year\n            data = {\n                ...\n                'year-summary-url': reverse('year-summary', args=[year], request=request)\n            }\n            return Response(data)\n\n## reverse_lazy\n\n**Signature:** `reverse_lazy(viewname, *args, **kwargs)`\n\nHas the same behavior as [`django.urls.reverse_lazy`][reverse-lazy], except that it returns a fully qualified URL, using the request to determine the host and port.\n\nAs with the `reverse` function, you should **include the request as a keyword argument** to the function, for example:\n\n    api_root = reverse_lazy('api-root', request=request)\n\n[cite]: https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_5\n[reverse]: https://docs.djangoproject.com/en/stable/ref/urlresolvers/#reverse\n[reverse-lazy]: https://docs.djangoproject.com/en/stable/ref/urlresolvers/#reverse-lazy\n"
  },
  {
    "path": "docs/api-guide/routers.md",
    "content": "---\nsource:\n    - routers.py\n---\n\n# Routers\n\n> Resource routing allows you to quickly declare all of the common routes for a given resourceful controller.  Instead of declaring separate routes for your index... a resourceful route declares them in a single line of code.\n>\n> &mdash; [Ruby on Rails Documentation][cite]\n\nSome Web frameworks such as Rails provide functionality for automatically determining how the URLs for an application should be mapped to the logic that deals with handling incoming requests.\n\nREST framework adds support for automatic URL routing to Django, and provides you with a simple, quick and consistent way of wiring your view logic to a set of URLs.\n\n## Usage\n\nHere's an example of a simple URL conf, that uses `SimpleRouter`.\n\n    from rest_framework import routers\n\n    router = routers.SimpleRouter()\n    router.register(r'users', UserViewSet)\n    router.register(r'accounts', AccountViewSet)\n    urlpatterns = router.urls\n\nThere are two mandatory arguments to the `register()` method:\n\n* `prefix` - The URL prefix to use for this set of routes.\n* `viewset` - The viewset class.\n\nOptionally, you may also specify an additional argument:\n\n* `basename` - The base to use for the URL names that are created.  If unset the basename will be automatically generated based on the `queryset` attribute of the viewset, if it has one.  Note that if the viewset does not include a `queryset` attribute then you must set `basename` when registering the viewset.\n\nThe example above would generate the following URL patterns:\n\n* URL pattern: `^users/$`  Name: `'user-list'`\n* URL pattern: `^users/{pk}/$`  Name: `'user-detail'`\n* URL pattern: `^accounts/$`  Name: `'account-list'`\n* URL pattern: `^accounts/{pk}/$`  Name: `'account-detail'`\n\n!!! note\n    The `basename` argument is used to specify the initial part of the view name pattern.  In the example above, that's the `user` or `account` part.\n\n    Typically you won't *need* to specify the `basename` argument, but if you have a viewset where you've defined a custom `get_queryset` method, then the viewset may not have a `.queryset` attribute set.  If you try to register that viewset you'll see an error like this:\n\n        'basename' argument not specified, and could not automatically determine the name from the viewset, as it does not have a '.queryset' attribute.\n\n    This means you'll need to explicitly set the `basename` argument when registering the viewset, as it could not be automatically determined from the model name.\n\n### Using `include` with routers\n\nThe `.urls` attribute on a router instance is simply a standard list of URL patterns. There are a number of different styles for how you can include these URLs.\n\nFor example, you can append `router.urls` to a list of existing views...\n\n    router = routers.SimpleRouter()\n    router.register(r'users', UserViewSet)\n    router.register(r'accounts', AccountViewSet)\n\n    urlpatterns = [\n        path('forgot-password/', ForgotPasswordFormView.as_view()),\n    ]\n\n    urlpatterns += router.urls\n\nAlternatively you can use Django's `include` function, like so...\n\n    urlpatterns = [\n        path('forgot-password', ForgotPasswordFormView.as_view()),\n        path('', include(router.urls)),\n    ]\n\nYou may use `include` with an application namespace:\n\n    urlpatterns = [\n        path('forgot-password/', ForgotPasswordFormView.as_view()),\n        path('api/', include((router.urls, 'app_name'))),\n    ]\n\nOr both an application and instance namespace:\n\n    urlpatterns = [\n        path('forgot-password/', ForgotPasswordFormView.as_view()),\n        path('api/', include((router.urls, 'app_name'), namespace='instance_name')),\n    ]\n\nSee Django's [URL namespaces docs][url-namespace-docs] and the [`include` API reference][include-api-reference] for more details.\n\n!!! note\n    If using namespacing with hyperlinked serializers you'll also need to ensure that any `view_name` parameters\n    on the serializers correctly reflect the namespace. In the examples above you'd need to include a parameter such as\n    `view_name='app_name:user-detail'` for serializer fields hyperlinked to the user detail view.\n    \n    The automatic `view_name` generation uses a pattern like `%(model_name)-detail`. Unless your models names actually clash\n    you may be better off **not** namespacing your Django REST Framework views when using hyperlinked serializers.\n\n### Routing for extra actions\n\nA viewset may [mark extra actions for routing][route-decorators] by decorating a method with the `@action` decorator. These extra actions will be included in the generated routes. For example, given the `set_password` method on the `UserViewSet` class:\n\n    from myapp.permissions import IsAdminOrIsSelf\n    from rest_framework.decorators import action\n\n    class UserViewSet(ModelViewSet):\n        ...\n\n        @action(methods=['post'], detail=True, permission_classes=[IsAdminOrIsSelf])\n        def set_password(self, request, pk=None):\n            ...\n\nThe following route would be generated:\n\n* URL pattern: `^users/{pk}/set_password/$`\n* URL name: `'user-set-password'`\n\nBy default, the URL pattern is based on the method name, and the URL name is the combination of the `ViewSet.basename` and the hyphenated method name.\nIf you don't want to use the defaults for either of these values, you can instead provide the `url_path` and `url_name` arguments to the `@action` decorator.\n\nFor example, if you want to change the URL for our custom action to `^users/{pk}/change-password/$`, you could write:\n\n    from myapp.permissions import IsAdminOrIsSelf\n    from rest_framework.decorators import action\n\n    class UserViewSet(ModelViewSet):\n        ...\n\n        @action(methods=['post'], detail=True, permission_classes=[IsAdminOrIsSelf],\n                url_path='change-password', url_name='change_password')\n        def set_password(self, request, pk=None):\n            ...\n\nThe above example would now generate the following URL pattern:\n\n* URL path: `^users/{pk}/change-password/$`\n* URL name: `'user-change_password'`\n\n### Using Django `path()` with routers\n\nBy default, the URLs created by routers use regular expressions. This behavior can be modified by setting the `use_regex_path` argument to `False` when instantiating the router, in this case [path converters][path-converters-topic-reference] are used. For example:\n\n    router = SimpleRouter(use_regex_path=False)\n\nThe router will match lookup values containing any characters except slashes and period characters.  For a more restrictive (or lenient) lookup pattern, set the `lookup_value_regex` attribute on the viewset or `lookup_value_converter` if using path converters.  For example, you can limit the lookup to valid UUIDs:\n\n    class MyModelViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet):\n        lookup_field = 'my_model_id'\n        lookup_value_regex = '[0-9a-f]{32}'\n\n    class MyPathModelViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet):\n        lookup_field = 'my_model_uuid'\n        lookup_value_converter = 'uuid'\n\nNote that path converters will be used on all URLs registered in the router, including viewset actions.\n\n## API Guide\n\n### SimpleRouter\n\nThis router includes routes for the standard set of `list`, `create`, `retrieve`, `update`, `partial_update` and `destroy` actions.  The viewset can also mark additional methods to be routed, using the `@action` decorator.\n\n<table border=1>\n    <tr><th>URL Style</th><th>HTTP Method</th><th>Action</th><th>URL Name</th></tr>\n    <tr><td rowspan=2>{prefix}/</td><td>GET</td><td>list</td><td rowspan=2>{basename}-list</td></tr></tr>\n    <tr><td>POST</td><td>create</td></tr>\n    <tr><td>{prefix}/{url_path}/</td><td>GET, or as specified by `methods` argument</td><td>`@action(detail=False)` decorated method</td><td>{basename}-{url_name}</td></tr>\n    <tr><td rowspan=4>{prefix}/{lookup}/</td><td>GET</td><td>retrieve</td><td rowspan=4>{basename}-detail</td></tr></tr>\n    <tr><td>PUT</td><td>update</td></tr>\n    <tr><td>PATCH</td><td>partial_update</td></tr>\n    <tr><td>DELETE</td><td>destroy</td></tr>\n    <tr><td>{prefix}/{lookup}/{url_path}/</td><td>GET, or as specified by `methods` argument</td><td>`@action(detail=True)` decorated method</td><td>{basename}-{url_name}</td></tr>\n</table>\n\nBy default, the URLs created by `SimpleRouter` are appended with a trailing slash.\nThis behavior can be modified by setting the `trailing_slash` argument to `False` when instantiating the router.  For example:\n\n    router = SimpleRouter(trailing_slash=False)\n\nTrailing slashes are conventional in Django, but are not used by default in some other frameworks such as Rails.  Which style you choose to use is largely a matter of preference, although some javascript frameworks may expect a particular routing style.\n\n### DefaultRouter\n\nThis router is similar to `SimpleRouter` as above, but additionally includes a default API root view, that returns a response containing hyperlinks to all the list views.  It also generates routes for optional `.json` style format suffixes.\n\n<table border=1>\n    <tr><th>URL Style</th><th>HTTP Method</th><th>Action</th><th>URL Name</th></tr>\n    <tr><td>[.format]</td><td>GET</td><td>automatically generated root view</td><td>api-root</td></tr></tr>\n    <tr><td rowspan=2>{prefix}/[.format]</td><td>GET</td><td>list</td><td rowspan=2>{basename}-list</td></tr></tr>\n    <tr><td>POST</td><td>create</td></tr>\n    <tr><td>{prefix}/{url_path}/[.format]</td><td>GET, or as specified by `methods` argument</td><td>`@action(detail=False)` decorated method</td><td>{basename}-{url_name}</td></tr>\n    <tr><td rowspan=4>{prefix}/{lookup}/[.format]</td><td>GET</td><td>retrieve</td><td rowspan=4>{basename}-detail</td></tr></tr>\n    <tr><td>PUT</td><td>update</td></tr>\n    <tr><td>PATCH</td><td>partial_update</td></tr>\n    <tr><td>DELETE</td><td>destroy</td></tr>\n    <tr><td>{prefix}/{lookup}/{url_path}/[.format]</td><td>GET, or as specified by `methods` argument</td><td>`@action(detail=True)` decorated method</td><td>{basename}-{url_name}</td></tr>\n</table>\n\nAs with `SimpleRouter` the trailing slashes on the URL routes can be removed by setting the `trailing_slash` argument to `False` when instantiating the router.\n\n    router = DefaultRouter(trailing_slash=False)\n\n## Custom Routers\n\nImplementing a custom router isn't something you'd need to do very often, but it can be useful if you have specific requirements about how the URLs for your API are structured.  Doing so allows you to encapsulate the URL structure in a reusable way that ensures you don't have to write your URL patterns explicitly for each new view.\n\nThe simplest way to implement a custom router is to subclass one of the existing router classes.  The `.routes` attribute is used to template the URL patterns that will be mapped to each viewset. The `.routes` attribute is a list of `Route` named tuples.\n\nThe arguments to the `Route` named tuple are:\n\n**url**: A string representing the URL to be routed.  May include the following format strings:\n\n* `{prefix}` - The URL prefix to use for this set of routes.\n* `{lookup}` - The lookup field used to match against a single instance.\n* `{trailing_slash}` - Either a '/' or an empty string, depending on the `trailing_slash` argument.\n\n**mapping**: A mapping of HTTP method names to the view methods\n\n**name**: The name of the URL as used in `reverse` calls. May include the following format string:\n\n* `{basename}` - The base to use for the URL names that are created.\n\n**initkwargs**: A dictionary of any additional arguments that should be passed when instantiating the view.  Note that the `detail`, `basename`, and `suffix` arguments are reserved for viewset introspection and are also used by the browsable API to generate the view name and breadcrumb links.\n\n### Customizing dynamic routes\n\nYou can also customize how the `@action` decorator is routed. Include the `DynamicRoute` named tuple in the `.routes` list, setting the `detail` argument as appropriate for the list-based and detail-based routes. In addition to `detail`, the arguments to `DynamicRoute` are:\n\n**url**: A string representing the URL to be routed. May include the same format strings as `Route`, and additionally accepts the `{url_path}` format string.\n\n**name**: The name of the URL as used in `reverse` calls. May include the following format strings:\n\n* `{basename}` - The base to use for the URL names that are created.\n* `{url_name}` - The `url_name` provided to the `@action`.\n\n**initkwargs**: A dictionary of any additional arguments that should be passed when instantiating the view.\n\n### Example\n\nThe following example will only route to the `list` and `retrieve` actions, and does not use the trailing slash convention.\n\n    from rest_framework.routers import Route, DynamicRoute, SimpleRouter\n\n    class CustomReadOnlyRouter(SimpleRouter):\n        \"\"\"\n        A router for read-only APIs, which doesn't use trailing slashes.\n        \"\"\"\n        routes = [\n            Route(\n                url=r'^{prefix}$',\n                mapping={'get': 'list'},\n                name='{basename}-list',\n                detail=False,\n                initkwargs={'suffix': 'List'}\n            ),\n            Route(\n                url=r'^{prefix}/{lookup}$',\n                mapping={'get': 'retrieve'},\n                name='{basename}-detail',\n                detail=True,\n                initkwargs={'suffix': 'Detail'}\n            ),\n            DynamicRoute(\n                url=r'^{prefix}/{lookup}/{url_path}$',\n                name='{basename}-{url_name}',\n                detail=True,\n                initkwargs={}\n            )\n        ]\n\nLet's take a look at the routes our `CustomReadOnlyRouter` would generate for a simple viewset.\n\n`views.py`:\n\n    class UserViewSet(viewsets.ReadOnlyModelViewSet):\n        \"\"\"\n        A viewset that provides the standard actions\n        \"\"\"\n        queryset = User.objects.all()\n        serializer_class = UserSerializer\n        lookup_field = 'username'\n\n        @action(detail=True)\n        def group_names(self, request, pk=None):\n            \"\"\"\n            Returns a list of all the group names that the given\n            user belongs to.\n            \"\"\"\n            user = self.get_object()\n            groups = user.groups.all()\n            return Response([group.name for group in groups])\n\n`urls.py`:\n\n    router = CustomReadOnlyRouter()\n    router.register('users', UserViewSet)\n    urlpatterns = router.urls\n\nThe following mappings would be generated...\n\n<table border=1>\n    <tr><th>URL</th><th>HTTP Method</th><th>Action</th><th>URL Name</th></tr>\n    <tr><td>/users</td><td>GET</td><td>list</td><td>user-list</td></tr>\n    <tr><td>/users/{username}</td><td>GET</td><td>retrieve</td><td>user-detail</td></tr>\n    <tr><td>/users/{username}/group_names</td><td>GET</td><td>group_names</td><td>user-group-names</td></tr>\n</table>\n\nFor another example of setting the `.routes` attribute, see the source code for the `SimpleRouter` class.\n\n### Advanced custom routers\n\nIf you want to provide totally custom behavior, you can override `BaseRouter` and override the `get_urls(self)` method.  The method should inspect the registered viewsets and return a list of URL patterns.  The registered prefix, viewset and basename tuples may be inspected by accessing the `self.registry` attribute.\n\nYou may also want to override the `get_default_basename(self, viewset)` method, or else always explicitly set the `basename` argument when registering your viewsets with the router.\n\n## Third Party Packages\n\nThe following third party packages are also available.\n\n### DRF Nested Routers\n\nThe [drf-nested-routers package][drf-nested-routers] provides routers and relationship fields for working with nested resources.\n\n### ModelRouter (wq.db.rest)\n\nThe [wq.db package][wq.db] provides an advanced [ModelRouter][wq.db-router] class (and singleton instance) that extends `DefaultRouter` with a `register_model()` API. Much like Django's `admin.site.register`, the only required argument to `rest.router.register_model` is a model class.  Reasonable defaults for a url prefix, serializer, and viewset will be inferred from the model and global configuration.\n\n    from wq.db import rest\n    from myapp.models import MyModel\n\n    rest.router.register_model(MyModel)\n\n### DRF-extensions\n\nThe [`DRF-extensions` package][drf-extensions] provides [routers][drf-extensions-routers] for creating [nested viewsets][drf-extensions-nested-viewsets], [collection level controllers][drf-extensions-collection-level-controllers] with [customizable endpoint names][drf-extensions-customizable-endpoint-names].\n\n[cite]: https://guides.rubyonrails.org/routing.html\n[route-decorators]: viewsets.md#marking-extra-actions-for-routing\n[drf-nested-routers]: https://github.com/alanjds/drf-nested-routers\n[wq.db]: https://wq.io/wq.db\n[wq.db-router]: https://wq.io/docs/router\n[drf-extensions]: https://chibisov.github.io/drf-extensions/docs/\n[drf-extensions-routers]: https://chibisov.github.io/drf-extensions/docs/#routers\n[drf-extensions-nested-viewsets]: https://chibisov.github.io/drf-extensions/docs/#nested-routes\n[drf-extensions-collection-level-controllers]: https://chibisov.github.io/drf-extensions/docs/#collection-level-controllers\n[drf-extensions-customizable-endpoint-names]: https://chibisov.github.io/drf-extensions/docs/#controller-endpoint-name\n[url-namespace-docs]: https://docs.djangoproject.com/en/stable/topics/http/urls/#url-namespaces\n[include-api-reference]: https://docs.djangoproject.com/en/stable/ref/urls/#include\n[path-converters-topic-reference]: https://docs.djangoproject.com/en/stable/topics/http/urls/#path-converters\n"
  },
  {
    "path": "docs/api-guide/schemas.md",
    "content": "---\nsource:\n    - schemas\n---\n\n# Schema\n\n> A machine-readable [schema] describes what resources are available via the API, what their URLs are, how they are represented and what operations they support.\n>\n> &mdash; Heroku, [JSON Schema for the Heroku Platform API][cite]\n\n---\n\n**Deprecation notice:**\n\nREST framework's built-in support for generating OpenAPI schemas is\n**deprecated** in favor of 3rd party packages that can provide this\nfunctionality instead. The built-in support will be moved into a separate\npackage and then subsequently retired over the next releases.\n\nAs a full-fledged replacement, we recommend the [drf-spectacular] package.\nIt has extensive support for generating OpenAPI 3 schemas from\nREST framework APIs, with both automatic and customizable options available.\nFor further information please refer to\n[Documenting your API](../topics/documenting-your-api.md#drf-spectacular).\n\n---\n\nAPI schemas are a useful tool that allow for a range of use cases, including\ngenerating reference documentation, or driving dynamic client libraries that\ncan interact with your API.\n\nDjango REST Framework provides support for automatic generation of\n[OpenAPI][openapi] schemas.\n\n## Overview\n\nSchema generation has several moving parts. It's worth having an overview:\n\n* `SchemaGenerator` is a top-level class that is responsible for walking your\n  configured URL patterns, finding `APIView` subclasses, enquiring for their\n  schema representation, and compiling the final schema object.\n* `AutoSchema` encapsulates all the details necessary for per-view schema\n  introspection. Is attached to each view via the `schema` attribute. You\n  subclass `AutoSchema` in order to customize your schema.\n* The `generateschema` management command allows you to generate a static schema\n  offline.\n* Alternatively, you can route `SchemaView` to dynamically generate and serve\n  your schema.\n* `settings.DEFAULT_SCHEMA_CLASS` allows you to specify an `AutoSchema`\n  subclass to serve as your project's default.\n\nThe following sections explain more.\n\n## Generating an OpenAPI Schema\n\n### Install dependencies\n\n    pip install pyyaml uritemplate inflection\n\n* `pyyaml` is used to generate schema into YAML-based OpenAPI format.\n* `uritemplate` is used internally to get parameters in path.\n* `inflection` is used to pluralize operations more appropriately in the list endpoints.\n\n### Generating a static schema with the `generateschema` management command\n\nIf your schema is static, you can use the `generateschema` management command:\n\n```bash\n./manage.py generateschema --file openapi-schema.yml\n```\n\nOnce you've generated a schema in this way you can annotate it with any\nadditional information that cannot be automatically inferred by the schema\ngenerator.\n\nYou might want to check your API schema into version control and update it\nwith each new release, or serve the API schema from your site's static media.\n\n### Generating a dynamic schema with `SchemaView`\n\nIf you require a dynamic schema, because foreign key choices depend on database\nvalues, for example, you can route a `SchemaView` that will generate and serve\nyour schema on demand.\n\nTo route a `SchemaView`, use the `get_schema_view()` helper.\n\nIn `urls.py`:\n\n```python\nfrom rest_framework.schemas import get_schema_view\n\nurlpatterns = [\n    # ...\n    # Use the `get_schema_view()` helper to add a `SchemaView` to project URLs.\n    #   * `title` and `description` parameters are passed to `SchemaGenerator`.\n    #   * Provide view name for use with `reverse()`.\n    path(\n        \"openapi\",\n        get_schema_view(\n            title=\"Your Project\", description=\"API for all things …\", version=\"1.0.0\"\n        ),\n        name=\"openapi-schema\",\n    ),\n    # ...\n]\n```\n\n#### `get_schema_view()`\n\nThe `get_schema_view()` helper takes the following keyword arguments:\n\n* `title`: May be used to provide a descriptive title for the schema definition.\n* `description`: Longer descriptive text.\n* `version`: The version of the API.\n* `url`: May be used to pass a canonical base URL for the schema.\n\n        schema_view = get_schema_view(\n            title='Server Monitoring API',\n            url='https://www.example.org/api/'\n        )\n\n* `urlconf`: A string representing the import path to the URL conf that you want\n   to generate an API schema for. This defaults to the value of Django's\n   `ROOT_URLCONF` setting.\n\n        schema_view = get_schema_view(\n            title='Server Monitoring API',\n            url='https://www.example.org/api/',\n            urlconf='myproject.urls'\n        )\n\n* `patterns`: List of url patterns to limit the schema introspection to. If you\n  only want the `myproject.api` urls to be exposed in the schema:\n\n        schema_url_patterns = [\n            path('api/', include('myproject.api.urls')),\n        ]\n\n        schema_view = get_schema_view(\n            title='Server Monitoring API',\n            url='https://www.example.org/api/',\n            patterns=schema_url_patterns,\n        )\n* `public`: May be used to specify if schema should bypass views permissions. Default to False\n\n* `generator_class`: May be used to specify a `SchemaGenerator` subclass to be\n  passed to the `SchemaView`.\n* `authentication_classes`: May be used to specify the list of authentication\n  classes that will apply to the schema endpoint. Defaults to\n  `settings.DEFAULT_AUTHENTICATION_CLASSES`\n* `permission_classes`: May be used to specify the list of permission classes\n  that will apply to the schema endpoint. Defaults to\n  `settings.DEFAULT_PERMISSION_CLASSES`.\n* `renderer_classes`: May be used to pass the set of renderer classes that can\n  be used to render the API root endpoint.\n\n\n## SchemaGenerator\n\n**Schema-level customization**\n\n```python\nfrom rest_framework.schemas.openapi import SchemaGenerator\n```\n\n`SchemaGenerator` is a class that walks a list of routed URL patterns, requests\nthe schema for each view and collates the resulting OpenAPI schema.\n\nTypically you won't need to instantiate `SchemaGenerator` yourself, but you can\ndo so like so:\n\n    generator = SchemaGenerator(title='Stock Prices API')\n\nArguments:\n\n* `title` **required**: The name of the API.\n* `description`: Longer descriptive text.\n* `version`: The version of the API. Defaults to `0.1.0`.\n* `url`: The root URL of the API schema. This option is not required unless the schema is included under path prefix.\n* `patterns`: A list of URLs to inspect when generating the schema. Defaults to the project's URL conf.\n* `urlconf`: A URL conf module name to use when generating the schema. Defaults to `settings.ROOT_URLCONF`.\n\nIn order to customize the top-level schema, subclass\n`rest_framework.schemas.openapi.SchemaGenerator` and provide your subclass\nas an argument to the `generateschema` command or `get_schema_view()` helper\nfunction.\n\n### get_schema(self, request=None, public=False)\n\nReturns a dictionary that represents the OpenAPI schema:\n\n    generator = SchemaGenerator(title='Stock Prices API')\n    schema = generator.get_schema()\n\nThe `request` argument is optional, and may be used if you want to apply\nper-user permissions to the resulting schema generation.\n\nThis is a good point to override if you want to customize the generated\ndictionary For example you might wish to add terms of service to the [top-level\n`info` object][info-object]:\n\n```\nclass TOSSchemaGenerator(SchemaGenerator):\n    def get_schema(self, *args, **kwargs):\n        schema = super().get_schema(*args, **kwargs)\n        schema[\"info\"][\"termsOfService\"] = \"https://example.com/tos.html\"\n        return schema\n```\n\n## AutoSchema\n\n**Per-View Customization**\n\n```python\nfrom rest_framework.schemas.openapi import AutoSchema\n```\n\nBy default, view introspection is performed by an `AutoSchema` instance\naccessible via the `schema` attribute on `APIView`.\n\n    auto_schema = some_view.schema\n\n`AutoSchema` provides the OpenAPI elements needed for each view, request method\nand path:\n\n* A list of [OpenAPI components][openapi-components]. In DRF terms these are\n  mappings of serializers that describe request and response bodies.\n* The appropriate [OpenAPI operation object][openapi-operation] that describes\n  the endpoint, including path and query parameters for pagination, filtering,\n  and so on.\n\n```python\ncomponents = auto_schema.get_components(...)\noperation = auto_schema.get_operation(...)\n```\n\nIn compiling the schema, `SchemaGenerator` calls `get_components()` and\n`get_operation()` for each view, allowed method, and path.\n\n!!! note\n    The automatic introspection of components, and many operation\n    parameters relies on the relevant attributes and methods of\n    `GenericAPIView`: `get_serializer()`, `pagination_class`, `filter_backends`,\n    etc. For basic `APIView` subclasses, default introspection is essentially limited to\n    the URL kwarg path parameters for this reason.\n\n`AutoSchema` encapsulates the view introspection needed for schema generation.\nBecause of this all the schema generation logic is kept in a single place,\nrather than being spread around the already extensive view, serializer and\nfield APIs.\n\nKeeping with this pattern, try not to let schema logic leak into your own\nviews, serializers, or fields when customizing the schema generation. You might\nbe tempted to do something like this:\n\n```python\nclass CustomSchema(AutoSchema):\n    \"\"\"\n    AutoSchema subclass using schema_extra_info on the view.\n    \"\"\"\n\n    ...\n\n\nclass CustomView(APIView):\n    schema = CustomSchema()\n    schema_extra_info = ...  # some extra info\n```\n\nHere, the `AutoSchema` subclass goes looking for `schema_extra_info` on the\nview. This is _OK_ (it doesn't actually hurt) but it means you'll end up with\nyour schema logic spread out in a number of different places.\n\nInstead try to subclass `AutoSchema` such that the `extra_info` doesn't leak\nout into the view:\n\n```python\nclass BaseSchema(AutoSchema):\n    \"\"\"\n    AutoSchema subclass that knows how to use extra_info.\n    \"\"\"\n\n    ...\n\n\nclass CustomSchema(BaseSchema):\n    extra_info = ...  # some extra info\n\n\nclass CustomView(APIView):\n    schema = CustomSchema()\n```\n\nThis style is slightly more verbose but maintains the encapsulation of the\nschema related code. It's more _cohesive_ in the _parlance_. It'll keep the\nrest of your API code more tidy.\n\nIf an option applies to many view classes, rather than creating a specific\nsubclass per-view, you may find it more convenient to allow specifying the\noption as an `__init__()` kwarg to your base `AutoSchema` subclass:\n\n```python\nclass CustomSchema(BaseSchema):\n    def __init__(self, **kwargs):\n        # store extra_info for later\n        self.extra_info = kwargs.pop(\"extra_info\")\n        super().__init__(**kwargs)\n\n\nclass CustomView(APIView):\n    schema = CustomSchema(extra_info=...)  # some extra info\n```\n\nThis saves you having to create a custom subclass per-view for a commonly used option.\n\nNot all `AutoSchema` methods expose related `__init__()` kwargs, but those for\nthe more commonly needed options do.\n\n### `AutoSchema` methods\n\n#### `get_components()`\n\nGenerates the OpenAPI components that describe request and response bodies,\nderiving their properties from the serializer.\n\nReturns a dictionary mapping the component name to the generated\nrepresentation. By default this has just a single pair but you may override\n`get_components()` to return multiple pairs if your view uses multiple\nserializers.\n\n#### `get_component_name()`\n\nComputes the component's name from the serializer.\n\nYou may see warnings if your API has duplicate component names. If so you can override `get_component_name()` or pass the `component_name` `__init__()` kwarg (see below) to provide different names.\n\n#### `get_reference()`\n\nReturns a reference to the serializer component. This may be useful if you override `get_schema()`.\n\n\n#### `map_serializer()`\n\nMaps serializers to their OpenAPI representations.\n\nMost serializers should conform to the standard OpenAPI `object` type, but you may\nwish to override `map_serializer()` in order to customize this or other\nserializer-level fields.\n\n#### `map_field()`\n\nMaps individual serializer fields to their schema representation. The base implementation\nwill handle the default fields that Django REST Framework provides.\n\nFor `SerializerMethodField` instances, for which the schema is unknown, or custom field subclasses you should override `map_field()` to generate the correct schema:\n\n```python\nclass CustomSchema(AutoSchema):\n    \"\"\"Extension of ``AutoSchema`` to add support for custom field schemas.\"\"\"\n\n    def map_field(self, field):\n        # Handle SerializerMethodFields or custom fields here...\n        # ...\n        return super().map_field(field)\n```\n\nAuthors of third-party packages should aim to provide an `AutoSchema` subclass,\nand a mixin, overriding `map_field()` so that users can easily generate schemas\nfor their custom fields.\n\n#### `get_tags()`\n\nOpenAPI groups operations by tags. By default tags taken from the first path\nsegment of the routed URL. For example, a URL like `/users/{id}/` will generate\nthe tag `users`.\n\nYou can pass an `__init__()` kwarg to manually specify tags (see below), or\noverride `get_tags()` to provide custom logic.\n\n#### `get_operation()`\n\nReturns the [OpenAPI operation object][openapi-operation] that describes the\nendpoint, including path and query parameters for pagination, filtering, and so\non.\n\nTogether with `get_components()`, this is the main entry point to the view\nintrospection.\n\n#### `get_operation_id()`\n\nThere must be a unique [operationid][openapi-operationid] for each operation.\nBy default the `operationId` is deduced from the model name, serializer name or\nview name. The operationId looks like \"listItems\", \"retrieveItem\",\n\"updateItem\", etc. The `operationId` is camelCase by convention.\n\n#### `get_operation_id_base()`\n\nIf you have several views with the same model name, you may see duplicate\noperationIds.\n\nIn order to work around this, you can override `get_operation_id_base()` to\nprovide a different base for name part of the ID.\n\n#### `get_serializer()`\n\nIf the view has implemented `get_serializer()`, returns the result.\n\n#### `get_request_serializer()`\n\nBy default returns `get_serializer()` but can be overridden to\ndifferentiate between request and response objects.\n\n#### `get_response_serializer()`\n\nBy default returns `get_serializer()` but can be overridden to\ndifferentiate between request and response objects.\n\n### `AutoSchema.__init__()` kwargs\n\n`AutoSchema` provides a number of `__init__()` kwargs that can be used for\ncommon customizations, if the default generated values are not appropriate.\n\nThe available kwargs are:\n\n* `tags`: Specify a list of tags.\n* `component_name`: Specify the component name.\n* `operation_id_base`: Specify the resource-name part of operation IDs.\n\nYou pass the kwargs when declaring the `AutoSchema` instance on your view:\n\n```\nclass PetDetailView(generics.RetrieveUpdateDestroyAPIView):\n    schema = AutoSchema(\n        tags=['Pets'],\n        component_name='Pet',\n        operation_id_base='Pet',\n    )\n    ...\n```\n\nAssuming a `Pet` model and `PetSerializer` serializer, the kwargs in this\nexample are probably not needed. Often, though, you'll need to pass the kwargs\nif you have multiple view targeting the same model, or have multiple views with\nidentically named serializers.\n\nIf your views have related customizations that are needed frequently, you can\ncreate a base `AutoSchema` subclass for your project that takes additional\n`__init__()` kwargs to save subclassing `AutoSchema` for each view.\n\n[cite]: https://www.heroku.com/blog/json_schema_for_heroku_platform_api/\n[openapi]: https://github.com/OAI/OpenAPI-Specification\n[openapi-specification-extensions]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#specification-extensions\n[openapi-operation]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#operationObject\n[openapi-tags]: https://swagger.io/specification/#tagObject\n[openapi-operationid]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#fixed-fields-17\n[openapi-components]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#componentsObject\n[openapi-reference]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#referenceObject\n[openapi-generator]: https://github.com/OpenAPITools/openapi-generator\n[swagger-codegen]: https://github.com/swagger-api/swagger-codegen\n[info-object]: https://swagger.io/specification/#infoObject\n[drf-spectacular]: https://drf-spectacular.readthedocs.io/en/latest/readme.html\n"
  },
  {
    "path": "docs/api-guide/serializers.md",
    "content": "---\nsource:\n    - serializers.py\n---\n\n> Expanding the usefulness of the serializers is something that we would\nlike to address.  However, it's not a trivial problem, and it\nwill take some serious design work.\n>\n> &mdash; Russell Keith-Magee, [Django users group][cite]\n\nSerializers allow complex data such as querysets and model instances to be converted to native Python datatypes that can then be easily rendered into `JSON`, `XML` or other content types.  Serializers also provide deserialization, allowing parsed data to be converted back into complex types, after first validating the incoming data.\n\nThe serializers in REST framework work very similarly to Django's `Form` and `ModelForm` classes. We provide a `Serializer` class which gives you a powerful, generic way to control the output of your responses, as well as a `ModelSerializer` class which provides a useful shortcut for creating serializers that deal with model instances and querysets.\n\n## Serializers\n\n### Declaring Serializers\n\nLet's start by creating a simple object we can use for example purposes:\n\n    from datetime import datetime\n\n    class Comment:\n        def __init__(self, email, content, created=None):\n            self.email = email\n            self.content = content\n            self.created = created or datetime.now()\n\n    comment = Comment(email='leila@example.com', content='foo bar')\n\nWe'll declare a serializer that we can use to serialize and deserialize data that corresponds to `Comment` objects.\n\nDeclaring a serializer looks very similar to declaring a form:\n\n    from rest_framework import serializers\n\n    class CommentSerializer(serializers.Serializer):\n        email = serializers.EmailField()\n        content = serializers.CharField(max_length=200)\n        created = serializers.DateTimeField()\n\n### Serializing objects\n\nWe can now use `CommentSerializer` to serialize a comment, or list of comments. Again, using the `Serializer` class looks a lot like using a `Form` class.\n\n    serializer = CommentSerializer(comment)\n    serializer.data\n    # {'email': 'leila@example.com', 'content': 'foo bar', 'created': '2016-01-27T15:17:10.375877'}\n\nAt this point we've translated the model instance into Python native datatypes.  To finalize the serialization process we render the data into `json`.\n\n    from rest_framework.renderers import JSONRenderer\n\n    json = JSONRenderer().render(serializer.data)\n    json\n    # b'{\"email\":\"leila@example.com\",\"content\":\"foo bar\",\"created\":\"2016-01-27T15:17:10.375877\"}'\n\n### Deserializing objects\n\nDeserialization is similar. First we parse a stream into Python native datatypes...\n\n    import io\n    from rest_framework.parsers import JSONParser\n\n    stream = io.BytesIO(json)\n    data = JSONParser().parse(stream)\n\n...then we restore those native datatypes into a dictionary of validated data.\n\n    serializer = CommentSerializer(data=data)\n    serializer.is_valid()\n    # True\n    serializer.validated_data\n    # {'content': 'foo bar', 'email': 'leila@example.com', 'created': datetime.datetime(2012, 08, 22, 16, 20, 09, 822243)}\n\n### Saving instances\n\nIf we want to be able to return complete object instances based on the validated data we need to implement one or both of the `.create()` and `.update()` methods. For example:\n\n    class CommentSerializer(serializers.Serializer):\n        email = serializers.EmailField()\n        content = serializers.CharField(max_length=200)\n        created = serializers.DateTimeField()\n\n        def create(self, validated_data):\n            return Comment(**validated_data)\n\n        def update(self, instance, validated_data):\n            instance.email = validated_data.get('email', instance.email)\n            instance.content = validated_data.get('content', instance.content)\n            instance.created = validated_data.get('created', instance.created)\n            return instance\n\nIf your object instances correspond to Django models you'll also want to ensure that these methods save the object to the database. For example, if `Comment` was a Django model, the methods might look like this:\n\n        def create(self, validated_data):\n            return Comment.objects.create(**validated_data)\n\n        def update(self, instance, validated_data):\n            instance.email = validated_data.get('email', instance.email)\n            instance.content = validated_data.get('content', instance.content)\n            instance.created = validated_data.get('created', instance.created)\n            instance.save()\n            return instance\n\nNow when deserializing data, we can call `.save()` to return an object instance, based on the validated data.\n\n    comment = serializer.save()\n\nCalling `.save()` will either create a new instance, or update an existing instance, depending on if an existing instance was passed when instantiating the serializer class:\n\n    # .save() will create a new instance.\n    serializer = CommentSerializer(data=data)\n\n    # .save() will update the existing `comment` instance.\n    serializer = CommentSerializer(comment, data=data)\n\nBoth the `.create()` and `.update()` methods are optional. You can implement either none, one, or both of them, depending on the use-case for your serializer class.\n\n#### Passing additional attributes to `.save()`\n\nSometimes you'll want your view code to be able to inject additional data at the point of saving the instance. This additional data might include information like the current user, the current time, or anything else that is not part of the request data.\n\nYou can do so by including additional keyword arguments when calling `.save()`. For example:\n\n    serializer.save(owner=request.user)\n\nAny additional keyword arguments will be included in the `validated_data` argument when `.create()` or `.update()` are called.\n\n#### Overriding `.save()` directly.\n\nIn some cases the `.create()` and `.update()` method names may not be meaningful. For example, in a contact form we may not be creating new instances, but instead sending an email or other message.\n\nIn these cases you might instead choose to override `.save()` directly, as being more readable and meaningful.\n\nFor example:\n\n    class ContactForm(serializers.Serializer):\n        email = serializers.EmailField()\n        message = serializers.CharField()\n\n        def save(self):\n            email = self.validated_data['email']\n            message = self.validated_data['message']\n            send_email(from=email, message=message)\n\nNote that in the case above we're now having to access the serializer `.validated_data` property directly.\n\n### Validation\n\nWhen deserializing data, you always need to call `is_valid()` before attempting to access the validated data, or save an object instance. If any validation errors occur, the `.errors` property will contain a dictionary representing the resulting error messages.  For example:\n\n    serializer = CommentSerializer(data={'email': 'foobar', 'content': 'baz'})\n    serializer.is_valid()\n    # False\n    serializer.errors\n    # {'email': ['Enter a valid email address.'], 'created': ['This field is required.']}\n\nEach key in the dictionary will be the field name, and the values will be lists of strings of any error messages corresponding to that field.  The `non_field_errors` key may also be present, and will list any general validation errors. The name of the `non_field_errors` key may be customized using the `NON_FIELD_ERRORS_KEY` REST framework setting.\n\nWhen deserializing a list of items, errors will be returned as a list of dictionaries representing each of the deserialized items.\n\n#### Raising an exception on invalid data\n\nThe `.is_valid()` method takes an optional `raise_exception` flag that will cause it to raise a `serializers.ValidationError` exception if there are validation errors.\n\nThese exceptions are automatically dealt with by the default exception handler that REST framework provides, and will return `HTTP 400 Bad Request` responses by default.\n\n    # Return a 400 response if the data was invalid.\n    serializer.is_valid(raise_exception=True)\n\n#### Field-level validation\n\nYou can specify custom field-level validation by adding `.validate_<field_name>` methods to your `Serializer` subclass.  These are similar to the `.clean_<field_name>` methods on Django forms.\n\nThese methods take a single argument, which is the field value that requires validation.\n\nYour `validate_<field_name>` methods should return the validated value or raise a `serializers.ValidationError`.  For example:\n\n    from rest_framework import serializers\n\n    class BlogPostSerializer(serializers.Serializer):\n        title = serializers.CharField(max_length=100)\n        content = serializers.CharField()\n\n        def validate_title(self, value):\n            \"\"\"\n            Check that the blog post is about Django.\n            \"\"\"\n            if 'django' not in value.lower():\n                raise serializers.ValidationError(\"Blog post is not about Django\")\n            return value\n\n!!! note\n    If your `<field_name>` is declared on your serializer with the parameter `required=False` then this validation step will not take place if the field is not included.\n\n#### Object-level validation\n\nTo do any other validation that requires access to multiple fields, add a method called `.validate()` to your `Serializer` subclass.  This method takes a single argument, which is a dictionary of field values.  It should raise a `serializers.ValidationError` if necessary, or just return the validated values.  For example:\n\n    from rest_framework import serializers\n\n    class EventSerializer(serializers.Serializer):\n        description = serializers.CharField(max_length=100)\n        start = serializers.DateTimeField()\n        finish = serializers.DateTimeField()\n\n        def validate(self, data):\n            \"\"\"\n            Check that start is before finish.\n            \"\"\"\n            if data['start'] > data['finish']:\n                raise serializers.ValidationError(\"finish must occur after start\")\n            return data\n\n#### Validators\n\nIndividual fields on a serializer can include validators, by declaring them on the field instance, for example:\n\n    def multiple_of_ten(value):\n        if value % 10 != 0:\n            raise serializers.ValidationError('Not a multiple of ten')\n\n    class GameRecord(serializers.Serializer):\n        score = serializers.IntegerField(validators=[multiple_of_ten])\n        ...\n\nSerializer classes can also include reusable validators that are applied to the complete set of field data. These validators are included by declaring them on an inner `Meta` class, like so:\n\n    class EventSerializer(serializers.Serializer):\n        name = serializers.CharField()\n        room_number = serializers.ChoiceField(choices=[101, 102, 103, 201])\n        date = serializers.DateField()\n\n        class Meta:\n            # Each room only has one event per day.\n            validators = [\n                UniqueTogetherValidator(\n                    queryset=Event.objects.all(),\n                    fields=['room_number', 'date']\n                )\n            ]\n\nFor more information see the [validators documentation](validators.md).\n\n### Accessing the initial data and instance\n\nWhen passing an initial object or queryset to a serializer instance, the object will be made available as `.instance`. If no initial object is passed then the `.instance` attribute will be `None`.\n\nWhen passing data to a serializer instance, the unmodified data will be made available as `.initial_data`. If the `data` keyword argument is not passed then the `.initial_data` attribute will not exist.\n\n### Partial updates\n\nBy default, serializers must be passed values for all required fields or they will raise validation errors. You can use the `partial` argument in order to allow partial updates.\n\n    # Update `comment` with partial data\n    serializer = CommentSerializer(comment, data={'content': 'foo bar'}, partial=True)\n\n### Dealing with nested objects\n\nThe previous examples are fine for dealing with objects that only have simple datatypes, but sometimes we also need to be able to represent more complex objects, where some of the attributes of an object might not be simple datatypes such as strings, dates or integers.\n\nThe `Serializer` class is itself a type of `Field`, and can be used to represent relationships where one object type is nested inside another.\n\n    class UserSerializer(serializers.Serializer):\n        email = serializers.EmailField()\n        username = serializers.CharField(max_length=100)\n\n    class CommentSerializer(serializers.Serializer):\n        user = UserSerializer()\n        content = serializers.CharField(max_length=200)\n        created = serializers.DateTimeField()\n\nIf a nested representation may optionally accept the `None` value you should pass the `required=False` flag to the nested serializer.\n\n    class CommentSerializer(serializers.Serializer):\n        user = UserSerializer(required=False)  # May be an anonymous user.\n        content = serializers.CharField(max_length=200)\n        created = serializers.DateTimeField()\n\nSimilarly if a nested representation should be a list of items, you should pass the `many=True` flag to the nested serializer.\n\n    class CommentSerializer(serializers.Serializer):\n        user = UserSerializer(required=False)\n        edits = EditItemSerializer(many=True)  # A nested list of 'edit' items.\n        content = serializers.CharField(max_length=200)\n        created = serializers.DateTimeField()\n\n### Writable nested representations\n\nWhen dealing with nested representations that support deserializing the data, any errors with nested objects will be nested under the field name of the nested object.\n\n    serializer = CommentSerializer(data={'user': {'email': 'foobar', 'username': 'doe'}, 'content': 'baz'})\n    serializer.is_valid()\n    # False\n    serializer.errors\n    # {'user': {'email': ['Enter a valid email address.']}, 'created': ['This field is required.']}\n\nSimilarly, the `.validated_data` property will include nested data structures.\n\n#### Writing `.create()` methods for nested representations\n\nIf you're supporting writable nested representations you'll need to write `.create()` or `.update()` methods that handle saving multiple objects.\n\nThe following example demonstrates how you might handle creating a user with a nested profile object.\n\n    class UserSerializer(serializers.ModelSerializer):\n        profile = ProfileSerializer()\n\n        class Meta:\n            model = User\n            fields = ['username', 'email', 'profile']\n\n        def create(self, validated_data):\n            profile_data = validated_data.pop('profile')\n            user = User.objects.create(**validated_data)\n            Profile.objects.create(user=user, **profile_data)\n            return user\n\n#### Writing `.update()` methods for nested representations\n\nFor updates you'll want to think carefully about how to handle updates to relationships. For example if the data for the relationship is `None`, or not provided, which of the following should occur?\n\n* Set the relationship to `NULL` in the database.\n* Delete the associated instance.\n* Ignore the data and leave the instance as it is.\n* Raise a validation error.\n\nHere's an example for an `.update()` method on our previous `UserSerializer` class.\n\n        def update(self, instance, validated_data):\n            profile_data = validated_data.pop('profile')\n            # Unless the application properly enforces that this field is\n            # always set, the following could raise a `DoesNotExist`, which\n            # would need to be handled.\n            profile = instance.profile\n\n            instance.username = validated_data.get('username', instance.username)\n            instance.email = validated_data.get('email', instance.email)\n            instance.save()\n\n            profile.is_premium_member = profile_data.get(\n                'is_premium_member',\n                profile.is_premium_member\n            )\n            profile.has_support_contract = profile_data.get(\n                'has_support_contract',\n                profile.has_support_contract\n             )\n            profile.save()\n\n            return instance\n\nBecause the behavior of nested creates and updates can be ambiguous, and may require complex dependencies between related models, REST framework 3 requires you to always write these methods explicitly. The default `ModelSerializer` `.create()` and `.update()` methods do not include support for writable nested representations.\n\nThere are however, third-party packages available such as [DRF Writable Nested][thirdparty-writable-nested] that support automatic writable nested representations.\n\n#### Handling saving related instances in model manager classes\n\nAn alternative to saving multiple related instances in the serializer is to write custom model manager classes that handle creating the correct instances.\n\nFor example, suppose we wanted to ensure that `User` instances and `Profile` instances are always created together as a pair. We might write a custom manager class that looks something like this:\n\n    class UserManager(models.Manager):\n        ...\n\n        def create(self, username, email, is_premium_member=False, has_support_contract=False):\n            user = User(username=username, email=email)\n            user.save()\n            profile = Profile(\n                user=user,\n                is_premium_member=is_premium_member,\n                has_support_contract=has_support_contract\n            )\n            profile.save()\n            return user\n\nThis manager class now more nicely encapsulates that user instances and profile instances are always created at the same time. Our `.create()` method on the serializer class can now be re-written to use the new manager method.\n\n    def create(self, validated_data):\n        return User.objects.create(\n            username=validated_data['username'],\n            email=validated_data['email'],\n            is_premium_member=validated_data['profile']['is_premium_member'],\n            has_support_contract=validated_data['profile']['has_support_contract']\n        )\n\nFor more details on this approach see the Django documentation on [model managers][model-managers], and [this blogpost on using model and manager classes][encapsulation-blogpost].\n\n### Dealing with multiple objects\n\nThe `Serializer` class can also handle serializing or deserializing lists of objects.\n\n#### Serializing multiple objects\n\nTo serialize a queryset or list of objects instead of a single object instance, you should pass the `many=True` flag when instantiating the serializer.  You can then pass a queryset or list of objects to be serialized.\n\n    queryset = Book.objects.all()\n    serializer = BookSerializer(queryset, many=True)\n    serializer.data\n    # [\n    #     {'id': 0, 'title': 'The electric kool-aid acid test', 'author': 'Tom Wolfe'},\n    #     {'id': 1, 'title': 'If this is a man', 'author': 'Primo Levi'},\n    #     {'id': 2, 'title': 'The wind-up bird chronicle', 'author': 'Haruki Murakami'}\n    # ]\n\n#### Deserializing multiple objects\n\nThe default behavior for deserializing multiple objects is to support multiple object creation, but not support multiple object updates. For more information on how to support or customize either of these cases, see the [ListSerializer](#listserializer) documentation below.\n\n### Including extra context\n\nThere are some cases where you need to provide extra context to the serializer in addition to the object being serialized.  One common case is if you're using a serializer that includes hyperlinked relations, which requires the serializer to have access to the current request so that it can properly generate fully qualified URLs.\n\nYou can provide arbitrary additional context by passing a `context` argument when instantiating the serializer.  For example:\n\n    serializer = AccountSerializer(account, context={'request': request})\n    serializer.data\n    # {'id': 6, 'owner': 'denvercoder9', 'created': datetime.datetime(2013, 2, 12, 09, 44, 56, 678870), 'details': 'http://example.com/accounts/6/details'}\n\nThe context dictionary can be used within any serializer field logic, such as a custom `.to_representation()` method, by accessing the `self.context` attribute.\n\n---\n\n## ModelSerializer\n\nOften you'll want serializer classes that map closely to Django model definitions.\n\nThe `ModelSerializer` class provides a shortcut that lets you automatically create a `Serializer` class with fields that correspond to the Model fields.\n\n**The `ModelSerializer` class is the same as a regular `Serializer` class, except that**:\n\n* It will automatically generate a set of fields for you, based on the model.\n* It will automatically generate validators for the serializer, such as unique_together validators.\n* It includes simple default implementations of `.create()` and `.update()`.\n\nDeclaring a `ModelSerializer` looks like this:\n\n    class AccountSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = Account\n            fields = ['id', 'account_name', 'users', 'created']\n\nBy default, all the model fields on the class will be mapped to a corresponding serializer fields.\n\nAny relationships such as foreign keys on the model will be mapped to `PrimaryKeyRelatedField`. Reverse relationships are not included by default unless explicitly included as specified in the [serializer relations][relations] documentation.\n\n### Inspecting a `ModelSerializer`\n\nSerializer classes generate helpful verbose representation strings, that allow you to fully inspect the state of their fields. This is particularly useful when working with `ModelSerializers` where you want to determine what set of fields and validators are being automatically created for you.\n\nTo do so, open the Django shell, using `python manage.py shell`, then import the serializer class, instantiate it, and print the object representation…\n\n    >>> from myapp.serializers import AccountSerializer\n    >>> serializer = AccountSerializer()\n    >>> print(repr(serializer))\n    AccountSerializer():\n        id = IntegerField(label='ID', read_only=True)\n        name = CharField(allow_blank=True, max_length=100, required=False)\n        owner = PrimaryKeyRelatedField(queryset=User.objects.all())\n\n### Specifying which fields to include\n\nIf you only want a subset of the default fields to be used in a model serializer, you can do so using `fields` or `exclude` options, just as you would with a `ModelForm`. It is strongly recommended that you explicitly set all fields that should be serialized using the `fields` attribute. This will make it less likely to result in unintentionally exposing data when your models change.\n\nFor example:\n\n    class AccountSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = Account\n            fields = ['id', 'account_name', 'users', 'created']\n\nYou can also set the `fields` attribute to the special value `'__all__'` to indicate that all fields in the model should be used.\n\nFor example:\n\n    class AccountSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = Account\n            fields = '__all__'\n\nYou can set the `exclude` attribute to a list of fields to be excluded from the serializer.\n\nFor example:\n\n    class AccountSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = Account\n            exclude = ['users']\n\nIn the example above, if the `Account` model had 3 fields `account_name`, `users`, and `created`, this will result in the fields `account_name` and `created` to be serialized.\n\nThe names in the `fields` and `exclude` attributes will normally map to model fields on the model class.\n\nAlternatively names in the `fields` options can map to properties or methods which take no arguments that exist on the model class.\n\nSince version 3.3.0, it is **mandatory** to provide one of the attributes `fields` or `exclude`.\n\n### Specifying nested serialization\n\nThe default `ModelSerializer` uses primary keys for relationships, but you can also easily generate nested representations using the `depth` option:\n\n    class AccountSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = Account\n            fields = ['id', 'account_name', 'users', 'created']\n            depth = 1\n\nThe `depth` option should be set to an integer value that indicates the depth of relationships that should be traversed before reverting to a flat representation.\n\nIf you want to customize the way the serialization is done you'll need to define the field yourself.\n\n### Specifying fields explicitly\n\nYou can add extra fields to a `ModelSerializer` or override the default fields by declaring fields on the class, just as you would for a `Serializer` class.\n\n    class AccountSerializer(serializers.ModelSerializer):\n        url = serializers.CharField(source='get_absolute_url', read_only=True)\n        groups = serializers.PrimaryKeyRelatedField(many=True)\n\n        class Meta:\n            model = Account\n            fields = ['url', 'groups']\n\nExtra fields can correspond to any property or callable on the model.\n\n### Specifying read only fields\n\nYou may wish to specify multiple fields as read-only. Instead of adding each field explicitly with the `read_only=True` attribute, you may use the shortcut Meta option, `read_only_fields`.\n\nThis option should be a list or tuple of field names, and is declared as follows:\n\n    class AccountSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = Account\n            fields = ['id', 'account_name', 'users', 'created']\n            read_only_fields = ['account_name']\n\nModel fields which have `editable=False` set, and `AutoField` fields will be set to read-only by default, and do not need to be added to the `read_only_fields` option.\n\n!!! note\n    There is a special-case where a read-only field is part of a `unique_together` constraint at the model level. In this case the field is required by the serializer class in order to validate the constraint, but should also not be editable by the user.\n\n    The right way to deal with this is to specify the field explicitly on the serializer, providing both the `read_only=True` and `default=…` keyword arguments.\n\n    One example of this is a read-only relation to the currently authenticated `User` which is `unique_together` with another identifier. In this case you would declare the user field like so:\n\n        user = serializers.PrimaryKeyRelatedField(read_only=True, default=serializers.CurrentUserDefault())\n\n    Please review the [Validators Documentation](/api-guide/validators/) for details on the [UniqueTogetherValidator](/api-guide/validators/#uniquetogethervalidator) and [CurrentUserDefault](/api-guide/validators/#currentuserdefault) classes.\n\n### Additional keyword arguments\n\nThere is also a shortcut allowing you to specify arbitrary additional keyword arguments on fields, using the `extra_kwargs` option. As in the case of `read_only_fields`, this means you do not need to explicitly declare the field on the serializer.\n\nThis option is a dictionary, mapping field names to a dictionary of keyword arguments. For example:\n\n    class CreateUserSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = User\n            fields = ['email', 'username', 'password']\n            extra_kwargs = {'password': {'write_only': True}}\n\n        def create(self, validated_data):\n            user = User(\n                email=validated_data['email'],\n                username=validated_data['username']\n            )\n            user.set_password(validated_data['password'])\n            user.save()\n            return user\n\nPlease keep in mind that, if the field has already been explicitly declared on the serializer class, then the `extra_kwargs` option will be ignored.\n\n### Relational fields\n\nWhen serializing model instances, there are a number of different ways you might choose to represent relationships.  The default representation for `ModelSerializer` is to use the primary keys of the related instances.\n\nAlternative representations include serializing using hyperlinks, serializing complete nested representations, or serializing with a custom representation.\n\nFor full details see the [serializer relations][relations] documentation.\n\n### Customizing field mappings\n\nThe ModelSerializer class also exposes an API that you can override in order to alter how serializer fields are automatically determined when instantiating the serializer.\n\nNormally if a `ModelSerializer` does not generate the fields you need by default then you should either add them to the class explicitly, or simply use a regular `Serializer` class instead. However in some cases you may want to create a new base class that defines how the serializer fields are created for any given model.\n\n#### `serializer_field_mapping`\n\nA mapping of Django model fields to REST framework serializer fields. You can override this mapping to alter the default serializer fields that should be used for each model field.\n\n#### `serializer_related_field`\n\nThis property should be the serializer field class, that is used for relational fields by default.\n\nFor `ModelSerializer` this defaults to `serializers.PrimaryKeyRelatedField`.\n\nFor `HyperlinkedModelSerializer` this defaults to `serializers.HyperlinkedRelatedField`.\n\n#### `serializer_url_field`\n\nThe serializer field class that should be used for any `url` field on the serializer.\n\nDefaults to `serializers.HyperlinkedIdentityField`\n\n#### `serializer_choice_field`\n\nThe serializer field class that should be used for any choice fields on the serializer.\n\nDefaults to `serializers.ChoiceField`\n\n#### The field_class and field_kwargs API\n\nThe following methods are called to determine the class and keyword arguments for each field that should be automatically included on the serializer. Each of these methods should return a two tuple of `(field_class, field_kwargs)`.\n\n#### `build_standard_field(self, field_name, model_field)`\n\nCalled to generate a serializer field that maps to a standard model field.\n\nThe default implementation returns a serializer class based on the `serializer_field_mapping` attribute.\n\n#### `build_relational_field(self, field_name, relation_info)`\n\nCalled to generate a serializer field that maps to a relational model field.\n\nThe default implementation returns a serializer class based on the `serializer_related_field` attribute.\n\nThe `relation_info` argument is a named tuple, that contains `model_field`, `related_model`, `to_many` and `has_through_model` properties.\n\n#### `build_nested_field(self, field_name, relation_info, nested_depth)`\n\nCalled to generate a serializer field that maps to a relational model field, when the `depth` option has been set.\n\nThe default implementation dynamically creates a nested serializer class based on either `ModelSerializer` or `HyperlinkedModelSerializer`.\n\nThe `nested_depth` will be the value of the `depth` option, minus one.\n\nThe `relation_info` argument is a named tuple, that contains `model_field`, `related_model`, `to_many` and `has_through_model` properties.\n\n#### `build_property_field(self, field_name, model_class)`\n\nCalled to generate a serializer field that maps to a property or zero-argument method on the model class.\n\nThe default implementation returns a `ReadOnlyField` class.\n\n#### `build_url_field(self, field_name, model_class)`\n\nCalled to generate a serializer field for the serializer's own `url` field. The default implementation returns a `HyperlinkedIdentityField` class.\n\n#### `build_unknown_field(self, field_name, model_class)`\n\nCalled when the field name did not map to any model field or model property.\nThe default implementation raises an error, although subclasses may customize this behavior.\n\n---\n\n## HyperlinkedModelSerializer\n\nThe `HyperlinkedModelSerializer` class is similar to the `ModelSerializer` class except that it uses hyperlinks to represent relationships, rather than primary keys.\n\nBy default the serializer will include a `url` field instead of a primary key field.\n\nThe url field will be represented using a `HyperlinkedIdentityField` serializer field, and any relationships on the model will be represented using a `HyperlinkedRelatedField` serializer field.\n\nYou can explicitly include the primary key by adding it to the `fields` option, for example:\n\n    class AccountSerializer(serializers.HyperlinkedModelSerializer):\n        class Meta:\n            model = Account\n            fields = ['url', 'id', 'account_name', 'users', 'created']\n\n### Absolute and relative URLs\n\nWhen instantiating a `HyperlinkedModelSerializer` you must include the current\n`request` in the serializer context, for example:\n\n    serializer = AccountSerializer(queryset, context={'request': request})\n\nDoing so will ensure that the hyperlinks can include an appropriate hostname,\nso that the resulting representation uses fully qualified URLs, such as:\n\n    http://api.example.com/accounts/1/\n\nRather than relative URLs, such as:\n\n    /accounts/1/\n\nIf you *do* want to use relative URLs, you should explicitly pass `{'request': None}`\nin the serializer context.\n\n### How hyperlinked views are determined\n\nThere needs to be a way of determining which views should be used for hyperlinking to model instances.\n\nBy default hyperlinks are expected to correspond to a view name that matches the style `'{model_name}-detail'`, and looks up the instance by a `pk` keyword argument.\n\nYou can override a URL field view name and lookup field by using either, or both of, the `view_name` and `lookup_field` options in the `extra_kwargs` setting, like so:\n\n    class AccountSerializer(serializers.HyperlinkedModelSerializer):\n        class Meta:\n            model = Account\n            fields = ['url', 'account_name', 'users', 'created']\n            extra_kwargs = {\n                'url': {'view_name': 'accounts', 'lookup_field': 'account_name'},\n                'users': {'lookup_field': 'username'}\n            }\n\nAlternatively you can set the fields on the serializer explicitly. For example:\n\n    class AccountSerializer(serializers.HyperlinkedModelSerializer):\n        url = serializers.HyperlinkedIdentityField(\n            view_name='accounts',\n            lookup_field='slug'\n        )\n        users = serializers.HyperlinkedRelatedField(\n            view_name='user-detail',\n            lookup_field='username',\n            many=True,\n            read_only=True\n        )\n\n        class Meta:\n            model = Account\n            fields = ['url', 'account_name', 'users', 'created']\n\n---\n\n**Tip**: Properly matching together hyperlinked representations and your URL conf can sometimes be a bit fiddly. Printing the `repr` of a `HyperlinkedModelSerializer` instance is a particularly useful way to inspect exactly which view names and lookup fields the relationships are expected to map too.\n\n---\n\n### Changing the URL field name\n\nThe name of the URL field defaults to 'url'.  You can override this globally, by using the `URL_FIELD_NAME` setting.\n\n---\n\n## ListSerializer\n\nThe `ListSerializer` class provides the behavior for serializing and validating multiple objects at once. You won't *typically* need to use `ListSerializer` directly, but should instead simply pass `many=True` when instantiating a serializer.\n\nWhen a serializer is instantiated and `many=True` is passed, a `ListSerializer` instance will be created. The serializer class then becomes a child of the parent `ListSerializer`\n\nThe following argument can also be passed to a `ListSerializer` field or a serializer that is passed `many=True`:\n\n- `allow_empty`: this is `True` by default, but can be set to `False` if you want to disallow empty lists as valid input.\n\n- `max_length`: this is `None` by default, but can be set to a positive integer if you want to validate that the list contains no more than this number of elements.\n\n- `min_length`: this is `None` by default, but can be set to a positive integer if you want to validate that the list contains no fewer than this number of elements.\n\n### Customizing `ListSerializer` behavior\n\nThere *are* a few use cases when you might want to customize the `ListSerializer` behavior. For example:\n\n* You want to provide particular validation of the lists, such as checking that one element does not conflict with another element in a list.\n* You want to customize the create or update behavior of multiple objects.\n\nFor these cases you can modify the class that is used when `many=True` is passed, by using the `list_serializer_class` option on the serializer `Meta` class.\n\nFor example:\n\n    class CustomListSerializer(serializers.ListSerializer):\n        ...\n\n    class CustomSerializer(serializers.Serializer):\n        ...\n        class Meta:\n            list_serializer_class = CustomListSerializer\n\n### Customizing multiple create\n\nThe default implementation for multiple object creation is to simply call `.create()` for each item in the list. If you want to customize this behavior, you'll need to customize the `.create()` method on `ListSerializer` class that is used when `many=True` is passed.\n\nFor example:\n\n    class BookListSerializer(serializers.ListSerializer):\n        def create(self, validated_data):\n            books = [Book(**item) for item in validated_data]\n            return Book.objects.bulk_create(books)\n\n    class BookSerializer(serializers.Serializer):\n        ...\n        class Meta:\n            list_serializer_class = BookListSerializer\n\n### Customizing multiple update\n\nBy default the `ListSerializer` class does not support multiple updates. This is because the behavior that should be expected for insertions and deletions is ambiguous.\n\nTo support multiple updates you'll need to do so explicitly. When writing your multiple update code make sure to keep the following in mind:\n\n* How do you determine which instance should be updated for each item in the list of data?\n* How should insertions be handled? Are they invalid, or do they create new objects?\n* How should removals be handled? Do they imply object deletion, or removing a relationship? Should they be silently ignored, or are they invalid?\n* How should ordering be handled? Does changing the position of two items imply any state change or is it ignored?\n\nYou will need to add an explicit `id` field to the instance serializer. The default implicitly-generated `id` field is marked as `read_only`. This causes it to be removed on updates. Once you declare it explicitly, it will be available in the list serializer's `update` method.\n\nHere's an example of how you might choose to implement multiple updates:\n\n    class BookListSerializer(serializers.ListSerializer):\n        def update(self, instance, validated_data):\n            # Maps for id->instance and id->data item.\n            book_mapping = {book.id: book for book in instance}\n            data_mapping = {item['id']: item for item in validated_data}\n\n            # Perform creations and updates.\n            ret = []\n            for book_id, data in data_mapping.items():\n                book = book_mapping.get(book_id, None)\n                if book is None:\n                    ret.append(self.child.create(data))\n                else:\n                    ret.append(self.child.update(book, data))\n\n            # Perform deletions.\n            for book_id, book in book_mapping.items():\n                if book_id not in data_mapping:\n                    book.delete()\n\n            return ret\n\n    class BookSerializer(serializers.Serializer):\n        # We need to identify elements in the list using their primary key,\n        # so use a writable field here, rather than the default which would be read-only.\n        id = serializers.IntegerField()\n        ...\n\n        class Meta:\n            list_serializer_class = BookListSerializer\n\n### Customizing ListSerializer initialization\n\nWhen a serializer with `many=True` is instantiated, we need to determine which arguments and keyword arguments should be passed to the `.__init__()` method for both the child `Serializer` class, and for the parent `ListSerializer` class.\n\nThe default implementation is to pass all arguments to both classes, except for `validators`, and any custom keyword arguments, both of which are assumed to be intended for the child serializer class.\n\nOccasionally you might need to explicitly specify how the child and parent classes should be instantiated when `many=True` is passed. You can do so by using the `many_init` class method.\n\n        @classmethod\n        def many_init(cls, *args, **kwargs):\n            # Instantiate the child serializer.\n            kwargs['child'] = cls()\n            # Instantiate the parent list serializer.\n            return CustomListSerializer(*args, **kwargs)\n\n---\n\n## BaseSerializer\n\n`BaseSerializer` class that can be used to easily support alternative serialization and deserialization styles.\n\nThis class implements the same basic API as the `Serializer` class:\n\n* `.data` - Returns the outgoing primitive representation.\n* `.is_valid()` - Deserializes and validates incoming data.\n* `.validated_data` - Returns the validated incoming data.\n* `.errors` - Returns any errors during validation.\n* `.save()` - Persists the validated data into an object instance.\n\nThere are four methods that can be overridden, depending on what functionality you want the serializer class to support:\n\n* `.to_representation()` - Override this to support serialization, for read operations.\n* `.to_internal_value()` - Override this to support deserialization, for write operations.\n* `.create()` and `.update()` - Override either or both of these to support saving instances.\n\nBecause this class provides the same interface as the `Serializer` class, you can use it with the existing generic class-based views exactly as you would for a regular `Serializer` or `ModelSerializer`.\n\nThe only difference you'll notice when doing so is the `BaseSerializer` classes will not generate HTML forms in the browsable API. This is because the data they return does not include all the field information that would allow each field to be rendered into a suitable HTML input.\n\n### Read-only `BaseSerializer` classes\n\nTo implement a read-only serializer using the `BaseSerializer` class, we just need to override the `.to_representation()` method. Let's take a look at an example using a simple Django model:\n\n    class HighScore(models.Model):\n        created = models.DateTimeField(auto_now_add=True)\n        player_name = models.CharField(max_length=10)\n        score = models.IntegerField()\n\nIt's simple to create a read-only serializer for converting `HighScore` instances into primitive data types.\n\n    class HighScoreSerializer(serializers.BaseSerializer):\n        def to_representation(self, instance):\n            return {\n                'score': instance.score,\n                'player_name': instance.player_name\n            }\n\nWe can now use this class to serialize single `HighScore` instances:\n\n    @api_view(['GET'])\n    def high_score(request, pk):\n        instance = HighScore.objects.get(pk=pk)\n        serializer = HighScoreSerializer(instance)\n        return Response(serializer.data)\n\nOr use it to serialize multiple instances:\n\n    @api_view(['GET'])\n    def all_high_scores(request):\n        queryset = HighScore.objects.order_by('-score')\n        serializer = HighScoreSerializer(queryset, many=True)\n        return Response(serializer.data)\n\n### Read-write `BaseSerializer` classes\n\nTo create a read-write serializer we first need to implement a `.to_internal_value()` method. This method returns the validated values that will be used to construct the object instance, and may raise a `serializers.ValidationError` if the supplied data is in an incorrect format.\n\nOnce you've implemented `.to_internal_value()`, the basic validation API will be available on the serializer, and you will be able to use `.is_valid()`, `.validated_data` and `.errors`.\n\nIf you want to also support `.save()` you'll need to also implement either or both of the `.create()` and `.update()` methods.\n\nHere's a complete example of our previous `HighScoreSerializer`, that's been updated to support both read and write operations.\n\n    class HighScoreSerializer(serializers.BaseSerializer):\n        def to_internal_value(self, data):\n            score = data.get('score')\n            player_name = data.get('player_name')\n\n            # Perform the data validation.\n            if not score:\n                raise serializers.ValidationError({\n                    'score': 'This field is required.'\n                })\n            if not player_name:\n                raise serializers.ValidationError({\n                    'player_name': 'This field is required.'\n                })\n            if len(player_name) > 10:\n                raise serializers.ValidationError({\n                    'player_name': 'May not be more than 10 characters.'\n                })\n\n            # Return the validated values. This will be available as\n            # the `.validated_data` property.\n            return {\n                'score': int(score),\n                'player_name': player_name\n            }\n\n        def to_representation(self, instance):\n            return {\n                'score': instance.score,\n                'player_name': instance.player_name\n            }\n\n        def create(self, validated_data):\n            return HighScore.objects.create(**validated_data)\n\n### Creating new base classes\n\nThe `BaseSerializer` class is also useful if you want to implement new generic serializer classes for dealing with particular serialization styles, or for integrating with alternative storage backends.\n\nThe following class is an example of a generic serializer that can handle coercing arbitrary complex objects into primitive representations.\n\n    class ObjectSerializer(serializers.BaseSerializer):\n        \"\"\"\n        A read-only serializer that coerces arbitrary complex objects\n        into primitive representations.\n        \"\"\"\n        def to_representation(self, instance):\n            output = {}\n            for attribute_name in dir(instance):\n                attribute = getattr(instance, attribute_name)\n                if attribute_name.startswith('_'):\n                    # Ignore private attributes.\n                    pass\n                elif hasattr(attribute, '__call__'):\n                    # Ignore methods and other callables.\n                    pass\n                elif isinstance(attribute, (str, int, bool, float, type(None))):\n                    # Primitive types can be passed through unmodified.\n                    output[attribute_name] = attribute\n                elif isinstance(attribute, list):\n                    # Recursively deal with items in lists.\n                    output[attribute_name] = [\n                        self.to_representation(item) for item in attribute\n                    ]\n                elif isinstance(attribute, dict):\n                    # Recursively deal with items in dictionaries.\n                    output[attribute_name] = {\n                        str(key): self.to_representation(value)\n                        for key, value in attribute.items()\n                    }\n                else:\n                    # Force anything else to its string representation.\n                    output[attribute_name] = str(attribute)\n            return output\n\n---\n\n## Advanced serializer usage\n\n### Overriding serialization and deserialization behavior\n\nIf you need to alter the serialization or deserialization behavior of a serializer class, you can do so by overriding the `.to_representation()` or `.to_internal_value()` methods.\n\nSome reasons this might be useful include...\n\n* Adding new behavior for new serializer base classes.\n* Modifying the behavior slightly for an existing class.\n* Improving serialization performance for a frequently accessed API endpoint that returns lots of data.\n\nThe signatures for these methods are as follows:\n\n#### `to_representation(self, instance)`\n\nTakes the object instance that requires serialization, and should return a primitive representation. Typically this means returning a structure of built-in Python datatypes. The exact types that can be handled will depend on the render classes you have configured for your API.\n\nMay be overridden in order to modify the representation style. For example:\n\n    def to_representation(self, instance):\n        \"\"\"Convert `username` to lowercase.\"\"\"\n        ret = super().to_representation(instance)\n        ret['username'] = ret['username'].lower()\n        return ret\n\n#### ``to_internal_value(self, data)``\n\nTakes the unvalidated incoming data as input and should return the validated data that will be made available as `serializer.validated_data`. The return value will also be passed to the `.create()` or `.update()` methods if `.save()` is called on the serializer class.\n\nIf any of the validation fails, then the method should raise a `serializers.ValidationError(errors)`. The `errors` argument should be a dictionary mapping field names (or `settings.NON_FIELD_ERRORS_KEY`) to a list of error messages. If you don't need to alter deserialization behavior and instead want to provide object-level validation, it's recommended that you instead override the [`.validate()`](#object-level-validation) method.\n\nThe `data` argument passed to this method will normally be the value of `request.data`, so the datatype it provides will depend on the parser classes you have configured for your API.\n\n### Serializer Inheritance\n\nSimilar to Django forms, you can extend and reuse serializers through inheritance. This allows you to declare a common set of fields or methods on a parent class that can then be used in a number of serializers. For example,\n\n    class MyBaseSerializer(Serializer):\n        my_field = serializers.CharField()\n\n        def validate_my_field(self, value):\n            ...\n\n    class MySerializer(MyBaseSerializer):\n        ...\n\nLike Django's `Model` and `ModelForm` classes, the inner `Meta` class on serializers does not implicitly inherit from it's parents' inner `Meta` classes. If you want the `Meta` class to inherit from a parent class you must do so explicitly. For example:\n\n    class AccountSerializer(MyBaseSerializer):\n        class Meta(MyBaseSerializer.Meta):\n            model = Account\n\nTypically we would recommend *not* using inheritance on inner Meta classes, but instead declaring all options explicitly.\n\nAdditionally, the following caveats apply to serializer inheritance:\n\n* Normal Python name resolution rules apply. If you have multiple base classes that declare a `Meta` inner class, only the first one will be used. This means the child’s `Meta`, if it exists, otherwise the `Meta` of the first parent, etc.\n* It’s possible to declaratively remove a `Field` inherited from a parent class by setting the name to be `None` on the subclass.\n\n        class MyBaseSerializer(ModelSerializer):\n            my_field = serializers.CharField()\n\n        class MySerializer(MyBaseSerializer):\n            my_field = None\n\n    However, you can only use this technique to opt out from a field defined declaratively by a parent class; it won’t prevent the `ModelSerializer` from generating a default field. To opt-out from default fields, see [Specifying which fields to include](#specifying-which-fields-to-include).\n\n### Dynamically modifying fields\n\nOnce a serializer has been initialized, the dictionary of fields that are set on the serializer may be accessed using the `.fields` attribute.  Accessing and modifying this attribute allows you to dynamically modify the serializer.\n\nModifying the `fields` argument directly allows you to do interesting things such as changing the arguments on serializer fields at runtime, rather than at the point of declaring the serializer.\n\n#### Example\n\nFor example, if you wanted to be able to set which fields should be used by a serializer at the point of initializing it, you could create a serializer class like so:\n\n    class DynamicFieldsModelSerializer(serializers.ModelSerializer):\n        \"\"\"\n        A ModelSerializer that takes an additional `fields` argument that\n        controls which fields should be displayed.\n        \"\"\"\n\n        def __init__(self, *args, **kwargs):\n            # Don't pass the 'fields' arg up to the superclass\n            fields = kwargs.pop('fields', None)\n\n            # Instantiate the superclass normally\n            super().__init__(*args, **kwargs)\n\n            if fields is not None:\n                # Drop any fields that are not specified in the `fields` argument.\n                allowed = set(fields)\n                existing = set(self.fields)\n                for field_name in existing - allowed:\n                    self.fields.pop(field_name)\n\nThis would then allow you to do the following:\n\n    >>> class UserSerializer(DynamicFieldsModelSerializer):\n    >>>     class Meta:\n    >>>         model = User\n    >>>         fields = ['id', 'username', 'email']\n    >>>\n    >>> print(UserSerializer(user))\n    {'id': 2, 'username': 'jonwatts', 'email': 'jon@example.com'}\n    >>>\n    >>> print(UserSerializer(user, fields=('id', 'email')))\n    {'id': 2, 'email': 'jon@example.com'}\n\n### Customizing the default fields\n\nREST framework 2 provided an API to allow developers to override how a `ModelSerializer` class would automatically generate the default set of fields.\n\nThis API included the `.get_field()`, `.get_pk_field()` and other methods.\n\nBecause the serializers have been fundamentally redesigned with 3.0 this API no longer exists. You can still modify the fields that get created but you'll need to refer to the source code, and be aware that if the changes you make are against private bits of API then they may be subject to change.\n\n---\n\n## Third party packages\n\nThe following third party packages are also available.\n\n### Django REST marshmallow\n\nThe [django-rest-marshmallow][django-rest-marshmallow] package provides an alternative implementation for serializers, using the python [marshmallow][marshmallow] library. It exposes the same API as the REST framework serializers, and can be used as a drop-in replacement in some use-cases.\n\n### Serpy\n\nThe [serpy][serpy] package is an alternative implementation for serializers that is built for speed. [Serpy][serpy] serializes complex datatypes to simple native types. The native types can be easily converted to JSON or any other format needed.\n\n### MongoengineModelSerializer\n\nThe [django-rest-framework-mongoengine][mongoengine] package provides a `MongoEngineModelSerializer` serializer class that supports using MongoDB as the storage layer for Django REST framework.\n\n### GeoFeatureModelSerializer\n\nThe [django-rest-framework-gis][django-rest-framework-gis] package provides a `GeoFeatureModelSerializer` serializer class that supports GeoJSON both for read and write operations.\n\n### HStoreSerializer\n\nThe [django-rest-framework-hstore][django-rest-framework-hstore] package provides an `HStoreSerializer` to support [django-hstore][django-hstore] `DictionaryField` model field and its `schema-mode` feature.\n\n### Dynamic REST\n\nThe [dynamic-rest][dynamic-rest] package extends the ModelSerializer and ModelViewSet interfaces, adding API query parameters for filtering, sorting, and including / excluding all fields and relationships defined by your serializers.\n\n### Dynamic Fields Mixin\n\nThe [drf-dynamic-fields][drf-dynamic-fields] package provides a mixin to dynamically limit the fields per serializer to a subset specified by an URL parameter.\n\n### DRF FlexFields\n\nThe [drf-flex-fields][drf-flex-fields] package extends the ModelSerializer and ModelViewSet to provide commonly used functionality for dynamically setting fields and expanding primitive fields to nested models, both from URL parameters and your serializer class definitions.\n\n### Serializer Extensions\n\nThe [django-rest-framework-serializer-extensions][drf-serializer-extensions]\npackage provides a collection of tools to DRY up your serializers, by allowing\nfields to be defined on a per-view/request basis. Fields can be whitelisted,\nblacklisted and child serializers can be optionally expanded.\n\n### HTML JSON Forms\n\nThe [html-json-forms][html-json-forms] package provides an algorithm and serializer for processing `<form>` submissions per the (inactive) [HTML JSON Form specification][json-form-spec].  The serializer facilitates processing of arbitrarily nested JSON structures within HTML.  For example, `<input name=\"items[0][id]\" value=\"5\">` will be interpreted as `{\"items\": [{\"id\": \"5\"}]}`.\n\n### DRF-Base64\n\n[DRF-Base64][drf-base64] provides a set of field and model serializers that handles the upload of base64-encoded files.\n\n### QueryFields\n\n[djangorestframework-queryfields][djangorestframework-queryfields] allows API clients to specify which fields will be sent in the response via inclusion/exclusion query parameters.\n\n### DRF Writable Nested\n\nThe [drf-writable-nested][drf-writable-nested] package provides writable nested model serializer which allows to create/update models with nested related data.\n\n### DRF Encrypt Content\n\nThe [drf-encrypt-content][drf-encrypt-content] package helps you encrypt your data, serialized through ModelSerializer. It also contains some helper functions. Which helps you to encrypt your data.\n\n### Shapeless Serializers\n\nThe [drf-shapeless-serializers][drf-shapeless-serializers] package provides dynamic serializer configuration capabilities, allowing runtime field selection, renaming, attribute modification, and nested relationship configuration without creating multiple serializer classes. It helps eliminate serializer boilerplate while providing flexible API responses.\n\n### DRF Pydantic\n\nThe [drf-pydantic][drf-pydantic] package allows you to use Pydantic with Django REST framework for data validation and (de)serialization. If you develop DRF APIs and rely on Pydantic for data validation, this package provides seamless integration between both libraries.\n\n\n[cite]: https://groups.google.com/d/topic/django-users/sVFaOfQi4wY/discussion\n[relations]: relations.md\n[model-managers]: https://docs.djangoproject.com/en/stable/topics/db/managers/\n[encapsulation-blogpost]: https://www.dabapps.com/blog/django-models-and-encapsulation/\n[thirdparty-writable-nested]: serializers.md#drf-writable-nested\n[django-rest-marshmallow]: https://marshmallow-code.github.io/django-rest-marshmallow/\n[marshmallow]: https://marshmallow.readthedocs.io/en/latest/\n[serpy]: https://github.com/clarkduvall/serpy\n[mongoengine]: https://github.com/umutbozkurt/django-rest-framework-mongoengine\n[django-rest-framework-gis]: https://github.com/djangonauts/django-rest-framework-gis\n[django-rest-framework-hstore]: https://github.com/djangonauts/django-rest-framework-hstore\n[django-hstore]: https://github.com/djangonauts/django-hstore\n[dynamic-rest]: https://github.com/AltSchool/dynamic-rest\n[html-json-forms]: https://github.com/wq/html-json-forms\n[drf-flex-fields]: https://github.com/rsinger86/drf-flex-fields\n[json-form-spec]: https://www.w3.org/TR/html-json-forms/\n[drf-dynamic-fields]: https://github.com/dbrgn/drf-dynamic-fields\n[drf-base64]: https://bitbucket.org/levit_scs/drf_base64\n[drf-serializer-extensions]: https://github.com/evenicoulddoit/django-rest-framework-serializer-extensions\n[djangorestframework-queryfields]: https://djangorestframework-queryfields.readthedocs.io/\n[drf-writable-nested]: https://github.com/beda-software/drf-writable-nested\n[drf-encrypt-content]: https://github.com/oguzhancelikarslan/drf-encrypt-content\n[drf-shapeless-serializers]: https://github.com/khaledsukkar2/drf-shapeless-serializers\n[drf-pydantic]: https://github.com/georgebv/drf-pydantic\n"
  },
  {
    "path": "docs/api-guide/settings.md",
    "content": "---\nsource:\n    - settings.py\n---\n\n# Settings\n\n> Namespaces are one honking great idea - let's do more of those!\n>\n> &mdash; [The Zen of Python][cite]\n\nConfiguration for REST framework is all namespaced inside a single Django setting, named `REST_FRAMEWORK`.\n\nFor example your project's `settings.py` file might include something like this:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_RENDERER_CLASSES': [\n            'rest_framework.renderers.JSONRenderer',\n        ],\n        'DEFAULT_PARSER_CLASSES': [\n            'rest_framework.parsers.JSONParser',\n        ]\n    }\n\n## Accessing settings\n\nIf you need to access the values of REST framework's API settings in your project,\nyou should use the `api_settings` object.  For example.\n\n    from rest_framework.settings import api_settings\n\n    print(api_settings.DEFAULT_AUTHENTICATION_CLASSES)\n\nThe `api_settings` object will check for any user-defined settings, and otherwise fall back to the default values.  Any setting that uses string import paths to refer to a class will automatically import and return the referenced class, instead of the string literal.\n\n---\n\n## API Reference\n\n### API policy settings\n\n*The following settings control the basic API policies, and are applied to every `APIView` class-based view, or `@api_view` function based view.*\n\n#### DEFAULT_RENDERER_CLASSES\n\nA list or tuple of renderer classes, that determines the default set of renderers that may be used when returning a `Response` object.\n\nDefault:\n\n    [\n        'rest_framework.renderers.JSONRenderer',\n        'rest_framework.renderers.BrowsableAPIRenderer',\n    ]\n\n#### DEFAULT_PARSER_CLASSES\n\nA list or tuple of parser classes, that determines the default set of parsers used when accessing the `request.data` property.\n\nDefault:\n\n    [\n        'rest_framework.parsers.JSONParser',\n        'rest_framework.parsers.FormParser',\n        'rest_framework.parsers.MultiPartParser'\n    ]\n\n#### DEFAULT_AUTHENTICATION_CLASSES\n\nA list or tuple of authentication classes, that determines the default set of authenticators used when accessing the `request.user` or `request.auth` properties.\n\nDefault:\n\n    [\n        'rest_framework.authentication.SessionAuthentication',\n        'rest_framework.authentication.BasicAuthentication'\n    ]\n\n#### DEFAULT_PERMISSION_CLASSES\n\nA list or tuple of permission classes, that determines the default set of permissions checked at the start of a view. Permission must be granted by every class in the list.\n\nDefault:\n\n    [\n        'rest_framework.permissions.AllowAny',\n    ]\n\n#### DEFAULT_THROTTLE_CLASSES\n\nA list or tuple of throttle classes, that determines the default set of throttles checked at the start of a view.\n\nDefault: `[]`\n\n#### DEFAULT_CONTENT_NEGOTIATION_CLASS\n\nA content negotiation class, that determines how a renderer is selected for the response, given an incoming request.\n\nDefault: `'rest_framework.negotiation.DefaultContentNegotiation'`\n\n#### DEFAULT_SCHEMA_CLASS\n\nA view inspector class that will be used for schema generation.\n\nDefault: `'rest_framework.schemas.openapi.AutoSchema'`\n\n---\n\n### Generic view settings\n\n*The following settings control the behavior of the generic class-based views.*\n\n#### DEFAULT_FILTER_BACKENDS\n\nA list of filter backend classes that should be used for generic filtering.\nIf set to `None` then generic filtering is disabled.\n\n#### DEFAULT_PAGINATION_CLASS\n\nThe default class to use for queryset pagination. If set to `None`, pagination\nis disabled by default. See the pagination documentation for further guidance on\n[setting](pagination.md#setting-the-pagination-style) and\n[modifying](pagination.md#modifying-the-pagination-style) the pagination style.\n\nDefault: `None`\n\n#### PAGE_SIZE\n\nThe default page size to use for pagination.  If set to `None`, pagination is disabled by default.\n\nDefault: `None`\n\n#### SEARCH_PARAM\n\nThe name of a query parameter, which can be used to specify the search term used by `SearchFilter`.\n\nDefault: `search`\n\n#### ORDERING_PARAM\n\nThe name of a query parameter, which can be used to specify the ordering of results returned by `OrderingFilter`.\n\nDefault: `ordering`\n\n---\n\n### Versioning settings\n\n#### DEFAULT_VERSION\n\nThe value that should be used for `request.version` when no versioning information is present.\n\nDefault: `None`\n\n#### ALLOWED_VERSIONS\n\nIf set, this value will restrict the set of versions that may be returned by the versioning scheme, and will raise an error if the provided version if not in this set.\n\nDefault: `None`\n\n#### VERSION_PARAM\n\nThe string that should used for any versioning parameters, such as in the media type or URL query parameters.\n\nDefault: `'version'`\n\n#### DEFAULT_VERSIONING_CLASS\n\nThe default versioning scheme to use.\n\nDefault: `None`\n\n---\n\n### Authentication settings\n\n*The following settings control the behavior of unauthenticated requests.*\n\n#### UNAUTHENTICATED_USER\n\nThe class that should be used to initialize `request.user` for unauthenticated requests.\n(If removing authentication entirely, e.g. by removing `django.contrib.auth` from\n`INSTALLED_APPS`, set `UNAUTHENTICATED_USER` to `None`.)\n\nDefault: `django.contrib.auth.models.AnonymousUser`\n\n#### UNAUTHENTICATED_TOKEN\n\nThe class that should be used to initialize `request.auth` for unauthenticated requests.\n\nDefault: `None`\n\n---\n\n### Test settings\n\n*The following settings control the behavior of APIRequestFactory and APIClient*\n\n#### TEST_REQUEST_DEFAULT_FORMAT\n\nThe default format that should be used when making test requests.\n\nThis should match up with the format of one of the renderer classes in the `TEST_REQUEST_RENDERER_CLASSES` setting.\n\nDefault: `'multipart'`\n\n#### TEST_REQUEST_RENDERER_CLASSES\n\nThe renderer classes that are supported when building test requests.\n\nThe format of any of these renderer classes may be used when constructing a test request, for example: `client.post('/users', {'username': 'jamie'}, format='json')`\n\nDefault:\n\n    [\n        'rest_framework.renderers.MultiPartRenderer',\n        'rest_framework.renderers.JSONRenderer'\n    ]\n\n---\n\n### Schema generation controls\n\n#### SCHEMA_COERCE_PATH_PK\n\nIf set, this maps the `'pk'` identifier in the URL conf onto the actual field\nname when generating a schema path parameter. Typically this will be `'id'`.\nThis gives a more suitable representation as \"primary key\" is an implementation\ndetail, whereas \"identifier\" is a more general concept.\n\nDefault: `True`\n\n#### SCHEMA_COERCE_METHOD_NAMES\n\nIf set, this is used to map internal viewset method names onto external action\nnames used in the schema generation. This allows us to generate names that\nare more suitable for an external representation than those that are used\ninternally in the codebase.\n\nDefault: `{'retrieve': 'read', 'destroy': 'delete'}`\n\n---\n\n### Content type controls\n\n#### URL_FORMAT_OVERRIDE\n\nThe name of a URL parameter that may be used to override the default content negotiation `Accept` header behavior, by using a `format=…` query parameter in the request URL.\n\nFor example: `http://example.com/organizations/?format=csv`\n\nIf the value of this setting is `None` then URL format overrides will be disabled.\n\nDefault: `'format'`\n\n#### FORMAT_SUFFIX_KWARG\n\nThe name of a parameter in the URL conf that may be used to provide a format suffix. This setting is applied when using `format_suffix_patterns` to include suffixed URL patterns.\n\nFor example: `http://example.com/organizations.csv/`\n\nDefault: `'format'`\n\n---\n\n### Date and time formatting\n\n*The following settings are used to control how date and time representations may be parsed and rendered.*\n\n#### DATETIME_FORMAT\n\nA format string that should be used by default for rendering the output of `DateTimeField` serializer fields.  If `None`, then `DateTimeField` serializer fields will return Python `datetime` objects, and the datetime encoding will be determined by the renderer.\n\nMay be any of `None`, `'iso-8601'` or a Python [strftime format][strftime] string.\n\nDefault: `'iso-8601'`\n\n#### DATETIME_INPUT_FORMATS\n\nA list of format strings that should be used by default for parsing inputs to `DateTimeField` serializer fields.\n\nMay be a list including the string `'iso-8601'` or Python [strftime format][strftime] strings.\n\nDefault: `['iso-8601']`\n\n#### DATE_FORMAT\n\nA format string that should be used by default for rendering the output of `DateField` serializer fields.  If `None`, then `DateField` serializer fields will return Python `date` objects, and the date encoding will be determined by the renderer.\n\nMay be any of `None`, `'iso-8601'` or a Python [strftime format][strftime] string.\n\nDefault: `'iso-8601'`\n\n#### DATE_INPUT_FORMATS\n\nA list of format strings that should be used by default for parsing inputs to `DateField` serializer fields.\n\nMay be a list including the string `'iso-8601'` or Python [strftime format][strftime] strings.\n\nDefault: `['iso-8601']`\n\n#### TIME_FORMAT\n\nA format string that should be used by default for rendering the output of `TimeField` serializer fields.  If `None`, then `TimeField` serializer fields will return Python `time` objects, and the time encoding will be determined by the renderer.\n\nMay be any of `None`, `'iso-8601'` or a Python [strftime format][strftime] string.\n\nDefault: `'iso-8601'`\n\n#### TIME_INPUT_FORMATS\n\nA list of format strings that should be used by default for parsing inputs to `TimeField` serializer fields.\n\nMay be a list including the string `'iso-8601'` or Python [strftime format][strftime] strings.\n\nDefault: `['iso-8601']`\n\n\n#### DURATION_FORMAT\n\nIndicates the default format that should be used for rendering the output of `DurationField` serializer fields.  If `None`, then `DurationField` serializer fields will return Python `timedelta` objects, and the duration encoding will be determined by the renderer.\n\nMay be any of `None`, `'iso-8601'` or `'django'` (the format accepted by `django.utils.dateparse.parse_duration`).\n\nDefault: `'django'`\n\n---\n\n### Encodings\n\n#### UNICODE_JSON\n\nWhen set to `True`, JSON responses will allow unicode characters in responses. For example:\n\n    {\"unicode black star\":\"★\"}\n\nWhen set to `False`, JSON responses will escape non-ascii characters, like so:\n\n    {\"unicode black star\":\"\\u2605\"}\n\nBoth styles conform to [RFC 4627][rfc4627], and are syntactically valid JSON. The unicode style is preferred as being more user-friendly when inspecting API responses.\n\nDefault: `True`\n\n#### COMPACT_JSON\n\nWhen set to `True`, JSON responses will return compact representations, with no spacing after `':'` and `','` characters. For example:\n\n    {\"is_admin\":false,\"email\":\"jane@example\"}\n\nWhen set to `False`, JSON responses will return slightly more verbose representations, like so:\n\n    {\"is_admin\": false, \"email\": \"jane@example\"}\n\nThe default style is to return minified responses, in line with [Heroku's API design guidelines][heroku-minified-json].\n\nDefault: `True`\n\n#### STRICT_JSON\n\nWhen set to `True`, JSON rendering and parsing will only observe syntactically valid JSON, raising an exception for the extended float values (`nan`, `inf`, `-inf`) accepted by Python's `json` module. This is the recommended setting, as these values are not generally supported. e.g., neither Javascript's `JSON.Parse` nor PostgreSQL's JSON data type accept these values.\n\nWhen set to `False`, JSON rendering and parsing will be permissive. However, these values are still invalid and will need to be specially handled in your code.\n\nDefault: `True`\n\n#### COERCE_DECIMAL_TO_STRING\n\nWhen returning decimal objects in API representations that do not support a native decimal type, it is normally best to return the value as a string. This avoids the loss of precision that occurs with binary floating point implementations.\n\nWhen set to `True`, the serializer `DecimalField` class will return strings instead of `Decimal` objects. When set to `False`, serializers will return `Decimal` objects, which the default JSON encoder will return as floats.\n\nDefault: `True`\n\n#### COERCE_BIGINT_TO_STRING\n\nWhen returning biginteger objects in API representations that do not support numbers up to 2^64, it is best to return the value as a string. This avoids the loss of precision that occurs with biginteger implementations.\n\nWhen set to `True`, the serializer `BigIntegerField` class (by default) will return strings instead of `BigInteger` objects. When set to `False`, serializers will return `BigInteger` objects, which the default JSON encoder will return as numbers.\n\nDefault: `False`\n\n---\n\n### View names and descriptions\n\n**The following settings are used to generate the view names and descriptions, as used in responses to `OPTIONS` requests, and as used in the browsable API.**\n\n#### VIEW_NAME_FUNCTION\n\nA string representing the function that should be used when generating view names.\n\nThis should be a function with the following signature:\n\n    view_name(self)\n\n* `self`: The view instance.  Typically the name function would inspect the name of the class when generating a descriptive name, by accessing `self.__class__.__name__`.\n\nIf the view instance inherits `ViewSet`, it may have been initialized with several optional arguments:\n\n* `name`: A name explicitly provided to a view in the viewset. Typically, this value should be used as-is when provided.\n* `suffix`: Text used when differentiating individual views in a viewset. This argument is mutually exclusive to `name`.\n* `detail`: Boolean that differentiates an individual view in a viewset as either being a 'list' or 'detail' view.\n\nDefault: `'rest_framework.views.get_view_name'`\n\n#### VIEW_DESCRIPTION_FUNCTION\n\nA string representing the function that should be used when generating view descriptions.\n\nThis setting can be changed to support markup styles other than the default markdown.  For example, you can use it to support `rst` markup in your view docstrings being output in the browsable API.\n\nThis should be a function with the following signature:\n\n    view_description(self, html=False)\n\n* `self`: The view instance.  Typically the description function would inspect the docstring of the class when generating a description, by accessing `self.__class__.__doc__`\n* `html`: A boolean indicating if HTML output is required.  `True` when used in the browsable API, and `False` when used in generating `OPTIONS` responses.\n\nIf the view instance inherits `ViewSet`, it may have been initialized with several optional arguments:\n\n* `description`: A description explicitly provided to the view in the viewset. Typically, this is set by extra viewset `action`s, and should be used as-is.\n\nDefault: `'rest_framework.views.get_view_description'`\n\n### HTML Select Field cutoffs\n\nGlobal settings for [select field cutoffs for rendering relational fields](relations.md#select-field-cutoffs) in the browsable API.\n\n#### HTML_SELECT_CUTOFF\n\nGlobal setting for the `html_cutoff` value.  Must be an integer.\n\nDefault: 1000\n\n#### HTML_SELECT_CUTOFF_TEXT\n\nA string representing a global setting for `html_cutoff_text`.\n\nDefault: `\"More than {count} items...\"`\n\n---\n\n### Miscellaneous settings\n\n#### EXCEPTION_HANDLER\n\nA string representing the function that should be used when returning a response for any given exception.  If the function returns `None`, a 500 error will be raised.\n\nThis setting can be changed to support error responses other than the default `{\"detail\": \"Failure...\"}` responses.  For example, you can use it to provide API responses like `{\"errors\": [{\"message\": \"Failure...\", \"code\": \"\"} ...]}`.\n\nThis should be a function with the following signature:\n\n    exception_handler(exc, context)\n\n* `exc`: The exception.\n\nDefault: `'rest_framework.views.exception_handler'`\n\n#### NON_FIELD_ERRORS_KEY\n\nA string representing the key that should be used for serializer errors that do not refer to a specific field, but are instead general errors.\n\nDefault: `'non_field_errors'`\n\n#### URL_FIELD_NAME\n\nA string representing the key that should be used for the URL fields generated by `HyperlinkedModelSerializer`.\n\nDefault: `'url'`\n\n#### NUM_PROXIES\n\nAn integer of 0 or more, that may be used to specify the number of application proxies that the API runs behind.  This allows throttling to more accurately identify client IP addresses.  If set to `None` then less strict IP matching will be used by the throttle classes.\n\nDefault: `None`\n\n[cite]: https://www.python.org/dev/peps/pep-0020/\n[rfc4627]: https://www.ietf.org/rfc/rfc4627.txt\n[heroku-minified-json]: https://github.com/interagent/http-api-design#keep-json-minified-in-all-responses\n[strftime]: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes\n"
  },
  {
    "path": "docs/api-guide/status-codes.md",
    "content": "---\nsource:\n    - status.py\n---\n\n# Status Codes\n\n> 418 I'm a teapot - Any attempt to brew coffee with a teapot should result in the error code \"418 I'm a teapot\".  The resulting entity body MAY be short and stout.\n>\n> &mdash; [RFC 2324][rfc2324], Hyper Text Coffee Pot Control Protocol\n\nUsing bare status codes in your responses isn't recommended.  REST framework includes a set of named constants that you can use to make your code more obvious and readable.\n\n    from rest_framework import status\n    from rest_framework.response import Response\n\n    def empty_view(self):\n        content = {'please move along': 'nothing to see here'}\n        return Response(content, status=status.HTTP_404_NOT_FOUND)\n\nThe full set of HTTP status codes included in the `status` module is listed below.\n\nThe module also includes a set of helper functions for testing if a status code is in a given range.\n\n    from rest_framework import status\n    from rest_framework.test import APITestCase\n\n    class ExampleTestCase(APITestCase):\n        def test_url_root(self):\n            url = reverse('index')\n            response = self.client.get(url)\n            self.assertTrue(status.is_success(response.status_code))\n\n\nFor more information on proper usage of HTTP status codes see [RFC 2616][rfc2616]\nand [RFC 6585][rfc6585].\n\n## Informational - 1xx\n\nThis class of status code indicates a provisional response.  There are no 1xx status codes used in REST framework by default.\n\n    HTTP_100_CONTINUE\n    HTTP_101_SWITCHING_PROTOCOLS\n    HTTP_102_PROCESSING\n    HTTP_103_EARLY_HINTS\n\n## Successful - 2xx\n\nThis class of status code indicates that the client's request was successfully received, understood, and accepted.\n\n    HTTP_200_OK\n    HTTP_201_CREATED\n    HTTP_202_ACCEPTED\n    HTTP_203_NON_AUTHORITATIVE_INFORMATION\n    HTTP_204_NO_CONTENT\n    HTTP_205_RESET_CONTENT\n    HTTP_206_PARTIAL_CONTENT\n    HTTP_207_MULTI_STATUS\n    HTTP_208_ALREADY_REPORTED\n    HTTP_226_IM_USED\n\n## Redirection - 3xx\n\nThis class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request.\n\n    HTTP_300_MULTIPLE_CHOICES\n    HTTP_301_MOVED_PERMANENTLY\n    HTTP_302_FOUND\n    HTTP_303_SEE_OTHER\n    HTTP_304_NOT_MODIFIED\n    HTTP_305_USE_PROXY\n    HTTP_306_RESERVED\n    HTTP_307_TEMPORARY_REDIRECT\n    HTTP_308_PERMANENT_REDIRECT\n\n## Client Error - 4xx\n\nThe 4xx class of status code is intended for cases in which the client seems to have erred.  Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition.\n\n    HTTP_400_BAD_REQUEST\n    HTTP_401_UNAUTHORIZED\n    HTTP_402_PAYMENT_REQUIRED\n    HTTP_403_FORBIDDEN\n    HTTP_404_NOT_FOUND\n    HTTP_405_METHOD_NOT_ALLOWED\n    HTTP_406_NOT_ACCEPTABLE\n    HTTP_407_PROXY_AUTHENTICATION_REQUIRED\n    HTTP_408_REQUEST_TIMEOUT\n    HTTP_409_CONFLICT\n    HTTP_410_GONE\n    HTTP_411_LENGTH_REQUIRED\n    HTTP_412_PRECONDITION_FAILED\n    HTTP_413_REQUEST_ENTITY_TOO_LARGE\n    HTTP_414_REQUEST_URI_TOO_LONG\n    HTTP_415_UNSUPPORTED_MEDIA_TYPE\n    HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE\n    HTTP_417_EXPECTATION_FAILED\n    HTTP_421_MISDIRECTED_REQUEST\n    HTTP_422_UNPROCESSABLE_ENTITY\n    HTTP_423_LOCKED\n    HTTP_424_FAILED_DEPENDENCY\n    HTTP_425_TOO_EARLY\n    HTTP_426_UPGRADE_REQUIRED\n    HTTP_428_PRECONDITION_REQUIRED\n    HTTP_429_TOO_MANY_REQUESTS\n    HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE\n    HTTP_451_UNAVAILABLE_FOR_LEGAL_REASONS\n\n## Server Error - 5xx\n\nResponse status codes beginning with the digit \"5\" indicate cases in which the server is aware that it has erred or is incapable of performing the request.  Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition.\n\n    HTTP_500_INTERNAL_SERVER_ERROR\n    HTTP_501_NOT_IMPLEMENTED\n    HTTP_502_BAD_GATEWAY\n    HTTP_503_SERVICE_UNAVAILABLE\n    HTTP_504_GATEWAY_TIMEOUT\n    HTTP_505_HTTP_VERSION_NOT_SUPPORTED\n    HTTP_506_VARIANT_ALSO_NEGOTIATES\n    HTTP_507_INSUFFICIENT_STORAGE\n    HTTP_508_LOOP_DETECTED\n    HTTP_509_BANDWIDTH_LIMIT_EXCEEDED\n    HTTP_510_NOT_EXTENDED\n    HTTP_511_NETWORK_AUTHENTICATION_REQUIRED\n\n## Helper functions\n\nThe following helper functions are available for identifying the category of the response code.\n\n    is_informational()  # 1xx\n    is_success()        # 2xx\n    is_redirect()       # 3xx\n    is_client_error()   # 4xx\n    is_server_error()   # 5xx\n\n[rfc2324]: https://www.ietf.org/rfc/rfc2324.txt\n[rfc2616]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html\n[rfc6585]: https://tools.ietf.org/html/rfc6585\n"
  },
  {
    "path": "docs/api-guide/testing.md",
    "content": "---\nsource:\n    - test.py\n---\n\n# Testing\n\n> Code without tests is broken as designed.\n>\n> &mdash; [Jacob Kaplan-Moss][cite]\n\nREST framework includes a few helper classes that extend Django's existing test framework, and improve support for making API requests.\n\n## APIRequestFactory\n\nExtends [Django's existing `RequestFactory` class][requestfactory].\n\n### Creating test requests\n\nThe `APIRequestFactory` class supports an almost identical API to Django's standard `RequestFactory` class.  This means that the standard `.get()`, `.post()`, `.put()`, `.patch()`, `.delete()`, `.head()` and `.options()` methods are all available.\n\n    from rest_framework.test import APIRequestFactory\n\n    # Using the standard RequestFactory API to create a form POST request\n    factory = APIRequestFactory()\n    request = factory.post('/notes/', {'title': 'new idea'})\n\n    # Using the standard RequestFactory API to encode JSON data\n    request = factory.post('/notes/', {'title': 'new idea'}, content_type='application/json')\n\n#### Using the `format` argument\n\nMethods which create a request body, such as `post`, `put` and `patch`, include a `format` argument, which make it easy to generate requests using a wide set of request formats.  When using this argument, the factory will select an appropriate renderer and its configured `content_type`.  For example:\n\n    # Create a JSON POST request\n    factory = APIRequestFactory()\n    request = factory.post('/notes/', {'title': 'new idea'}, format='json')\n\nBy default the available formats are `'multipart'` and `'json'`.  For compatibility with Django's existing `RequestFactory` the default format is `'multipart'`.\n\nTo support a wider set of request formats, or change the default format, [see the configuration section][configuration].\n\n#### Explicitly encoding the request body\n\nIf you need to explicitly encode the request body, you can do so by setting the `content_type` flag.  For example:\n\n    request = factory.post('/notes/', yaml.dump({'title': 'new idea'}), content_type='application/yaml')\n\n#### PUT and PATCH with form data\n\nOne difference worth noting between Django's `RequestFactory` and REST framework's `APIRequestFactory` is that multipart form data will be encoded for methods other than just `.post()`.\n\nFor example, using `APIRequestFactory`, you can make a form PUT request like so:\n\n    factory = APIRequestFactory()\n    request = factory.put('/notes/547/', {'title': 'remember to email dave'})\n\nUsing Django's `RequestFactory`, you'd need to explicitly encode the data yourself:\n\n    from django.test.client import encode_multipart, RequestFactory\n\n    factory = RequestFactory()\n    data = {'title': 'remember to email dave'}\n    content = encode_multipart('BoUnDaRyStRiNg', data)\n    content_type = 'multipart/form-data; boundary=BoUnDaRyStRiNg'\n    request = factory.put('/notes/547/', content, content_type=content_type)\n\n### Forcing authentication\n\nWhen testing views directly using a request factory, it's often convenient to be able to directly authenticate the request, rather than having to construct the correct authentication credentials.\n\nTo forcibly authenticate a request, use the `force_authenticate()` method.\n\n    from rest_framework.test import force_authenticate\n\n    factory = APIRequestFactory()\n    user = User.objects.get(username='olivia')\n    view = AccountDetail.as_view()\n\n    # Make an authenticated request to the view...\n    request = factory.get('/accounts/django-superstars/')\n    force_authenticate(request, user=user)\n    response = view(request)\n\nThe signature for the method is `force_authenticate(request, user=None, token=None)`.  When making the call, either or both of the user and token may be set.\n\nFor example, when forcibly authenticating using a token, you might do something like the following:\n\n    user = User.objects.get(username='olivia')\n    request = factory.get('/accounts/django-superstars/')\n    force_authenticate(request, user=user, token=user.auth_token)\n\n!!! note\n    `force_authenticate` directly sets `request.user` to the in-memory `user` instance. If you are reusing the same `user` instance across multiple tests that update the saved `user` state, you may need to call [`refresh_from_db()`][refresh_from_db_docs] between tests.\n\n!!! note\n    When using `APIRequestFactory`, the object that is returned is Django's standard `HttpRequest`, and not REST framework's `Request` object, which is only generated once the view is called.\n\n    This means that setting attributes directly on the request object may not always have the effect you expect.  For example, setting `.token` directly will have no effect, and setting `.user` directly will only work if session authentication is being used.\n    \n        # Request will only authenticate if `SessionAuthentication` is in use.\n        request = factory.get('/accounts/django-superstars/')\n        request.user = user\n        response = view(request)\n    \n    If you want to test a request involving the REST framework’s 'Request' object, you’ll need to manually transform it first:\n    \n        class DummyView(APIView):\n            ...\n    \n        factory = APIRequestFactory()\n        request = factory.get('/', {'demo': 'test'})\n        drf_request = DummyView().initialize_request(request)\n        assert drf_request.query_params == {'demo': ['test']}\n    \n        request = factory.post('/', {'example': 'test'})\n        drf_request = DummyView().initialize_request(request)\n        assert drf_request.data.get('example') == 'test'\n\n### Forcing CSRF validation\n\nBy default, requests created with `APIRequestFactory` will not have CSRF validation applied when passed to a REST framework view.  If you need to explicitly turn CSRF validation on, you can do so by setting the `enforce_csrf_checks` flag when instantiating the factory.\n\n    factory = APIRequestFactory(enforce_csrf_checks=True)\n\n!!! note\n    It's worth noting that Django's standard `RequestFactory` doesn't need to include this option, because when using regular Django the CSRF validation takes place in middleware, which is not run when testing views directly.  When using REST framework, CSRF validation takes place inside the view, so the request factory needs to disable view-level CSRF checks.\n\n## APIClient\n\nExtends [Django's existing `Client` class][client].\n\n### Making requests\n\nThe `APIClient` class supports the same request interface as Django's standard `Client` class.  This means that the standard `.get()`, `.post()`, `.put()`, `.patch()`, `.delete()`, `.head()` and `.options()` methods are all available.  For example:\n\n    from rest_framework.test import APIClient\n\n    client = APIClient()\n    client.post('/notes/', {'title': 'new idea'}, format='json')\n\nTo support a wider set of request formats, or change the default format, [see the configuration section][configuration].\n\n### Authenticating\n\n#### .login(**kwargs)\n\nThe `login` method functions exactly as it does with Django's regular `Client` class.  This allows you to authenticate requests against any views which include `SessionAuthentication`.\n\n    # Make all requests in the context of a logged in session.\n    client = APIClient()\n    client.login(username='lauren', password='secret')\n\nTo logout, call the `logout` method as usual.\n\n    # Log out\n    client.logout()\n\nThe `login` method is appropriate for testing APIs that use session authentication, for example web sites which include AJAX interaction with the API.\n\n#### .credentials(**kwargs)\n\nThe `credentials` method can be used to set headers that will then be included on all subsequent requests by the test client.\n\n    from rest_framework.authtoken.models import Token\n    from rest_framework.test import APIClient\n\n    # Include an appropriate `Authorization:` header on all requests.\n    token = Token.objects.get(user__username='lauren')\n    client = APIClient()\n    client.credentials(HTTP_AUTHORIZATION='Token ' + token.key)\n\nNote that calling `credentials` a second time overwrites any existing credentials.  You can unset any existing credentials by calling the method with no arguments.\n\n    # Stop including any credentials\n    client.credentials()\n\nThe `credentials` method is appropriate for testing APIs that require authentication headers, such as basic authentication, OAuth1a and OAuth2 authentication, and simple token authentication schemes.\n\n#### .force_authenticate(user=None, token=None)\n\nSometimes you may want to bypass authentication entirely and force all requests by the test client to be automatically treated as authenticated.\n\nThis can be a useful shortcut if you're testing the API but don't want to have to construct valid authentication credentials in order to make test requests.\n\n    user = User.objects.get(username='lauren')\n    client = APIClient()\n    client.force_authenticate(user=user)\n\nTo unauthenticate subsequent requests, call `force_authenticate` setting the user and/or token to `None`.\n\n    client.force_authenticate(user=None)\n\n### CSRF validation\n\nBy default CSRF validation is not applied when using `APIClient`.  If you need to explicitly enable CSRF validation, you can do so by setting the `enforce_csrf_checks` flag when instantiating the client.\n\n    client = APIClient(enforce_csrf_checks=True)\n\nAs usual CSRF validation will only apply to any session authenticated views.  This means CSRF validation will only occur if the client has been logged in by calling `login()`.\n\n---\n\n## RequestsClient\n\nREST framework also includes a client for interacting with your application\nusing the popular Python library, `requests`. This may be useful if:\n\n* You are expecting to interface with the API primarily from another Python service,\nand want to test the service at the same level as the client will see.\n* You want to write tests in such a way that they can also be run against a staging or\nlive environment. (See \"Live tests\" below.)\n\nThis exposes exactly the same interface as if you were using a requests session\ndirectly.\n\n    from rest_framework.test import RequestsClient\n    \n    client = RequestsClient()\n    response = client.get('http://testserver/users/')\n    assert response.status_code == 200\n\nNote that the requests client requires you to pass fully qualified URLs.\n\n### RequestsClient and working with the database\n\nThe `RequestsClient` class is useful if you want to write tests that solely interact with the service interface. This is a little stricter than using the standard Django test client, as it means that all interactions should be via the API.\n\nIf you're using `RequestsClient` you'll want to ensure that test setup, and results assertions are performed as regular API calls, rather than interacting with the database models directly. For example, rather than checking that `Customer.objects.count() == 3` you would list the customers endpoint, and ensure that it contains three records.\n\n### Headers & Authentication\n\nCustom headers and authentication credentials can be provided in the same way\nas [when using a standard `requests.Session` instance][session_objects].\n\n    from requests.auth import HTTPBasicAuth\n\n    client.auth = HTTPBasicAuth('user', 'pass')\n    client.headers.update({'x-test': 'true'})\n\n### CSRF\n\nIf you're using `SessionAuthentication` then you'll need to include a CSRF token\nfor any `POST`, `PUT`, `PATCH` or `DELETE` requests.\n\nYou can do so by following the same flow that a JavaScript based client would use.\nFirst, make a `GET` request in order to obtain a CSRF token, then present that\ntoken in the following request.\n\nFor example...\n\n    client = RequestsClient()\n\n    # Obtain a CSRF token.\n    response = client.get('http://testserver/homepage/')\n    assert response.status_code == 200\n    csrftoken = response.cookies['csrftoken']\n\n    # Interact with the API.\n    response = client.post('http://testserver/organizations/', json={\n        'name': 'MegaCorp',\n        'status': 'active'\n    }, headers={'X-CSRFToken': csrftoken})\n    assert response.status_code == 200\n\n### Live tests\n\nWith careful usage the `RequestsClient` provides the ability to write tests\nthat exercise your API views in a more end-to-end fashion than `APIClient`,\nwhile still running entirely in-process against your local Django application.\n\nNote that `RequestsClient` mounts a WSGI adapter and does not perform real\nnetwork I/O. It cannot be used to send HTTP requests to remote services such\nas staging or production servers. For live tests against a deployed service,\nyou should instead use a plain `requests.Session` (or similar HTTP client)\nconfigured with the appropriate base URL and authentication.\nUsing this style to create basic tests of a few core pieces of functionality is\na powerful way to validate your live service. Doing so may require some careful\nattention to setup and teardown to ensure that the tests run in a way that they\ndo not directly affect customer data.\n\n---\n\n## API Test cases\n\nREST framework includes the following test case classes, that mirror the existing [Django's test case classes][provided_test_case_classes], but use `APIClient` instead of Django's default `Client`.\n\n* `APISimpleTestCase`\n* `APITransactionTestCase`\n* `APITestCase`\n* `APILiveServerTestCase`\n\n### Example\n\nYou can use any of REST framework's test case classes as you would for the regular Django test case classes.  The `self.client` attribute will be an `APIClient` instance.\n\n    from django.urls import reverse\n    from rest_framework import status\n    from rest_framework.test import APITestCase\n    from myproject.apps.core.models import Account\n\n    class AccountTests(APITestCase):\n        def test_create_account(self):\n            \"\"\"\n            Ensure we can create a new account object.\n            \"\"\"\n            url = reverse('account-list')\n            data = {'name': 'DabApps'}\n            response = self.client.post(url, data, format='json')\n            self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n            self.assertEqual(Account.objects.count(), 1)\n            self.assertEqual(Account.objects.get().name, 'DabApps')\n\n---\n\n## URLPatternsTestCase\n\nREST framework also provides a test case class for isolating `urlpatterns` on a per-class basis. Note that this inherits from Django's `SimpleTestCase`, and will most likely need to be mixed with another test case class.\n\n### Example\n\n    from django.urls import include, path, reverse\n    from rest_framework import status\n    from rest_framework.test import APITestCase, URLPatternsTestCase\n\n\n    class AccountTests(APITestCase, URLPatternsTestCase):\n        urlpatterns = [\n            path('api/', include('api.urls')),\n        ]\n\n        def test_create_account(self):\n            \"\"\"\n            Ensure we can create a new account object.\n            \"\"\"\n            url = reverse('account-list')\n            response = self.client.get(url, format='json')\n            self.assertEqual(response.status_code, status.HTTP_200_OK)\n            self.assertEqual(len(response.data), 1)\n\n---\n\n## Testing responses\n\n### Checking the response data\n\nWhen checking the validity of test responses it's often more convenient to inspect the data that the response was created with, rather than inspecting the fully rendered response.\n\nFor example, it's easier to inspect `response.data`:\n\n    response = self.client.get('/users/4/')\n    self.assertEqual(response.data, {'id': 4, 'username': 'lauren'})\n\nInstead of inspecting the result of parsing `response.content`:\n\n    response = self.client.get('/users/4/')\n    self.assertEqual(json.loads(response.content), {'id': 4, 'username': 'lauren'})\n\n### Rendering responses\n\nIf you're testing views directly using `APIRequestFactory`, the responses that are returned will not yet be rendered, as rendering of template responses is performed by Django's internal request-response cycle.  In order to access `response.content`, you'll first need to render the response.\n\n    view = UserDetail.as_view()\n    request = factory.get('/users/4')\n    response = view(request, pk='4')\n    response.render()  # Cannot access `response.content` without this.\n    self.assertEqual(response.content, '{\"username\": \"lauren\", \"id\": 4}')\n\n---\n\n## Configuration\n\n### Setting the default format\n\nThe default format used to make test requests may be set using the `TEST_REQUEST_DEFAULT_FORMAT` setting key.  For example, to always use JSON for test requests by default instead of standard multipart form requests, set the following in your `settings.py` file:\n\n    REST_FRAMEWORK = {\n        ...\n        'TEST_REQUEST_DEFAULT_FORMAT': 'json'\n    }\n\n### Setting the available formats\n\nIf you need to test requests using something other than multipart or json requests, you can do so by setting the `TEST_REQUEST_RENDERER_CLASSES` setting.\n\nFor example, to add support for using `format='html'` in test requests, you might have something like this in your `settings.py` file.\n\n    REST_FRAMEWORK = {\n        ...\n        'TEST_REQUEST_RENDERER_CLASSES': [\n            'rest_framework.renderers.MultiPartRenderer',\n            'rest_framework.renderers.JSONRenderer',\n            'rest_framework.renderers.TemplateHTMLRenderer'\n        ]\n    }\n\n[cite]: https://jacobian.org/writing/django-apps-with-buildout/#s-create-a-test-wrapper\n[client]: https://docs.djangoproject.com/en/stable/topics/testing/tools/#the-test-client\n[requestfactory]: https://docs.djangoproject.com/en/stable/topics/testing/advanced/#django.test.client.RequestFactory\n[configuration]: #configuration\n[refresh_from_db_docs]: https://docs.djangoproject.com/en/stable/ref/models/instances/#django.db.models.Model.refresh_from_db\n[session_objects]: https://requests.readthedocs.io/en/latest/user/advanced/#session-objects\n[provided_test_case_classes]: https://docs.djangoproject.com/en/stable/topics/testing/tools/#provided-test-case-classes\n"
  },
  {
    "path": "docs/api-guide/throttling.md",
    "content": "---\nsource:\n    - throttling.py\n---\n\n# Throttling\n\n> HTTP/1.1 420 Enhance Your Calm\n>\n> [Twitter API rate limiting response][cite]\n\nThrottling is similar to [permissions], in that it determines if a request should be authorized.  Throttles indicate a temporary state, and are used to control the rate of requests that clients can make to an API.\n\nAs with permissions, multiple throttles may be used.  Your API might have a restrictive throttle for unauthenticated requests, and a less restrictive throttle for authenticated requests.\n\nAnother scenario where you might want to use multiple throttles would be if you need to impose different constraints on different parts of the API, due to some services being particularly resource-intensive.\n\nMultiple throttles can also be used if you want to impose both burst throttling rates, and sustained throttling rates.  For example, you might want to limit a user to a maximum of 60 requests per minute, and 1000 requests per day.\n\nThrottles do not necessarily only refer to rate-limiting requests.  For example a storage service might also need to throttle against bandwidth, and a paid data service might want to throttle against a certain number of a records being accessed.\n\n**The application-level throttling that REST framework provides should not be considered a security measure or protection against brute forcing or denial-of-service attacks. Deliberately malicious actors will always be able to spoof IP origins. In addition to this, the built-in throttling implementations are implemented using Django's cache framework, and use non-atomic operations to determine the request rate, which may sometimes result in some fuzziness.**\n\n**The application-level throttling provided by REST framework is intended for implementing policies such as different business tiers and basic protections against service over-use.**\n\n## How throttling is determined\n\nAs with permissions and authentication, throttling in REST framework is always defined as a list of classes.\n\nBefore running the main body of the view each throttle in the list is checked.\nIf any throttle check fails an `exceptions.Throttled` exception will be raised, and the main body of the view will not run.\n\n## Setting the throttling policy\n\nThe default throttling policy may be set globally, using the `DEFAULT_THROTTLE_CLASSES` and `DEFAULT_THROTTLE_RATES` settings.  For example.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_THROTTLE_CLASSES': [\n            'rest_framework.throttling.AnonRateThrottle',\n            'rest_framework.throttling.UserRateThrottle'\n        ],\n        'DEFAULT_THROTTLE_RATES': {\n            'anon': '100/day',\n            'user': '1000/day'\n        }\n    }\n\nThe rates used in `DEFAULT_THROTTLE_RATES` can be specified over a period of second, minute, hour or day. The period must be specified after the `/` separator using `s`, `m`, `h` or `d`, respectively. For increased clarity, extended units such as `second`, `minute`, `hour`, `day` or even abbreviations like `sec`, `min`, `hr` are allowed, as only the first character is relevant to identify the rate.\n\nYou can also set the throttling policy on a per-view or per-viewset basis,\nusing the `APIView` class-based views.\n\n    from rest_framework.response import Response\n    from rest_framework.throttling import UserRateThrottle\n    from rest_framework.views import APIView\n\n    class ExampleView(APIView):\n        throttle_classes = [UserRateThrottle]\n\n        def get(self, request, format=None):\n            content = {\n                'status': 'request was permitted'\n            }\n            return Response(content)\n\nIf you're using the `@api_view` decorator with function based views you can use the following decorator.\n\n    @api_view(['GET'])\n    @throttle_classes([UserRateThrottle])\n    def example_view(request, format=None):\n        content = {\n            'status': 'request was permitted'\n        }\n        return Response(content)\n\nIt's also possible to set throttle classes for routes that are created using the `@action` decorator.\nThrottle classes set in this way will override any viewset level class settings.\n\n    @action(detail=True, methods=[\"post\"], throttle_classes=[UserRateThrottle])\n    def example_adhoc_method(request, pk=None):\n        content = {\n            'status': 'request was permitted'\n        }\n        return Response(content)\n\n## How clients are identified\n\nThe `X-Forwarded-For` HTTP header and `REMOTE_ADDR` WSGI variable are used to uniquely identify client IP addresses for throttling.  If the `X-Forwarded-For` header is present then it will be used, otherwise the value of the `REMOTE_ADDR` variable from the WSGI environment will be used.\n\nIf you need to strictly identify unique client IP addresses, you'll need to first configure the number of application proxies that the API runs behind by setting the `NUM_PROXIES` setting.  This setting should be an integer of zero or more.  If set to non-zero then the client IP will be identified as being the last IP address in the `X-Forwarded-For` header, once any application proxy IP addresses have first been excluded.  If set to zero, then the `REMOTE_ADDR` value will always be used as the identifying IP address.\n\nIt is important to understand that if you configure the `NUM_PROXIES` setting, then all clients behind a unique [NAT'd](https://en.wikipedia.org/wiki/Network_address_translation) gateway will be treated as a single client.\n\nFurther context on how the `X-Forwarded-For` header works, and identifying a remote client IP can be [found here][identifying-clients].\n\n## Setting up the cache\n\nThe throttle classes provided by REST framework use Django's cache backend.  You should make sure that you've set appropriate [cache settings][cache-setting].  The default value of `LocMemCache` backend should be okay for simple setups.  See Django's [cache documentation][cache-docs] for more details.\n\nIf you need to use a cache other than `'default'`, you can do so by creating a custom throttle class and setting the `cache` attribute.  For example:\n\n    from django.core.cache import caches\n\n    class CustomAnonRateThrottle(AnonRateThrottle):\n        cache = caches['alternate']\n\nYou'll need to remember to also set your custom throttle class in the `'DEFAULT_THROTTLE_CLASSES'` settings key, or using the `throttle_classes` view attribute.\n\n## A note on concurrency\n\nThe built-in throttle implementations are open to [race conditions][race], so under high concurrency they may allow a few extra requests through.\n\nIf your project relies on guaranteeing the number of requests during concurrent requests, you will need to implement your own throttle class. See [issue #5181][gh5181] for more details.\n\n---\n\n## API Reference\n\n### AnonRateThrottle\n\nThe `AnonRateThrottle` will only ever throttle unauthenticated users.  The IP address of the incoming request is used to generate a unique key to throttle against.\n\nThe allowed request rate is determined from one of the following (in order of preference).\n\n* The `rate` property on the class, which may be provided by overriding `AnonRateThrottle` and setting the property.\n* The `DEFAULT_THROTTLE_RATES['anon']` setting.\n\n`AnonRateThrottle` is suitable if you want to restrict the rate of requests from unknown sources.\n\n### UserRateThrottle\n\nThe `UserRateThrottle` will throttle users to a given rate of requests across the API.  The user id is used to generate a unique key to throttle against.  Unauthenticated requests will fall back to using the IP address of the incoming request to generate a unique key to throttle against.\n\nThe allowed request rate is determined from one of the following (in order of preference).\n\n* The `rate` property on the class, which may be provided by overriding `UserRateThrottle` and setting the property.\n* The `DEFAULT_THROTTLE_RATES['user']` setting.\n\nAn API may have multiple `UserRateThrottles` in place at the same time.  To do so, override `UserRateThrottle` and set a unique \"scope\" for each class.\n\nFor example, multiple user throttle rates could be implemented by using the following classes...\n\n    class BurstRateThrottle(UserRateThrottle):\n        scope = 'burst'\n\n    class SustainedRateThrottle(UserRateThrottle):\n        scope = 'sustained'\n\n...and the following settings.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_THROTTLE_CLASSES': [\n            'example.throttles.BurstRateThrottle',\n            'example.throttles.SustainedRateThrottle'\n        ],\n        'DEFAULT_THROTTLE_RATES': {\n            'burst': '60/min',\n            'sustained': '1000/day'\n        }\n    }\n\n`UserRateThrottle` is suitable if you want simple global rate restrictions per-user.\n\n### ScopedRateThrottle\n\nThe `ScopedRateThrottle` class can be used to restrict access to specific parts of the API.  This throttle will only be applied if the view that is being accessed includes a `.throttle_scope` property.  The unique throttle key will then be formed by concatenating the \"scope\" of the request with the unique user id or IP address.\n\nThe allowed request rate is determined by the `DEFAULT_THROTTLE_RATES` setting using a key from the request \"scope\".\n\nFor example, given the following views...\n\n    class ContactListView(APIView):\n        throttle_scope = 'contacts'\n        ...\n\n    class ContactDetailView(APIView):\n        throttle_scope = 'contacts'\n        ...\n\n    class UploadView(APIView):\n        throttle_scope = 'uploads'\n        ...\n\n...and the following settings.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_THROTTLE_CLASSES': [\n            'rest_framework.throttling.ScopedRateThrottle',\n        ],\n        'DEFAULT_THROTTLE_RATES': {\n            'contacts': '1000/day',\n            'uploads': '20/day'\n        }\n    }\n\nUser requests to either `ContactListView` or `ContactDetailView` would be restricted to a total of 1000 requests per-day.  User requests to `UploadView` would be restricted to 20 requests per day.\n\n---\n\n## Custom throttles\n\nTo create a custom throttle, override `BaseThrottle` and implement `.allow_request(self, request, view)`.  The method should return `True` if the request should be allowed, and `False` otherwise.\n\nOptionally you may also override the `.wait()` method.  If implemented, `.wait()` should return a recommended number of seconds to wait before attempting the next request, or `None`.  The `.wait()` method will only be called if `.allow_request()` has previously returned `False`.\n\nIf the `.wait()` method is implemented and the request is throttled, then a `Retry-After` header will be included in the response.\n\n### Example\n\nThe following is an example of a rate throttle, that will randomly throttle 1 in every 10 requests.\n\n    import random\n\n    class RandomRateThrottle(throttling.BaseThrottle):\n        def allow_request(self, request, view):\n            return random.randint(1, 10) != 1\n\n[cite]: https://developer.twitter.com/en/docs/basics/rate-limiting\n[permissions]: permissions.md\n[identifying-clients]: http://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#Multiple_Proxies_in_front_of_the_cluster\n[cache-setting]: https://docs.djangoproject.com/en/stable/ref/settings/#caches\n[cache-docs]: https://docs.djangoproject.com/en/stable/topics/cache/#setting-up-the-cache\n[gh5181]: https://github.com/encode/django-rest-framework/issues/5181\n[race]: https://en.wikipedia.org/wiki/Race_condition#Data_race\n"
  },
  {
    "path": "docs/api-guide/validators.md",
    "content": "---\nsource:\n    - validators.py\n---\n\n# Validators\n\n> Validators can be useful for reusing validation logic between different types of fields.\n>\n> &mdash; [Django documentation][cite]\n\nMost of the time you're dealing with validation in REST framework you'll simply be relying on the default field validation, or writing explicit validation methods on serializer or field classes.\n\nHowever, sometimes you'll want to place your validation logic into reusable components, so that it can easily be reused throughout your codebase. This can be achieved by using validator functions and validator classes.\n\n## Validation in REST framework\n\nValidation in Django REST framework serializers is handled a little differently to how validation works in Django's `ModelForm` class.\n\nWith `ModelForm` the validation is performed partially on the form, and partially on the model instance. With REST framework the validation is performed entirely on the serializer class. This is advantageous for the following reasons:\n\n* It introduces a proper separation of concerns, making your code behavior more obvious.\n* It is easy to switch between using shortcut `ModelSerializer` classes and using explicit `Serializer` classes. Any validation behavior being used for `ModelSerializer` is simple to replicate.\n* Printing the `repr` of a serializer instance will show you exactly what validation rules it applies. There's no extra hidden validation behavior being called on the model instance.\n\nWhen you're using `ModelSerializer` all of this is handled automatically for you. If you want to drop down to using `Serializer` classes instead, then you need to define the validation rules explicitly.\n\n### Example\n\nAs an example of how REST framework uses explicit validation, we'll take a simple model class that has a field with a uniqueness constraint.\n\n    class CustomerReportRecord(models.Model):\n        time_raised = models.DateTimeField(default=timezone.now, editable=False)\n        reference = models.CharField(unique=True, max_length=20)\n        description = models.TextField()\n\nHere's a basic `ModelSerializer` that we can use for creating or updating instances of `CustomerReportRecord`:\n\n    class CustomerReportSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = CustomerReportRecord\n\nIf we open up the Django shell using `manage.py shell` we can now\n\n    >>> from project.example.serializers import CustomerReportSerializer\n    >>> serializer = CustomerReportSerializer()\n    >>> print(repr(serializer))\n    CustomerReportSerializer():\n        id = IntegerField(label='ID', read_only=True)\n        time_raised = DateTimeField(read_only=True)\n        reference = CharField(max_length=20, validators=[UniqueValidator(queryset=CustomerReportRecord.objects.all())])\n        description = CharField(style={'type': 'textarea'})\n\nThe interesting bit here is the `reference` field. We can see that the uniqueness constraint is being explicitly enforced by a validator on the serializer field.\n\nBecause of this more explicit style REST framework includes a few validator classes that are not available in core Django. These classes are detailed below.  REST framework validators, like their Django counterparts, implement the `__eq__` method, allowing you to compare instances for equality.\n\n---\n\n## UniqueValidator\n\nThis validator can be used to enforce the `unique=True` constraint on model fields.\nIt takes a single required argument, and an optional `messages` argument:\n\n* `queryset` *required* - This is the queryset against which uniqueness should be enforced.\n* `message` - The error message that should be used when validation fails.\n* `lookup` - The lookup used to find an existing instance with the value being validated. Defaults to `'exact'`.\n\nThis validator should be applied to *serializer fields*, like so:\n\n    from rest_framework.validators import UniqueValidator\n\n    slug = SlugField(\n        max_length=100,\n        validators=[UniqueValidator(queryset=BlogPost.objects.all())]\n    )\n\n## UniqueTogetherValidator\n\nThis validator can be used to enforce `unique_together` constraints on model instances.\nIt has two required arguments, and a single optional `messages` argument:\n\n* `queryset` *required* - This is the queryset against which uniqueness should be enforced.\n* `fields` *required* - A list or tuple of field names which should make a unique set. These must exist as fields on the serializer class.\n* `message` - The error message that should be used when validation fails.\n\nThe validator should be applied to *serializer classes*, like so:\n\n    from rest_framework.validators import UniqueTogetherValidator\n\n    class ExampleSerializer(serializers.Serializer):\n        # ...\n        class Meta:\n            # ToDo items belong to a parent list, and have an ordering defined\n            # by the 'position' field. No two items in a given list may share\n            # the same position.\n            validators = [\n                UniqueTogetherValidator(\n                    queryset=ToDoItem.objects.all(),\n                    fields=['list', 'position']\n                )\n            ]\n\n!!! note\n    The `UniqueTogetherValidator` class always imposes an implicit constraint that all the fields it applies to are always treated as required. Fields with `default` values are an exception to this as they always supply a value even when omitted from user input.\n\n## UniqueForDateValidator\n\n## UniqueForMonthValidator\n\n## UniqueForYearValidator\n\nThese validators can be used to enforce the `unique_for_date`, `unique_for_month` and `unique_for_year` constraints on model instances. They take the following arguments:\n\n* `queryset` *required* - This is the queryset against which uniqueness should be enforced.\n* `field` *required* - A field name against which uniqueness in the given date range will be validated. This must exist as a field on the serializer class.\n* `date_field` *required* - A field name which will be used to determine date range for the uniqueness constrain. This must exist as a field on the serializer class.\n* `message` - The error message that should be used when validation fails.\n\nThe validator should be applied to *serializer classes*, like so:\n\n    from rest_framework.validators import UniqueForYearValidator\n\n    class ExampleSerializer(serializers.Serializer):\n        # ...\n        class Meta:\n            # Blog posts should have a slug that is unique for the current year.\n            validators = [\n                UniqueForYearValidator(\n                    queryset=BlogPostItem.objects.all(),\n                    field='slug',\n                    date_field='published'\n                )\n            ]\n\nThe date field that is used for the validation is always required to be present on the serializer class. You can't simply rely on a model class `default=...`, because the value being used for the default wouldn't be generated until after the validation has run.\n\nThere are a couple of styles you may want to use for this depending on how you want your API to behave. If you're using `ModelSerializer` you'll probably simply rely on the defaults that REST framework generates for you, but if you are using `Serializer` or simply want more explicit control, use on of the styles demonstrated below.\n\n### Using with a writable date field.\n\nIf you want the date field to be writable the only thing worth noting is that you should ensure that it is always available in the input data, either by setting a `default` argument, or by setting `required=True`.\n\n    published = serializers.DateTimeField(required=True)\n\n### Using with a read-only date field.\n\nIf you want the date field to be visible, but not editable by the user, then set `read_only=True` and additionally set a `default=...` argument.\n\n    published = serializers.DateTimeField(read_only=True, default=timezone.now)\n\n### Using with a hidden date field.\n\nIf you want the date field to be entirely hidden from the user, then use `HiddenField`. This field type does not accept user input, but instead always returns its default value to the `validated_data` in the serializer.\n\n    published = serializers.HiddenField(default=timezone.now)\n\n!!! note\n    The `UniqueFor<Range>Validator` classes impose an implicit constraint that the fields they are applied to are always treated as required. Fields with `default` values are an exception to this as they always supply a value even when omitted from user input.\n\n!!! note\n    `HiddenField()` does not appear in `partial=True` serializer (when making `PATCH` request). \n\n## Advanced field defaults\n\nValidators that are applied across multiple fields in the serializer can sometimes require a field input that should not be provided by the API client, but that *is* available as input to the validator.\nFor this purposes use `HiddenField`. This field will be present in `validated_data` but *will not* be used in the serializer output representation.\n\n!!! note\n    Using a `read_only=True` field is excluded from writable fields so it won't use a `default=…` argument. Look [3.8 announcement](https://www.django-rest-framework.org/community/3.8-announcement/#altered-the-behavior-of-read_only-plus-default-on-field).\n\nREST framework includes a couple of defaults that may be useful in this context.\n\n### CurrentUserDefault\n\nA default class that can be used to represent the current user. In order to use this, the 'request' must have been provided as part of the context dictionary when instantiating the serializer.\n\n    owner = serializers.HiddenField(\n        default=serializers.CurrentUserDefault()\n    )\n\n### CreateOnlyDefault\n\nA default class that can be used to *only set a default argument during create operations*. During updates the field is omitted.\n\nIt takes a single argument, which is the default value or callable that should be used during create operations.\n\n    created_at = serializers.DateTimeField(\n        default=serializers.CreateOnlyDefault(timezone.now)\n    )\n\n---\n\n## Limitations of validators\n\nThere are some ambiguous cases where you'll need to instead handle validation\nexplicitly, rather than relying on the default serializer classes that\n`ModelSerializer` generates.\n\nIn these cases you may want to disable the automatically generated validators,\nby specifying an empty list for the serializer `Meta.validators` attribute.\n\n### Optional fields\n\nBy default \"unique together\" validation enforces that all fields be\n`required=True`. In some cases, you might want to explicit apply\n`required=False` to one of the fields, in which case the desired behavior\nof the validation is ambiguous.\n\nIn this case you will typically need to exclude the validator from the\nserializer class, and instead write any validation logic explicitly, either\nin the `.validate()` method, or else in the view.\n\nFor example:\n\n    class BillingRecordSerializer(serializers.ModelSerializer):\n        def validate(self, attrs):\n            # Apply custom validation either here, or in the view.\n\n        class Meta:\n            fields = ['client', 'date', 'amount']\n            extra_kwargs = {'client': {'required': False}}\n            validators = []  # Remove a default \"unique together\" constraint.\n\n### Updating nested serializers\n\nWhen applying an update to an existing instance, uniqueness validators will\nexclude the current instance from the uniqueness check. The current instance\nis available in the context of the uniqueness check, because it exists as\nan attribute on the serializer, having initially been passed using\n`instance=...` when instantiating the serializer.\n\nIn the case of update operations on *nested* serializers there's no way of\napplying this exclusion, because the instance is not available.\n\nAgain, you'll probably want to explicitly remove the validator from the\nserializer class, and write the code for the validation constraint\nexplicitly, in a `.validate()` method, or in the view.\n\n### Debugging complex cases\n\nIf you're not sure exactly what behavior a `ModelSerializer` class will\ngenerate it is usually a good idea to run `manage.py shell`, and print\nan instance of the serializer, so that you can inspect the fields and\nvalidators that it automatically generates for you.\n\n    >>> serializer = MyComplexModelSerializer()\n    >>> print(serializer)\n    class MyComplexModelSerializer:\n        my_fields = ...\n\nAlso keep in mind that with complex cases it can often be better to explicitly\ndefine your serializer classes, rather than relying on the default\n`ModelSerializer` behavior. This involves a little more code, but ensures\nthat the resulting behavior is more transparent.\n\n---\n\n## Writing custom validators\n\nYou can use any of Django's existing validators, or write your own custom validators.\n\n### Function based\n\nA validator may be any callable that raises a `serializers.ValidationError` on failure.\n\n    def even_number(value):\n        if value % 2 != 0:\n            raise serializers.ValidationError('This field must be an even number.')\n\n#### Field-level validation\n\nYou can specify custom field-level validation by adding `.validate_<field_name>` methods\nto your `Serializer` subclass. This is documented in the\n[Serializer docs](https://www.django-rest-framework.org/api-guide/serializers/#field-level-validation)\n\n### Class-based\n\nTo write a class-based validator, use the `__call__` method. Class-based validators are useful as they allow you to parameterize and reuse behavior.\n\n    class MultipleOf:\n        def __init__(self, base):\n            self.base = base\n\n        def __call__(self, value):\n            if value % self.base != 0:\n                message = 'This field must be a multiple of %d.' % self.base\n                raise serializers.ValidationError(message)\n\n#### Accessing the context\n\nIn some advanced cases you might want a validator to be passed the serializer\nfield it is being used with as additional context. You can do so by setting\na `requires_context = True` attribute on the validator class. The `__call__` method\nwill then be called with the `serializer_field`\nor `serializer` as an additional argument.\n\n    class MultipleOf:\n        requires_context = True\n\n        def __call__(self, value, serializer_field):\n            ...\n\n[cite]: https://docs.djangoproject.com/en/stable/ref/validators/\n"
  },
  {
    "path": "docs/api-guide/versioning.md",
    "content": "---\nsource:\n    - versioning.py\n---\n\n# Versioning\n\n> Versioning an interface is just a \"polite\" way to kill deployed clients.\n>\n> &mdash; [Roy Fielding][cite].\n\nAPI versioning allows you to alter behavior between different clients. REST framework provides for a number of different versioning schemes.\n\nVersioning is determined by the incoming client request, and may either be based on the request URL, or based on the request headers.\n\nThere are a number of valid approaches to approaching versioning. [Non-versioned systems can also be appropriate][roy-fielding-on-versioning], particularly if you're engineering for very long-term systems with multiple clients outside of your control.\n\n## Versioning with REST framework\n\nWhen API versioning is enabled, the `request.version` attribute will contain a string that corresponds to the version requested in the incoming client request.\n\nBy default, versioning is not enabled, and `request.version` will always return `None`.\n\n### Varying behavior based on the version\n\nHow you vary the API behavior is up to you, but one example you might typically want is to switch to a different serialization style in a newer version. For example:\n\n    def get_serializer_class(self):\n        if self.request.version == 'v1':\n            return AccountSerializerVersion1\n        return AccountSerializer\n\n### Reversing URLs for versioned APIs\n\nThe `reverse` function included by REST framework ties in with the versioning scheme. You need to make sure to include the current `request` as a keyword argument, like so.\n\n    from rest_framework.reverse import reverse\n\n    reverse('bookings-list', request=request)\n\nThe above function will apply any URL transformations appropriate to the request version. For example:\n\n* If `NamespaceVersioning` was being used, and the API version was 'v1', then the URL lookup used would be `'v1:bookings-list'`, which might resolve to a URL like `http://example.org/v1/bookings/`.\n* If `QueryParameterVersioning` was being used, and the API version was `1.0`, then the returned URL might be something like `http://example.org/bookings/?version=1.0`\n\n### Versioned APIs and hyperlinked serializers\n\nWhen using hyperlinked serialization styles together with a URL based versioning scheme make sure to include the request as context to the serializer.\n\n    def get(self, request):\n        queryset = Booking.objects.all()\n        serializer = BookingsSerializer(queryset, many=True, context={'request': request})\n        return Response({'all_bookings': serializer.data})\n\nDoing so will allow any returned URLs to include the appropriate versioning.\n\n## Configuring the versioning scheme\n\nThe versioning scheme is defined by the `DEFAULT_VERSIONING_CLASS` settings key.\n\n    REST_FRAMEWORK = {\n        'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.NamespaceVersioning'\n    }\n\nUnless it is explicitly set, the value for `DEFAULT_VERSIONING_CLASS` will be `None`. In this case the `request.version` attribute will always return `None`.\n\nYou can also set the versioning scheme on an individual view. Typically you won't need to do this, as it makes more sense to have a single versioning scheme used globally. If you do need to do so, use the `versioning_class` attribute.\n\n    class ProfileList(APIView):\n        versioning_class = versioning.QueryParameterVersioning\n\n### Other versioning settings\n\nThe following settings keys are also used to control versioning:\n\n* `DEFAULT_VERSION`. The value that should be used for `request.version` when no versioning information is present. Defaults to `None`.\n* `ALLOWED_VERSIONS`. If set, this value will restrict the set of versions that may be returned by the versioning scheme, and will raise an error if the provided version is not in this set. Note that the value used for the `DEFAULT_VERSION` setting is always considered to be part of the `ALLOWED_VERSIONS` set (unless it is `None`). Defaults to `None`.\n* `VERSION_PARAM`. The string that should be used for any versioning parameters, such as in the media type or URL query parameters. Defaults to `'version'`.\n\nYou can also set your versioning class plus those three values on a per-view or a per-viewset basis by defining your own versioning scheme and using the `default_version`, `allowed_versions` and `version_param` class variables. For example, if you want to use `URLPathVersioning`:\n\n    from rest_framework.versioning import URLPathVersioning\n    from rest_framework.views import APIView\n\n    class ExampleVersioning(URLPathVersioning):\n        default_version = ...\n        allowed_versions = ...\n        version_param = ...\n\n    class ExampleView(APIVIew):\n        versioning_class = ExampleVersioning\n\n---\n\n## API Reference\n\n### AcceptHeaderVersioning\n\nThis scheme requires the client to specify the version as part of the media type in the `Accept` header. The version is included as a media type parameter, that supplements the main media type.\n\nHere's an example HTTP request using the accept header versioning style.\n\n    GET /bookings/ HTTP/1.1\n    Host: example.com\n    Accept: application/json; version=1.0\n\nIn the example request above `request.version` attribute would return the string `'1.0'`.\n\nVersioning based on accept headers is [generally considered][klabnik-guidelines] as [best practice][heroku-guidelines], although other styles may be suitable depending on your client requirements.\n\n#### Using accept headers with vendor media types\n\nStrictly speaking the `json` media type is not specified as [including additional parameters][json-parameters]. If you are building a well-specified public API you might consider using a [vendor media type][vendor-media-type]. To do so, configure your renderers to use a JSON based renderer with a custom media type:\n\n    class BookingsAPIRenderer(JSONRenderer):\n        media_type = 'application/vnd.megacorp.bookings+json'\n\nYour client requests would now look like this:\n\n    GET /bookings/ HTTP/1.1\n    Host: example.com\n    Accept: application/vnd.megacorp.bookings+json; version=1.0\n\n### URLPathVersioning\n\nThis scheme requires the client to specify the version as part of the URL path.\n\n    GET /v1/bookings/ HTTP/1.1\n    Host: example.com\n    Accept: application/json\n\nYour URL conf must include a pattern that matches the version with a `'version'` keyword argument, so that this information is available to the versioning scheme.\n\n    urlpatterns = [\n        re_path(\n            r'^(?P<version>(v1|v2))/bookings/$',\n            bookings_list,\n            name='bookings-list'\n        ),\n        re_path(\n            r'^(?P<version>(v1|v2))/bookings/(?P<pk>[0-9]+)/$',\n            bookings_detail,\n            name='bookings-detail'\n        )\n    ]\n\n### NamespaceVersioning\n\nTo the client, this scheme is the same as `URLPathVersioning`. The only difference is how it is configured in your Django application, as it uses URL namespacing, instead of URL keyword arguments.\n\n    GET /v1/something/ HTTP/1.1\n    Host: example.com\n    Accept: application/json\n\nWith this scheme the `request.version` attribute is determined based on the `namespace` that matches the incoming request path.\n\nIn the following example we're giving a set of views two different possible URL prefixes, each under a different namespace:\n\n    # bookings/urls.py\n    urlpatterns = [\n        re_path(r'^$', bookings_list, name='bookings-list'),\n        re_path(r'^(?P<pk>[0-9]+)/$', bookings_detail, name='bookings-detail')\n    ]\n\n    # urls.py\n    urlpatterns = [\n        re_path(r'^v1/bookings/', include('bookings.urls', namespace='v1')),\n        re_path(r'^v2/bookings/', include('bookings.urls', namespace='v2'))\n    ]\n\nBoth `URLPathVersioning` and `NamespaceVersioning` are reasonable if you just need a simple versioning scheme. The `URLPathVersioning` approach might be better suitable for small ad-hoc projects, and the `NamespaceVersioning` is probably easier to manage for larger projects.\n\n### HostNameVersioning\n\nThe hostname versioning scheme requires the client to specify the requested version as part of the hostname in the URL.\n\nFor example the following is an HTTP request to the `http://v1.example.com/bookings/` URL:\n\n    GET /bookings/ HTTP/1.1\n    Host: v1.example.com\n    Accept: application/json\n\nBy default this implementation expects the hostname to match this simple regular expression:\n\n    ^([a-zA-Z0-9]+)\\.[a-zA-Z0-9]+\\.[a-zA-Z0-9]+$\n\nNote that the first group is enclosed in brackets, indicating that this is the matched portion of the hostname.\n\nThe `HostNameVersioning` scheme can be awkward to use in debug mode as you will typically be accessing a raw IP address such as `127.0.0.1`. There are various online tutorials on how to [access localhost with a custom subdomain][lvh] which you may find helpful in this case.\n\nHostname based versioning can be particularly useful if you have requirements to route incoming requests to different servers based on the version, as you can configure different DNS records for different API versions.\n\n### QueryParameterVersioning\n\nThis scheme is a simple style that includes the version as a query parameter in the URL. For example:\n\n    GET /something/?version=0.1 HTTP/1.1\n    Host: example.com\n    Accept: application/json\n\n---\n\n## Custom versioning schemes\n\nTo implement a custom versioning scheme, subclass `BaseVersioning` and override the `.determine_version` method.\n\n### Example\n\nThe following example uses a custom `X-API-Version` header to determine the requested version.\n\n    class XAPIVersionScheme(versioning.BaseVersioning):\n        def determine_version(self, request, *args, **kwargs):\n            return request.META.get('HTTP_X_API_VERSION', None)\n\nIf your versioning scheme is based on the request URL, you will also want to alter how versioned URLs are determined. In order to do so you should override the `.reverse()` method on the class. See the source code for examples.\n\n[cite]: https://www.slideshare.net/evolve_conference/201308-fielding-evolve/31\n[roy-fielding-on-versioning]: https://www.infoq.com/articles/roy-fielding-on-versioning\n[klabnik-guidelines]: http://blog.steveklabnik.com/posts/2011-07-03-nobody-understands-rest-or-http#i_want_my_api_to_be_versioned\n[heroku-guidelines]: https://github.com/interagent/http-api-design/blob/master/en/foundations/require-versioning-in-the-accepts-header.md\n[json-parameters]: https://tools.ietf.org/html/rfc4627#section-6\n[vendor-media-type]: https://en.wikipedia.org/wiki/Internet_media_type#Vendor_tree\n[lvh]: https://reinteractive.net/posts/199-developing-and-testing-rails-applications-with-subdomains\n"
  },
  {
    "path": "docs/api-guide/views.md",
    "content": "---\nsource:\n    - decorators.py\n    - views.py\n---\n\n## Class-based Views\n\n> Django's class-based views are a welcome departure from the old-style views.\n>\n> &mdash; [Reinout van Rees][cite]\n\nREST framework provides an `APIView` class, which subclasses Django's `View` class.\n\n`APIView` classes are different from regular `View` classes in the following ways:\n\n* Requests passed to the handler methods will be REST framework's `Request` instances, not Django's `HttpRequest` instances.\n* Handler methods may return REST framework's `Response`, instead of Django's `HttpResponse`.  The view will manage content negotiation and setting the correct renderer on the response.\n* Any `APIException` exceptions will be caught and mediated into appropriate responses.\n* Incoming requests will be authenticated and appropriate permission and/or throttle checks will be run before dispatching the request to the handler method.\n\nUsing the `APIView` class is pretty much the same as using a regular `View` class, as usual, the incoming request is dispatched to an appropriate handler method such as `.get()` or `.post()`.  Additionally, a number of attributes may be set on the class that control various aspects of the API policy.\n\nFor example:\n\n    from rest_framework.views import APIView\n    from rest_framework.response import Response\n    from rest_framework import authentication, permissions\n    from django.contrib.auth.models import User\n\n    class ListUsers(APIView):\n        \"\"\"\n        View to list all users in the system.\n\n        * Requires token authentication.\n        * Only admin users are able to access this view.\n        \"\"\"\n        authentication_classes = [authentication.TokenAuthentication]\n        permission_classes = [permissions.IsAdminUser]\n\n        def get(self, request, format=None):\n            \"\"\"\n            Return a list of all users.\n            \"\"\"\n            usernames = [user.username for user in User.objects.all()]\n            return Response(usernames)\n\n!!! note\n    The full methods, attributes on, and relations between Django REST Framework's `APIView`, `GenericAPIView`, various `Mixins`, and `Viewsets` can be initially complex. In addition to the documentation here, the [Classy Django REST Framework][classy-drf] resource provides a browsable reference, with full methods and attributes, for each of Django REST Framework's class-based views.\n\n\n### API policy attributes\n\nThe following attributes control the pluggable aspects of API views.\n\n#### .renderer_classes\n\n#### .parser_classes\n\n#### .authentication_classes\n\n#### .throttle_classes\n\n#### .permission_classes\n\n#### .content_negotiation_class\n\n### API policy instantiation methods\n\nThe following methods are used by REST framework to instantiate the various pluggable API policies.  You won't typically need to override these methods.\n\n#### .get_renderers(self)\n\n#### .get_parsers(self)\n\n#### .get_authenticators(self)\n\n#### .get_throttles(self)\n\n#### .get_permissions(self)\n\n#### .get_content_negotiator(self)\n\n#### .get_exception_handler(self)\n\n### API policy implementation methods\n\nThe following methods are called before dispatching to the handler method.\n\n#### .check_permissions(self, request)\n\n#### .check_throttles(self, request)\n\n#### .perform_content_negotiation(self, request, force=False)\n\n### Dispatch methods\n\nThe following methods are called directly by the view's `.dispatch()` method.\nThese perform any actions that need to occur before or after calling the handler methods such as `.get()`, `.post()`, `put()`, `patch()` and `.delete()`.\n\n#### .initial(self, request, \\*args, **kwargs)\n\nPerforms any actions that need to occur before the handler method gets called.\nThis method is used to enforce permissions and throttling, and perform content negotiation.\n\nYou won't typically need to override this method.\n\n#### .handle_exception(self, exc)\n\nAny exception thrown by the handler method will be passed to this method, which either returns a `Response` instance, or re-raises the exception.\n\nThe default implementation handles any subclass of `rest_framework.exceptions.APIException`, as well as Django's `Http404` and `PermissionDenied` exceptions, and returns an appropriate error response.\n\nIf you need to customize the error responses your API returns you should subclass this method.\n\n#### .initialize_request(self, request, \\*args, **kwargs)\n\nEnsures that the request object that is passed to the handler method is an instance of `Request`, rather than the usual Django `HttpRequest`.\n\nYou won't typically need to override this method.\n\n#### .finalize_response(self, request, response, \\*args, **kwargs)\n\nEnsures that any `Response` object returned from the handler method will be rendered into the correct content type, as determined by the content negotiation.\n\nYou won't typically need to override this method.\n\n---\n\n## Function Based Views\n\n> Saying [that class-based views] is always the superior solution is a mistake.\n>\n> &mdash; [Nick Coghlan][cite2]\n\nREST framework also allows you to work with regular function based views.  It provides a set of simple decorators that wrap your function based views to ensure they receive an instance of `Request` (rather than the usual Django `HttpRequest`) and allows them to return a `Response` (instead of a Django `HttpResponse`), and allow you to configure how the request is processed.\n\n### @api_view()\n\n**Signature:** `@api_view(http_method_names=['GET'])`\n\nThe core of this functionality is the `api_view` decorator, which takes a list of HTTP methods that your view should respond to. For example, this is how you would write a very simple view that just manually returns some data:\n\n    from rest_framework.decorators import api_view\n    from rest_framework.response import Response\n\n    @api_view()\n    def hello_world(request):\n        return Response({\"message\": \"Hello, world!\"})\n\nThis view will use the default renderers, parsers, authentication classes etc specified in the [settings].\n\nBy default only `GET` methods will be accepted. Other methods will respond with \"405 Method Not Allowed\". To alter this behavior, specify which methods the view allows, like so:\n\n    @api_view(['GET', 'POST'])\n    def hello_world(request):\n        if request.method == 'POST':\n            return Response({\"message\": \"Got some data!\", \"data\": request.data})\n        return Response({\"message\": \"Hello, world!\"})\n\n\n### API policy decorators\n\nTo override the default settings, REST framework provides a set of additional decorators which can be added to your views.  These must come *after* (below) the `@api_view` decorator.  For example, to create a view that uses a [throttle][throttling] to ensure it can only be called once per day by a particular user, use the `@throttle_classes` decorator, passing a list of throttle classes:\n\n    from rest_framework.decorators import api_view, throttle_classes\n    from rest_framework.throttling import UserRateThrottle\n\n    class OncePerDayUserThrottle(UserRateThrottle):\n        rate = '1/day'\n\n    @api_view(['GET'])\n    @throttle_classes([OncePerDayUserThrottle])\n    def view(request):\n        return Response({\"message\": \"Hello for today! See you tomorrow!\"})\n\nThese decorators correspond to the attributes set on `APIView` subclasses, described above.\n\nThe available decorators are:\n\n* `@renderer_classes(...)`\n* `@parser_classes(...)`\n* `@authentication_classes(...)`\n* `@throttle_classes(...)`\n* `@permission_classes(...)`\n* `@content_negotiation_class(...)`\n* `@metadata_class(...)`\n* `@versioning_class(...)`\n\nEach of these decorators is equivalent to setting their respective [api policy attributes][api-policy-attributes].\n\nAll decorators take a single argument. The ones that end with `_class` expect a single class while the ones ending in `_classes` expect a list or tuple of classes.\n\n\n### View schema decorator\n\nTo override the default schema generation for function based views you may use\nthe `@schema` decorator. This must come *after* (below) the `@api_view`\ndecorator. For example:\n\n    from rest_framework.decorators import api_view, schema\n    from rest_framework.schemas import AutoSchema\n\n    class CustomAutoSchema(AutoSchema):\n        def get_operation(self, path, method):\n            # override view introspection here...\n\n    @api_view(['GET'])\n    @schema(CustomAutoSchema())\n    def view(request):\n        return Response({\"message\": \"Hello for today! See you tomorrow!\"})\n\nThis decorator takes a single `AutoSchema` instance or an `AutoSchema` subclass\ninstance as described in the [Schemas documentation][schemas].\nYou may pass `None` in order to exclude the view from schema generation.\n\n    @api_view(['GET'])\n    @schema(None)\n    def view(request):\n        return Response({\"message\": \"Will not appear in schema!\"})\n\n\n[cite]: https://reinout.vanrees.org/weblog/2011/08/24/class-based-views-usage.html\n[cite2]: http://www.boredomandlaziness.org/2012/05/djangos-cbvs-are-not-mistake-but.html\n[settings]: settings.md\n[throttling]: throttling.md\n[schemas]: schemas.md\n[classy-drf]: http://www.cdrf.co\n[api-policy-attributes]: views.md#api-policy-attributes\n\n"
  },
  {
    "path": "docs/api-guide/viewsets.md",
    "content": "---\nsource:\n    - viewsets.py\n---\n\n# ViewSets\n\n> After routing has determined which controller to use for a request, your controller is responsible for making sense of the request and producing the appropriate output.\n>\n> &mdash; [Ruby on Rails Documentation][cite]\n\n\nDjango REST framework allows you to combine the logic for a set of related views in a single class, called a `ViewSet`.  In other frameworks you may also find conceptually similar implementations named something like 'Resources' or 'Controllers'.\n\nA `ViewSet` class is simply **a type of class-based View, that does not provide any method handlers** such as `.get()` or `.post()`, and instead provides actions such as `.list()` and `.create()`.\n\nThe method handlers for a `ViewSet` are only bound to the corresponding actions at the point of finalizing the view, using the `.as_view()` method.\n\nTypically, rather than explicitly registering the views in a viewset in the urlconf, you'll register the viewset with a router class, that automatically determines the urlconf for you.\n\n## Example\n\nLet's define a simple viewset that can be used to list or retrieve all the users in the system.\n\n    from django.contrib.auth.models import User\n    from django.shortcuts import get_object_or_404\n    from myapps.serializers import UserSerializer\n    from rest_framework import viewsets\n    from rest_framework.response import Response\n\n    class UserViewSet(viewsets.ViewSet):\n        \"\"\"\n        A simple ViewSet for listing or retrieving users.\n        \"\"\"\n        def list(self, request):\n            queryset = User.objects.all()\n            serializer = UserSerializer(queryset, many=True)\n            return Response(serializer.data)\n\n        def retrieve(self, request, pk=None):\n            queryset = User.objects.all()\n            user = get_object_or_404(queryset, pk=pk)\n            serializer = UserSerializer(user)\n            return Response(serializer.data)\n\nIf we need to, we can bind this viewset into two separate views, like so:\n\n    user_list = UserViewSet.as_view({'get': 'list'})\n    user_detail = UserViewSet.as_view({'get': 'retrieve'})\n\n!!! warning\n    Do not use `.as_view()` with `@action` methods. It bypasses router setup and may ignore action settings like `permission_classes`. Use `DefaultRouter` for actions.\n\n\nTypically, we wouldn't do this, but would instead register the viewset with a router, and allow the urlconf to be automatically generated.\n\n    from myapp.views import UserViewSet\n    from rest_framework.routers import DefaultRouter\n\n    router = DefaultRouter()\n    router.register(r'users', UserViewSet, basename='user')\n    urlpatterns = router.urls\n\n!!! warning\n    When registering viewsets, do not include a trailing slash in the prefix (e.g., use `r'users'`, not `r'users/'`). Unlike standard Django URL patterns, DRF routers append slashes automatically based on your trailing slash configuration.\n\nRather than writing your own viewsets, you'll often want to use the existing base classes that provide a default set of behavior.  For example:\n\n    class UserViewSet(viewsets.ModelViewSet):\n        \"\"\"\n        A viewset for viewing and editing user instances.\n        \"\"\"\n        serializer_class = UserSerializer\n        queryset = User.objects.all()\n\nThere are two main advantages of using a `ViewSet` class over using a `View` class.\n\n* Repeated logic can be combined into a single class.  In the above example, we only need to specify the `queryset` once, and it'll be used across multiple views.\n* By using routers, we no longer need to deal with wiring up the URL conf ourselves.\n\nBoth of these come with a trade-off.  Using regular views and URL confs is more explicit and gives you more control.  ViewSets are helpful if you want to get up and running quickly, or when you have a large API and you want to enforce a consistent URL configuration throughout.\n\n\n## ViewSet actions\n\nThe default routers included with REST framework will provide routes for a standard set of create/retrieve/update/destroy style actions, as shown below:\n\n    class UserViewSet(viewsets.ViewSet):\n        \"\"\"\n        Example empty viewset demonstrating the standard\n        actions that will be handled by a router class.\n\n        If you're using format suffixes, make sure to also include\n        the `format=None` keyword argument for each action.\n        \"\"\"\n\n        def list(self, request):\n            pass\n\n        def create(self, request):\n            pass\n\n        def retrieve(self, request, pk=None):\n            pass\n\n        def update(self, request, pk=None):\n            pass\n\n        def partial_update(self, request, pk=None):\n            pass\n\n        def destroy(self, request, pk=None):\n            pass\n\n## Introspecting ViewSet actions\n\nDuring dispatch, the following attributes are available on the `ViewSet`.\n\n* `basename` - the base to use for the URL names that are created.\n* `action` - the name of the current action (e.g., `list`, `create`).\n* `detail` - boolean indicating if the current action is configured for a list or detail view.\n* `suffix` - the display suffix for the viewset type - mirrors the `detail` attribute.\n* `name` - the display name for the viewset. This argument is mutually exclusive to `suffix`.\n* `description` - the display description for the individual view of a viewset.\n\nYou may inspect these attributes to adjust behavior based on the current action. For example, you could restrict permissions to everything except the `list` action similar to this:\n\n    def get_permissions(self):\n        \"\"\"\n        Instantiates and returns the list of permissions that this view requires.\n        \"\"\"\n        if self.action == 'list':\n            permission_classes = [IsAuthenticated]\n        else:\n            permission_classes = [IsAdminUser]\n        return [permission() for permission in permission_classes]\n\n!!! note\n    The `action` attribute is not available in the `get_parsers`, `get_authenticators` and `get_content_negotiator` methods, as it is set _after_ they are called in the framework lifecycle. If you override one of these methods and try to access the `action` attribute in them, you will get an `AttributeError` error.\n\n## Marking extra actions for routing\n\nIf you have ad-hoc methods that should be routable, you can mark them as such with the `@action` decorator. Like regular actions, extra actions may be intended for either a single object, or an entire collection. To indicate this, set the `detail` argument to `True` or `False`. The router will configure its URL patterns accordingly. e.g., the `DefaultRouter` will configure detail actions to contain `pk` in their URL patterns.\n\nA more complete example of extra actions:\n\n    from django.contrib.auth.models import User\n    from rest_framework import status, viewsets\n    from rest_framework.decorators import action\n    from rest_framework.response import Response\n    from myapp.serializers import UserSerializer, PasswordSerializer\n\n    class UserViewSet(viewsets.ModelViewSet):\n        \"\"\"\n        A viewset that provides the standard actions\n        \"\"\"\n        queryset = User.objects.all()\n        serializer_class = UserSerializer\n\n        @action(detail=True, methods=['post'])\n        def set_password(self, request, pk=None):\n            user = self.get_object()\n            serializer = PasswordSerializer(data=request.data)\n            if serializer.is_valid():\n                user.set_password(serializer.validated_data['password'])\n                user.save()\n                return Response({'status': 'password set'})\n            else:\n                return Response(serializer.errors,\n                                status=status.HTTP_400_BAD_REQUEST)\n\n        @action(detail=False)\n        def recent_users(self, request):\n            recent_users = User.objects.all().order_by('-last_login')\n\n            page = self.paginate_queryset(recent_users)\n            if page is not None:\n                serializer = self.get_serializer(page, many=True)\n                return self.get_paginated_response(serializer.data)\n\n            serializer = self.get_serializer(recent_users, many=True)\n            return Response(serializer.data)\n\n\nThe `action` decorator will route `GET` requests by default, but may also accept other HTTP methods by setting the `methods` argument.  For example:\n\n        @action(detail=True, methods=['post', 'delete'])\n        def unset_password(self, request, pk=None):\n           ...\n\nArgument `methods` also supports HTTP methods defined as [HTTPMethod](https://docs.python.org/3/library/http.html#http.HTTPMethod). Example below is identical to the one above: \n\n        from http import HTTPMethod\n\n        @action(detail=True, methods=[HTTPMethod.POST, HTTPMethod.DELETE])\n        def unset_password(self, request, pk=None):\n           ...\n\nThe decorator allows you to override any viewset-level configuration such as `permission_classes`, `serializer_class`, `filter_backends`...:\n\n        @action(detail=True, methods=['post'], permission_classes=[IsAdminOrIsSelf])\n        def set_password(self, request, pk=None):\n           ...\n\nThe two new actions will then be available at the urls `^users/{pk}/set_password/$` and `^users/{pk}/unset_password/$`. Use the `url_path` and `url_name` parameters to change the URL segment and the reverse URL name of the action.\n\nTo view all extra actions, call the `.get_extra_actions()` method.\n\n### Routing additional HTTP methods for extra actions\n\nExtra actions can map additional HTTP methods to separate `ViewSet` methods. For example, the above password set/unset methods could be consolidated into a single route. Note that additional mappings do not accept arguments.\n\n```python\n@action(detail=True, methods=[\"put\"], name=\"Change Password\")\ndef password(self, request, pk=None):\n    \"\"\"Update the user's password.\"\"\"\n    ...\n\n\n@password.mapping.delete\ndef delete_password(self, request, pk=None):\n    \"\"\"Delete the user's password.\"\"\"\n    ...\n```\n\n## Reversing action URLs\n\nIf you need to get the URL of an action, use the `.reverse_action()` method. This is a convenience wrapper for `reverse()`, automatically passing the view's `request` object and prepending the `url_name` with the `.basename` attribute.\n\nNote that the `basename` is provided by the router during `ViewSet` registration. If you are not using a router, then you must provide the `basename` argument to the `.as_view()` method.\n\nUsing the example from the previous section:\n\n```pycon\n>>> view.reverse_action(\"set-password\", args=[\"1\"])\n'http://localhost:8000/api/users/1/set_password'\n```\n\nAlternatively, you can use the `url_name` attribute set by the `@action` decorator.\n\n```pycon\n>>> view.reverse_action(view.set_password.url_name, args=[\"1\"])\n'http://localhost:8000/api/users/1/set_password'\n```\n\nThe `url_name` argument for `.reverse_action()` should match the same argument to the `@action` decorator. Additionally, this method can be used to reverse the default actions, such as `list` and `create`.\n\n---\n\n## API Reference\n\n### ViewSet\n\nThe `ViewSet` class inherits from `APIView`.  You can use any of the standard attributes such as `permission_classes`, `authentication_classes` in order to control the API policy on the viewset.\n\nThe `ViewSet` class does not provide any implementations of actions.  In order to use a `ViewSet` class you'll override the class and define the action implementations explicitly.\n\n### GenericViewSet\n\nThe `GenericViewSet` class inherits from `GenericAPIView`, and provides the default set of `get_object`, `get_queryset` methods and other generic view base behavior, but does not include any actions by default.\n\nIn order to use a `GenericViewSet` class you'll override the class and either mixin the required mixin classes, or define the action implementations explicitly.\n\n### ModelViewSet\n\nThe `ModelViewSet` class inherits from `GenericAPIView` and includes implementations for various actions, by mixing in the behavior of the various mixin classes.\n\nThe actions provided by the `ModelViewSet` class are `.list()`, `.retrieve()`, `.create()`, `.update()`, `.partial_update()`, and `.destroy()`.\n\n#### Example\n\nBecause `ModelViewSet` extends `GenericAPIView`, you'll normally need to provide at least the `queryset` and `serializer_class` attributes.  For example:\n\n    class AccountViewSet(viewsets.ModelViewSet):\n        \"\"\"\n        A simple ViewSet for viewing and editing accounts.\n        \"\"\"\n        queryset = Account.objects.all()\n        serializer_class = AccountSerializer\n        permission_classes = [IsAccountAdminOrReadOnly]\n\nNote that you can use any of the standard attributes or method overrides provided by `GenericAPIView`.  For example, to use a `ViewSet` that dynamically determines the queryset it should operate on, you might do something like this:\n\n    class AccountViewSet(viewsets.ModelViewSet):\n        \"\"\"\n        A simple ViewSet for viewing and editing the accounts\n        associated with the user.\n        \"\"\"\n        serializer_class = AccountSerializer\n        permission_classes = [IsAccountAdminOrReadOnly]\n\n        def get_queryset(self):\n            return self.request.user.accounts.all()\n\nNote however that upon removal of the `queryset` property from your `ViewSet`, any associated [router][routers] will be unable to derive the basename of your Model automatically, and so you will have to specify the `basename` kwarg as part of your [router registration][routers].\n\nAlso note that although this class provides the complete set of create/list/retrieve/update/destroy actions by default, you can restrict the available operations by using the standard permission classes.\n\n### ReadOnlyModelViewSet\n\nThe `ReadOnlyModelViewSet` class also inherits from `GenericAPIView`.  As with `ModelViewSet` it also includes implementations for various actions, but unlike `ModelViewSet` only provides the 'read-only' actions, `.list()` and `.retrieve()`.\n\n#### Example\n\nAs with `ModelViewSet`, you'll normally need to provide at least the `queryset` and `serializer_class` attributes.  For example:\n\n    class AccountViewSet(viewsets.ReadOnlyModelViewSet):\n        \"\"\"\n        A simple ViewSet for viewing accounts.\n        \"\"\"\n        queryset = Account.objects.all()\n        serializer_class = AccountSerializer\n\nAgain, as with `ModelViewSet`, you can use any of the standard attributes and method overrides available to `GenericAPIView`.\n\n## Custom ViewSet base classes\n\nYou may need to provide custom `ViewSet` classes that do not have the full set of `ModelViewSet` actions, or that customize the behavior in some other way.\n\n### Example\n\nTo create a base viewset class that provides `create`, `list` and `retrieve` operations, inherit from `GenericViewSet`, and mixin the required actions:\n\n    from rest_framework import mixins, viewsets\n\n    class CreateListRetrieveViewSet(mixins.CreateModelMixin,\n                                    mixins.ListModelMixin,\n                                    mixins.RetrieveModelMixin,\n                                    viewsets.GenericViewSet):\n        \"\"\"\n        A viewset that provides `retrieve`, `create`, and `list` actions.\n\n        To use it, override the class and set the `.queryset` and\n        `.serializer_class` attributes.\n        \"\"\"\n        pass\n\nBy creating your own base `ViewSet` classes, you can provide common behavior that can be reused in multiple viewsets across your API.\n\n[cite]: https://guides.rubyonrails.org/action_controller_overview.html\n[routers]: routers.md\n"
  },
  {
    "path": "docs/community/3.0-announcement.md",
    "content": "# Django REST framework 3.0\n\nThe 3.0 release of Django REST framework is the result of almost four years of iteration and refinement. It comprehensively addresses some of the previous remaining design issues in serializers, fields and the generic views.\n\n**This release is incremental in nature. There *are* some breaking API changes, and upgrading *will* require you to read the release notes carefully, but the migration path should otherwise be relatively straightforward.**\n\nThe difference in quality of the REST framework API and implementation should make writing, maintaining and debugging your application far easier.\n\n3.0 is the first of three releases that have been funded by our recent [Kickstarter campaign][kickstarter].\n\nAs ever, a huge thank you to our many [wonderful sponsors][sponsors]. If you're looking for a Django gig, and want to work with smart community-minded folks, you should probably check out that list and see who's hiring.\n\n---\n\n## New features\n\nNotable features of this new release include:\n\n* Printable representations on serializers that allow you to inspect exactly what fields are present on the instance.\n* Simple model serializers that are vastly easier to understand and debug, and that make it easy to switch between the implicit `ModelSerializer` class and the explicit `Serializer` class.\n* A new `BaseSerializer` class, making it easier to write serializers for alternative storage backends, or to completely customize your serialization and validation logic.\n* A cleaner fields API including new classes such as `ListField` and `MultipleChoiceField`.\n* [Super simple default implementations][mixins.py] for the generic views.\n* Support for overriding how validation errors are handled by your API.\n* A metadata API that allows you to customize how `OPTIONS` requests are handled by your API.\n* A more compact JSON output with unicode style encoding turned on by default.\n* Templated based HTML form rendering for serializers. This will be finalized as public API in the upcoming 3.1 release.\n\nSignificant new functionality continues to be planned for the 3.1 and 3.2 releases. These releases will correspond to the two [Kickstarter stretch goals](https://www.kickstarter.com/projects/tomchristie/django-rest-framework-3) - \"Feature improvements\" and \"Admin interface\". Further 3.x releases will present simple upgrades, without the same level of fundamental API changes necessary for the 3.0 release.\n\n---\n\n#### REST framework: Under the hood.\n\nThis talk from the [Django: Under the Hood](https://www.djangounderthehood.com/) event in Amsterdam, Nov 2014, gives some good background context on the design decisions behind 3.0.\n\n<iframe style=\"display: block; margin: 0 auto 0 auto\" width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/3cSsbe-tA0E\" frameborder=\"0\" allowfullscreen></iframe>\n\n---\n\n*Below is an in-depth guide to the API changes and migration notes for 3.0.*\n\n## Request objects\n\n#### The `.data` and `.query_params` properties.\n\nThe usage of `request.DATA` and `request.FILES` is now pending deprecation in favor of a single `request.data` attribute that contains *all* the parsed data.\n\nHaving separate attributes is reasonable for web applications that only ever parse url-encoded or multipart requests, but makes less sense for the general-purpose request parsing that REST framework supports.\n\nYou may now pass all the request data to a serializer class in a single argument:\n\n    # Do this...\n    ExampleSerializer(data=request.data)\n\nInstead of passing the files argument separately:\n\n    # Don't do this...\n    ExampleSerializer(data=request.DATA, files=request.FILES)\n\n\nThe usage of `request.QUERY_PARAMS` is now pending deprecation in favor of the lowercased `request.query_params`.\n\n---\n\n## Serializers\n\n#### Single-step object creation.\n\nPreviously the serializers used a two-step object creation, as follows:\n\n1. Validating the data would create an object instance. This instance would be available as `serializer.object`.\n2. Calling `serializer.save()` would then save the object instance to the database.\n\nThis style is in-line with how the `ModelForm` class works in Django, but is problematic for a number of reasons:\n\n* Some data, such as many-to-many relationships, cannot be added to the object instance until after it has been saved. This type of data needed to be hidden in some undocumented state on the object instance, or kept as state on the serializer instance so that it could be used when `.save()` is called.\n* Instantiating model instances directly means that you cannot use model manager classes for instance creation, e.g. `ExampleModel.objects.create(...)`. Manager classes are an excellent layer at which to enforce business logic and application-level data constraints.\n* The two step process makes it unclear where to put deserialization logic. For example, should extra attributes such as the current user get added to the instance during object creation or during object save?\n\nWe now use single-step object creation, like so:\n\n1. Validating the data makes the cleaned data available as `serializer.validated_data`.\n2. Calling `serializer.save()` then saves and returns the new object instance.\n\nThe resulting API changes are further detailed below.\n\n#### The `.create()` and `.update()` methods.\n\nThe `.restore_object()` method is now removed, and we instead have two separate methods, `.create()` and `.update()`. These methods work slightly different to the previous `.restore_object()`.\n\nWhen using the `.create()` and `.update()` methods you should both create *and save* the object instance. This is in contrast to the previous `.restore_object()` behavior that would instantiate the object but not save it.\n\nThese methods also replace the optional `.save_object()` method, which no longer exists.\n\nThe following example from the tutorial previously used `restore_object()` to handle both creating and updating object instances.\n\n    def restore_object(self, attrs, instance=None):\n        if instance:\n            # Update existing instance\n            instance.title = attrs.get('title', instance.title)\n            instance.code = attrs.get('code', instance.code)\n            instance.linenos = attrs.get('linenos', instance.linenos)\n            instance.language = attrs.get('language', instance.language)\n            instance.style = attrs.get('style', instance.style)\n            return instance\n\n        # Create new instance\n        return Snippet(**attrs)\n\nThis would now be split out into two separate methods.\n\n    def update(self, instance, validated_data):\n        instance.title = validated_data.get('title', instance.title)\n        instance.code = validated_data.get('code', instance.code)\n        instance.linenos = validated_data.get('linenos', instance.linenos)\n        instance.language = validated_data.get('language', instance.language)\n        instance.style = validated_data.get('style', instance.style)\n        instance.save()\n        return instance\n\n    def create(self, validated_data):\n        return Snippet.objects.create(**validated_data)\n\nNote that these methods should return the newly created object instance.\n\n#### Use `.validated_data` instead of `.object`.\n\nYou must now use the `.validated_data` attribute if you need to inspect the data before saving, rather than using the `.object` attribute, which no longer exists.\n\nFor example the following code *is no longer valid*:\n\n    if serializer.is_valid():\n        name = serializer.object.name  # Inspect validated field data.\n        logging.info('Creating ticket \"%s\"' % name)\n        serializer.object.user = request.user  # Include the user when saving.\n        serializer.save()\n\nInstead of using `.object` to inspect a partially constructed instance, you would now use `.validated_data` to inspect the cleaned incoming values. Also you can't set extra attributes on the instance directly, but instead pass them to the `.save()` method as keyword arguments.\n\nThe corresponding code would now look like this:\n\n    if serializer.is_valid():\n        name = serializer.validated_data['name']  # Inspect validated field data.\n        logging.info('Creating ticket \"%s\"' % name)\n        serializer.save(user=request.user)  # Include the user when saving.\n\n#### Using `.is_valid(raise_exception=True)`\n\nThe `.is_valid()` method now takes an optional boolean flag, `raise_exception`.\n\nCalling `.is_valid(raise_exception=True)` will cause a `ValidationError` to be raised if the serializer data contains validation errors. This error will be handled by REST framework's default exception handler, allowing you to remove error response handling from your view code.\n\nThe handling and formatting of error responses may be altered globally by using the `EXCEPTION_HANDLER` settings key.\n\nThis change also means it's now possible to alter the style of error responses used by the built-in generic views, without having to include mixin classes or other overrides.\n\n#### Using `serializers.ValidationError`.\n\nPreviously `serializers.ValidationError` error was simply a synonym for `django.core.exceptions.ValidationError`. This has now been altered so that it inherits from the standard `APIException` base class.\n\nThe reason behind this is that Django's `ValidationError` class is intended for use with HTML forms and its API makes using it slightly awkward with nested validation errors that can occur in serializers.\n\nFor most users this change shouldn't require any updates to your codebase, but it is worth ensuring that whenever raising validation errors you should prefer using the `serializers.ValidationError` exception class, and not Django's built-in exception.\n\nWe strongly recommend that you use the namespaced import style of `import serializers` and not `from serializers import ValidationError` in order to avoid any potential confusion.\n\n#### Change to `validate_<field_name>`.\n\nThe `validate_<field_name>` method hooks that can be attached to serializer classes change their signature slightly and return type. Previously these would take a dictionary of all incoming data, and a key representing the field name, and would return a dictionary including the validated data for that field:\n\n    def validate_score(self, attrs, source):\n        if attrs['score'] % 10 != 0:\n            raise serializers.ValidationError('This field should be a multiple of ten.')\n        return attrs\n\nThis is now simplified slightly, and the method hooks simply take the value to be validated, and return the validated value.\n\n    def validate_score(self, value):\n        if value % 10 != 0:\n            raise serializers.ValidationError('This field should be a multiple of ten.')\n        return value\n\nAny ad-hoc validation that applies to more than one field should go in the `.validate(self, attrs)` method as usual.\n\nBecause `.validate_<field_name>` would previously accept the complete dictionary of attributes, it could be used to validate a field depending on the input in another field. Now if you need to do this you should use `.validate()` instead.\n\nYou can either return `non_field_errors` from the validate method by raising a simple `ValidationError`\n\n    def validate(self, attrs):\n        # serializer.errors == {'non_field_errors': ['A non field error']}\n        raise serializers.ValidationError('A non field error')\n\nAlternatively if you want the errors to be against a specific field, use a dictionary of when instantiating the `ValidationError`, like so:\n\n    def validate(self, attrs):\n        # serializer.errors == {'my_field': ['A field error']}\n        raise serializers.ValidationError({'my_field': 'A field error'})\n\nThis ensures you can still write validation that compares all the input fields, but that marks the error against a particular field.\n\n#### Removal of `transform_<field_name>`.\n\nThe under-used `transform_<field_name>` on serializer classes is no longer provided. Instead you should just override `to_representation()` if you need to apply any modifications to the representation style.\n\nFor example:\n\n    def to_representation(self, instance):\n        ret = super(UserSerializer, self).to_representation(instance)\n        ret['username'] = ret['username'].lower()\n        return ret\n\nDropping the extra point of API means there's now only one right way to do things. This helps with repetition and reinforcement of the core API, rather than having multiple differing approaches.\n\nIf you absolutely need to preserve `transform_<field_name>` behavior, for example, in order to provide a simpler 2.x to 3.0 upgrade, you can use a mixin, or serializer base class that add the behavior back in. For example:\n\n    class BaseModelSerializer(ModelSerializer):\n        \"\"\"\n        A custom ModelSerializer class that preserves 2.x style `transform_<field_name>` behavior.\n        \"\"\"\n        def to_representation(self, instance):\n            ret = super(BaseModelSerializer, self).to_representation(instance)\n            for key, value in ret.items():\n                method = getattr(self, 'transform_' + key, None)\n                if method is not None:\n                    ret[key] = method(value)\n            return ret\n\n#### Differences between ModelSerializer validation and ModelForm.\n\nThis change also means that we no longer use the `.full_clean()` method on model instances, but instead perform all validation explicitly on the serializer. This gives a cleaner separation, and ensures that there's no automatic validation behavior on `ModelSerializer` classes that can't also be easily replicated on regular `Serializer` classes.\n\nFor the most part this change should be transparent. Field validation and uniqueness checks will still be run as normal, but the implementation is a little different.\n\nThe one difference that you do need to note is that the `.clean()` method will not be called as part of serializer validation, as it would be if using a `ModelForm`. Use the serializer `.validate()` method to perform a final validation step on incoming data where required.\n\nThere may be some cases where you really do need to keep validation logic in the model `.clean()` method, and cannot instead separate it into the serializer `.validate()`. You can do so by explicitly instantiating a model instance in the `.validate()` method.\n\n    def validate(self, attrs):\n        instance = ExampleModel(**attrs)\n        instance.clean()\n        return attrs\n\nAgain, you really should look at properly separating the validation logic out of the model method if possible, but the above might be useful in some backwards compatibility cases, or for an easy migration path.\n\n#### Writable nested serialization.\n\nREST framework 2.x attempted to automatically support writable nested serialization, but the behavior was complex and non-obvious. Attempting to automatically handle these case is problematic:\n\n* There can be complex dependencies involved in order of saving multiple related model instances.\n* It's unclear what behavior the user should expect when related models are passed `None` data.\n* It's unclear how the user should expect to-many relationships to handle updates, creations and deletions of multiple records.\n\nUsing the `depth` option on `ModelSerializer` will now create **read-only nested serializers** by default.\n\nIf you try to use a writable nested serializer without writing a custom `create()` and/or `update()` method you'll see an assertion error when you attempt to save the serializer. For example:\n\n    >>> class ProfileSerializer(serializers.ModelSerializer):\n    >>>     class Meta:\n    >>>         model = Profile\n    >>>         fields = ['address', 'phone']\n    >>>\n    >>> class UserSerializer(serializers.ModelSerializer):\n    >>>     profile = ProfileSerializer()\n    >>>     class Meta:\n    >>>         model = User\n    >>>         fields = ['username', 'email', 'profile']\n    >>>\n    >>> data = {\n    >>>     'username': 'lizzy',\n    >>>     'email': 'lizzy@example.com',\n    >>>     'profile': {'address': '123 Acacia Avenue', 'phone': '01273 100200'}\n    >>> }\n    >>>\n    >>> serializer = UserSerializer(data=data)\n    >>> serializer.save()\n    AssertionError: The `.create()` method does not support nested writable fields by default. Write an explicit `.create()` method for serializer `UserSerializer`, or set `read_only=True` on nested serializer fields.\n\nTo use writable nested serialization you'll want to declare a nested field on the serializer class, and write the `create()` and/or `update()` methods explicitly.\n\n    class UserSerializer(serializers.ModelSerializer):\n        profile = ProfileSerializer()\n\n        class Meta:\n            model = User\n            fields = ['username', 'email', 'profile']\n\n        def create(self, validated_data):\n            profile_data = validated_data.pop('profile')\n            user = User.objects.create(**validated_data)\n            Profile.objects.create(user=user, **profile_data)\n            return user\n\nThe single-step object creation makes this far simpler and more obvious than the previous `.restore_object()` behavior.\n\n#### Printable serializer representations.\n\nSerializer instances now support a printable representation that allows you to inspect the fields present on the instance.\n\nFor instance, given the following example model:\n\n    class LocationRating(models.Model):\n        location = models.CharField(max_length=100)\n        rating = models.IntegerField()\n        created_by = models.ForeignKey(User)\n\nLet's create a simple `ModelSerializer` class corresponding to the `LocationRating` model.\n\n    class LocationRatingSerializer(serializer.ModelSerializer):\n        class Meta:\n            model = LocationRating\n\nWe can now inspect the serializer representation in the Django shell, using `python manage.py shell`...\n\n    >>> serializer = LocationRatingSerializer()\n    >>> print(serializer)  # Or use `print serializer` in Python 2.x\n    LocationRatingSerializer():\n        id = IntegerField(label='ID', read_only=True)\n        location = CharField(max_length=100)\n        rating = IntegerField()\n        created_by = PrimaryKeyRelatedField(queryset=User.objects.all())\n\n#### The `extra_kwargs` option.\n\nThe `write_only_fields` option on `ModelSerializer` has been moved to `PendingDeprecation` and replaced with a more generic `extra_kwargs`.\n\n    class MySerializer(serializer.ModelSerializer):\n        class Meta:\n            model = MyModel\n            fields = ['id', 'email', 'notes', 'is_admin']\n            extra_kwargs = {\n                    'is_admin': {'write_only': True}\n            }\n\nAlternatively, specify the field explicitly on the serializer class:\n\n    class MySerializer(serializer.ModelSerializer):\n        is_admin = serializers.BooleanField(write_only=True)\n\n        class Meta:\n            model = MyModel\n            fields = ['id', 'email', 'notes', 'is_admin']\n\nThe `read_only_fields` option remains as a convenient shortcut for the more common case.\n\n#### Changes to `HyperlinkedModelSerializer`.\n\nThe `view_name` and `lookup_field` options have been moved to `PendingDeprecation`. They are no longer required, as you can use the `extra_kwargs` argument instead:\n\n    class MySerializer(serializer.HyperlinkedModelSerializer):\n        class Meta:\n            model = MyModel\n            fields = ['url', 'email', 'notes', 'is_admin']\n            extra_kwargs = {\n                'url': {'lookup_field': 'uuid'}\n            }\n\nAlternatively, specify the field explicitly on the serializer class:\n\n    class MySerializer(serializer.HyperlinkedModelSerializer):\n        url = serializers.HyperlinkedIdentityField(\n            view_name='mymodel-detail',\n            lookup_field='uuid'\n        )\n\n        class Meta:\n            model = MyModel\n            fields = ['url', 'email', 'notes', 'is_admin']\n\n#### Fields for model methods and properties.\n\nWith `ModelSerializer` you can now specify field names in the `fields` option that refer to model methods or properties. For example, suppose you have the following model:\n\n    class Invitation(models.Model):\n        created = models.DateTimeField()\n        to_email = models.EmailField()\n        message = models.CharField(max_length=1000)\n\n        def expiry_date(self):\n            return self.created + datetime.timedelta(days=30)\n\nYou can include `expiry_date` as a field option on a `ModelSerializer` class.\n\n    class InvitationSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = Invitation\n            fields = ['to_email', 'message', 'expiry_date']\n\nThese fields will be mapped to `serializers.ReadOnlyField()` instances.\n\n    >>> serializer = InvitationSerializer()\n    >>> print(repr(serializer))\n    InvitationSerializer():\n        to_email = EmailField(max_length=75)\n        message = CharField(max_length=1000)\n        expiry_date = ReadOnlyField()\n\n#### The `ListSerializer` class.\n\nThe `ListSerializer` class has now been added, and allows you to create base serializer classes for only accepting multiple inputs.\n\n    class MultipleUserSerializer(ListSerializer):\n        child = UserSerializer()\n\nYou can also still use the `many=True` argument to serializer classes. It's worth noting that `many=True` argument transparently creates a `ListSerializer` instance, allowing the validation logic for list and non-list data to be cleanly separated in the REST framework codebase.\n\nYou will typically want to *continue to use the existing `many=True` flag* rather than declaring `ListSerializer` classes explicitly, but declaring the classes explicitly can be useful if you need to write custom `create` or `update` methods for bulk updates, or provide for other custom behavior.\n\nSee also the new `ListField` class, which validates input in the same way, but does not include the serializer interfaces of `.is_valid()`, `.data`, `.save()` and so on.\n\n#### The `BaseSerializer` class.\n\nREST framework now includes a simple `BaseSerializer` class that can be used to easily support alternative serialization and deserialization styles.\n\nThis class implements the same basic API as the `Serializer` class:\n\n* `.data` - Returns the outgoing primitive representation.\n* `.is_valid()` - Deserializes and validates incoming data.\n* `.validated_data` - Returns the validated incoming data.\n* `.errors` - Returns an errors during validation.\n* `.save()` - Persists the validated data into an object instance.\n\nThere are four methods that can be overridden, depending on what functionality you want the serializer class to support:\n\n* `.to_representation()` - Override this to support serialization, for read operations.\n* `.to_internal_value()` - Override this to support deserialization, for write operations.\n* `.create()` and `.update()` - Override either or both of these to support saving instances.\n\nBecause this class provides the same interface as the `Serializer` class, you can use it with the existing generic class-based views exactly as you would for a regular `Serializer` or `ModelSerializer`.\n\nThe only difference you'll notice when doing so is the `BaseSerializer` classes will not generate HTML forms in the browsable API. This is because the data they return does not include all the field information that would allow each field to be rendered into a suitable HTML input.\n\n##### Read-only `BaseSerializer` classes.\n\nTo implement a read-only serializer using the `BaseSerializer` class, we just need to override the `.to_representation()` method. Let's take a look at an example using a simple Django model:\n\n    class HighScore(models.Model):\n        created = models.DateTimeField(auto_now_add=True)\n        player_name = models.CharField(max_length=10)\n        score = models.IntegerField()\n\nIt's simple to create a read-only serializer for converting `HighScore` instances into primitive data types.\n\n    class HighScoreSerializer(serializers.BaseSerializer):\n        def to_representation(self, obj):\n            return {\n                'score': obj.score,\n                'player_name': obj.player_name\n            }\n\nWe can now use this class to serialize single `HighScore` instances:\n\n    @api_view(['GET'])\n    def high_score(request, pk):\n        instance = HighScore.objects.get(pk=pk)\n        serializer = HighScoreSerializer(instance)\n        return Response(serializer.data)\n\nOr use it to serialize multiple instances:\n\n    @api_view(['GET'])\n    def all_high_scores(request):\n        queryset = HighScore.objects.order_by('-score')\n        serializer = HighScoreSerializer(queryset, many=True)\n        return Response(serializer.data)\n\n##### Read-write `BaseSerializer` classes.\n\nTo create a read-write serializer we first need to implement a `.to_internal_value()` method. This method returns the validated values that will be used to construct the object instance, and may raise a `ValidationError` if the supplied data is in an incorrect format.\n\nOnce you've implemented `.to_internal_value()`, the basic validation API will be available on the serializer, and you will be able to use `.is_valid()`, `.validated_data` and `.errors`.\n\nIf you want to also support `.save()` you'll need to also implement either or both of the `.create()` and `.update()` methods.\n\nHere's a complete example of our previous `HighScoreSerializer`, that's been updated to support both read and write operations.\n\n    class HighScoreSerializer(serializers.BaseSerializer):\n        def to_internal_value(self, data):\n            score = data.get('score')\n            player_name = data.get('player_name')\n\n            # Perform the data validation.\n            if not score:\n                raise ValidationError({\n                    'score': 'This field is required.'\n                })\n            if not player_name:\n                raise ValidationError({\n                    'player_name': 'This field is required.'\n                })\n            if len(player_name) > 10:\n                raise ValidationError({\n                    'player_name': 'May not be more than 10 characters.'\n                })\n\n            # Return the validated values. This will be available as\n            # the `.validated_data` property.\n            return {\n                'score': int(score),\n                'player_name': player_name\n            }\n\n        def to_representation(self, obj):\n            return {\n                'score': obj.score,\n                'player_name': obj.player_name\n            }\n\n        def create(self, validated_data):\n            return HighScore.objects.create(**validated_data)\n\n#### Creating new generic serializers with `BaseSerializer`.\n\nThe `BaseSerializer` class is also useful if you want to implement new generic serializer classes for dealing with particular serialization styles, or for integrating with alternative storage backends.\n\nThe following class is an example of a generic serializer that can handle coercing arbitrary objects into primitive representations.\n\n    class ObjectSerializer(serializers.BaseSerializer):\n        \"\"\"\n        A read-only serializer that coerces arbitrary complex objects\n        into primitive representations.\n        \"\"\"\n        def to_representation(self, obj):\n            for attribute_name in dir(obj):\n                attribute = getattr(obj, attribute_name)\n                if attribute_name.startswith('_'):\n                    # Ignore private attributes.\n                    pass\n                elif hasattr(attribute, '__call__'):\n                    # Ignore methods and other callables.\n                    pass\n                elif isinstance(attribute, (str, int, bool, float, type(None))):\n                    # Primitive types can be passed through unmodified.\n                    output[attribute_name] = attribute\n                elif isinstance(attribute, list):\n                    # Recursively deal with items in lists.\n                    output[attribute_name] = [\n                        self.to_representation(item) for item in attribute\n                    ]\n                elif isinstance(attribute, dict):\n                    # Recursively deal with items in dictionaries.\n                    output[attribute_name] = {\n                        str(key): self.to_representation(value)\n                        for key, value in attribute.items()\n                    }\n                else:\n                    # Force anything else to its string representation.\n                    output[attribute_name] = str(attribute)\n\n---\n\n## Serializer fields\n\n#### The `Field` and `ReadOnly` field classes.\n\nThere are some minor tweaks to the field base classes.\n\nPreviously we had these two base classes:\n\n* `Field` as the base class for read-only fields. A default implementation was included for serializing data.\n* `WritableField` as the base class for read-write fields.\n\nWe now use the following:\n\n* `Field` is the base class for all fields. It does not include any default implementation for either serializing or deserializing data.\n* `ReadOnlyField` is a concrete implementation for read-only fields that simply returns the attribute value without modification.\n\n#### The `required`, `allow_null`, `allow_blank` and `default` arguments.\n\nREST framework now has more explicit and clear control over validating empty values for fields.\n\nPreviously the meaning of the `required=False` keyword argument was underspecified. In practice its use meant that a field could either be not included in the input, or it could be included, but be `None` or the empty string.\n\nWe now have a better separation, with separate `required`, `allow_null` and `allow_blank` arguments.\n\nThe following set of arguments are used to control validation of empty values:\n\n* `required=False`: The value does not need to be present in the input, and will not be passed to `.create()` or `.update()` if it is not seen.\n* `default=<value>`: The value does not need to be present in the input, and a default value will be passed to `.create()` or `.update()` if it is not seen.\n* `allow_null=True`: `None` is a valid input.\n* `allow_blank=True`: `''` is valid input. For `CharField` and subclasses only.\n\nTypically you'll want to use `required=False` if the corresponding model field has a default value, and additionally set either `allow_null=True` or `allow_blank=True` if required.\n\nThe `default` argument is also available and always implies that the field is not required to be in the input. It is unnecessary to use the `required` argument when a default is specified, and doing so will result in an error.\n\n#### Coercing output types.\n\nThe previous field implementations did not forcibly coerce returned values into the correct type in many cases. For example, an `IntegerField` would return a string output if the attribute value was a string. We now more strictly coerce to the correct return type, leading to more constrained and expected behavior.\n\n#### Removal of `.validate()`.\n\nThe `.validate()` method is now removed from field classes. This method was in any case undocumented and not public API. You should instead simply override `to_internal_value()`.\n\n    class UppercaseCharField(serializers.CharField):\n        def to_internal_value(self, data):\n            value = super(UppercaseCharField, self).to_internal_value(data)\n            if value != value.upper():\n                raise serializers.ValidationError('The input should be uppercase only.')\n            return value\n\nPreviously validation errors could be raised in either `.to_native()` or `.validate()`, making it non-obvious which should be used. Providing only a single point of API ensures more repetition and reinforcement of the core API.\n\n#### The `ListField` class.\n\nThe `ListField` class has now been added. This field validates list input. It takes a `child` keyword argument which is used to specify the field used to validate each item in the list. For example:\n\n    scores = ListField(child=IntegerField(min_value=0, max_value=100))\n\nYou can also use a declarative style to create new subclasses of `ListField`, like this:\n\n    class ScoresField(ListField):\n        child = IntegerField(min_value=0, max_value=100)\n\nWe can now use the `ScoresField` class inside another serializer:\n\n    scores = ScoresField()\n\nSee also the new `ListSerializer` class, which validates input in the same way, but also includes the serializer interfaces of `.is_valid()`, `.data`, `.save()` and so on.\n\n#### The `ChoiceField` class may now accept a flat list.\n\nThe `ChoiceField` class may now accept a list of choices in addition to the existing style of using a list of pairs of `(name, display_value)`. The following is now valid:\n\n    color = ChoiceField(choices=['red', 'green', 'blue'])\n\n#### The `MultipleChoiceField` class.\n\nThe `MultipleChoiceField` class has been added. This field acts like `ChoiceField`, but returns a set, which may include none, one or many of the valid choices.\n\n#### Changes to the custom field API.\n\nThe `from_native(self, value)` and `to_native(self, data)` method names have been replaced with the more obviously named `to_internal_value(self, data)` and `to_representation(self, value)`.\n\nThe `field_from_native()` and `field_to_native()` methods are removed. Previously you could use these methods if you wanted to customize the behavior in a way that did not simply lookup the field value from the object. For example...\n\n    def field_to_native(self, obj, field_name):\n        \"\"\"A custom read-only field that returns the class name.\"\"\"\n        return obj.__class__.__name__\n\nNow if you need to access the entire object you'll instead need to override one or both of the following:\n\n* Use `get_attribute` to modify the attribute value passed to `to_representation()`.\n* Use `get_value` to modify the data value passed `to_internal_value()`.\n\nFor example:\n\n    def get_attribute(self, obj):\n        # Pass the entire object through to `to_representation()`,\n        # instead of the standard attribute lookup.\n        return obj\n\n    def to_representation(self, value):\n        return value.__class__.__name__\n\n#### Explicit `queryset` required on relational fields.\n\nPreviously relational fields that were explicitly declared on a serializer class could omit the queryset argument if (and only if) they were declared on a `ModelSerializer`.\n\nThis code *would be valid* in `2.4.3`:\n\n    class AccountSerializer(serializers.ModelSerializer):\n        organizations = serializers.SlugRelatedField(slug_field='name')\n\n        class Meta:\n            model = Account\n\nHowever this code *would not be valid* in `3.0`:\n\n    # Missing `queryset`\n    class AccountSerializer(serializers.Serializer):\n        organizations = serializers.SlugRelatedField(slug_field='name')\n\n        def restore_object(self, attrs, instance=None):\n            # ...\n\nThe queryset argument is now always required for writable relational fields.\nThis removes some magic and makes it easier and more obvious to move between implicit `ModelSerializer` classes and explicit `Serializer` classes.\n\n    class AccountSerializer(serializers.ModelSerializer):\n        organizations = serializers.SlugRelatedField(\n            slug_field='name',\n            queryset=Organization.objects.all()\n        )\n\n        class Meta:\n            model = Account\n\nThe `queryset` argument is only ever required for writable fields, and is not required or valid for fields with `read_only=True`.\n\n#### Optional argument to `SerializerMethodField`.\n\nThe argument to `SerializerMethodField` is now optional, and defaults to `get_<field_name>`. For example the following is valid:\n\n    class AccountSerializer(serializers.Serializer):\n        # `method_name='get_billing_details'` by default.\n        billing_details = serializers.SerializerMethodField()\n\n        def get_billing_details(self, account):\n            return calculate_billing(account)\n\nIn order to ensure a consistent code style an assertion error will be raised if you include a redundant method name argument that matches the default method name. For example, the following code *will raise an error*:\n\n    billing_details = serializers.SerializerMethodField('get_billing_details')\n\n#### Enforcing consistent `source` usage.\n\nI've see several codebases that unnecessarily include the `source` argument, setting it to the same value as the field name. This usage is redundant and confusing, making it less obvious that `source` is usually not required.\n\nThe following usage will *now raise an error*:\n\n    email = serializers.EmailField(source='email')\n\n#### The `UniqueValidator` and `UniqueTogetherValidator` classes.\n\nREST framework now provides new validators that allow you to ensure field uniqueness, while still using a completely explicit `Serializer` class instead of using `ModelSerializer`.\n\nThe `UniqueValidator` should be applied to a serializer field, and takes a single `queryset` argument.\n\n    from rest_framework import serializers\n    from rest_framework.validators import UniqueValidator\n\n    class OrganizationSerializer(serializers.Serializer):\n        url = serializers.HyperlinkedIdentityField(view_name='organization_detail')\n        created = serializers.DateTimeField(read_only=True)\n        name = serializers.CharField(\n            max_length=100,\n            validators=UniqueValidator(queryset=Organization.objects.all())\n        )\n\nThe `UniqueTogetherValidator` should be applied to a serializer, and takes a `queryset` argument and a `fields` argument which should be a list or tuple of field names.\n\n    class RaceResultSerializer(serializers.Serializer):\n        category = serializers.ChoiceField(['5k', '10k'])\n        position = serializers.IntegerField()\n        name = serializers.CharField(max_length=100)\n\n        class Meta:\n            validators = [UniqueTogetherValidator(\n                queryset=RaceResult.objects.all(),\n                fields=['category', 'position']\n            )]\n\n#### The `UniqueForDateValidator` classes.\n\nREST framework also now includes explicit validator classes for validating the `unique_for_date`, `unique_for_month`, and `unique_for_year` model field constraints. These are used internally instead of calling into `Model.full_clean()`.\n\nThese classes are documented in the [Validators](../api-guide/validators.md) section of the documentation.\n\n---\n\n## Generic views\n\n#### Simplification of view logic.\n\nThe view logic for the default method handlers has been significantly simplified, due to the new serializers API.\n\n#### Changes to pre/post save hooks.\n\nThe `pre_save` and `post_save` hooks no longer exist, but are replaced with `perform_create(self, serializer)` and `perform_update(self, serializer)`.\n\nThese methods should save the object instance by calling `serializer.save()`, adding in any additional arguments as required. They may also perform any custom pre-save or post-save behavior.\n\nFor example:\n\n    def perform_create(self, serializer):\n        # Include the owner attribute directly, rather than from request data.\n        instance = serializer.save(owner=self.request.user)\n        # Perform a custom post-save action.\n        send_email(instance.to_email, instance.message)\n\nThe `pre_delete` and `post_delete` hooks no longer exist, and are replaced with `.perform_destroy(self, instance)`, which should delete the instance and perform any custom actions.\n\n    def perform_destroy(self, instance):\n        # Perform a custom pre-delete action.\n        send_deletion_alert(user=instance.created_by, deleted=instance)\n        # Delete the object instance.\n        instance.delete()\n\n#### Removal of view attributes.\n\nThe `.object` and `.object_list` attributes are no longer set on the view instance. Treating views as mutable object instances that store state during the processing of the view tends to be poor design, and can lead to obscure flow logic.\n\nI would personally recommend that developers treat view instances as immutable objects in their application code.\n\n#### PUT as create.\n\nAllowing `PUT` as create operations is problematic, as it necessarily exposes information about the existence or non-existence of objects. It's also not obvious that transparently allowing re-creating of previously deleted instances is necessarily a better default behavior than simply returning `404` responses.\n\nBoth styles \"`PUT` as 404\" and \"`PUT` as create\" can be valid in different circumstances, but we've now opted for the 404 behavior as the default, due to it being simpler and more obvious.\n\nIf you need to restore the previous behavior you may want to include [this `AllowPUTAsCreateMixin` class](https://gist.github.com/tomchristie/a2ace4577eff2c603b1b) as a mixin to your views.\n\n#### Customizing error responses.\n\nThe generic views now raise `ValidationFailed` exception for invalid data. This exception is then dealt with by the exception handler, rather than the view returning a `400 Bad Request` response directly.\n\nThis change means that you can now easily customize the style of error responses across your entire API, without having to modify any of the generic views.\n\n---\n\n## The metadata API\n\nBehavior for dealing with `OPTIONS` requests was previously built directly into the class-based views. This has now been properly separated out into a Metadata API that allows the same pluggable style as other API policies in REST framework.\n\nThis makes it far easier to use a different style for `OPTIONS` responses throughout your API, and makes it possible to create third-party metadata policies.\n\n---\n\n## Serializers as HTML forms\n\nREST framework 3.0 includes templated HTML form rendering for serializers.\n\nThis API should not yet be considered finalized, and will only be promoted to public API for the 3.1 release.\n\nSignificant changes that you do need to be aware of include:\n\n* Nested HTML forms are now supported, for example, a `UserSerializer` with a nested `ProfileSerializer` will now render a nested `fieldset` when used in the browsable API.\n* Nested lists of HTML forms are not yet supported, but are planned for 3.1.\n* Because we now use templated HTML form generation, **the `widget` option is no longer available for serializer fields**. You can instead control the template that is used for a given field, by using the `style` dictionary.\n\n#### The `style` keyword argument for serializer fields.\n\nThe `style` keyword argument can be used to pass through additional information from a serializer field, to the renderer class. In particular, the `HTMLFormRenderer` uses the `base_template` key to determine which template to render the field with.\n\nFor example, to use a `textarea` control instead of the default `input` control, you would use the following…\n\n    additional_notes = serializers.CharField(\n        style={'base_template': 'textarea.html'}\n    )\n\nSimilarly, to use a radio button control instead of the default `select` control, you would use the following…\n\n    color_channel = serializers.ChoiceField(\n        choices=['red', 'blue', 'green'],\n        style={'base_template': 'radio.html'}\n    )\n\nThis API should be considered provisional, and there may be minor alterations with the incoming 3.1 release.\n\n---\n\n## API style\n\nThere are some improvements in the default style we use in our API responses.\n\n#### Unicode JSON by default.\n\nUnicode JSON is now the default. The `UnicodeJSONRenderer` class no longer exists, and the `UNICODE_JSON` setting has been added. To revert this behavior use the new setting:\n\n    REST_FRAMEWORK = {\n        'UNICODE_JSON': False\n    }\n\n#### Compact JSON by default.\n\nWe now output compact JSON in responses by default. For example, we return:\n\n    {\"email\":\"amy@example.com\",\"is_admin\":true}\n\nInstead of the following:\n\n    {\"email\": \"amy@example.com\", \"is_admin\": true}\n\nThe `COMPACT_JSON` setting has been added, and can be used to revert this behavior if needed:\n\n    REST_FRAMEWORK = {\n        'COMPACT_JSON': False\n    }\n\n#### File fields as URLs\n\nThe `FileField` and `ImageField` classes are now represented as URLs by default. You should ensure you set Django's [standard `MEDIA_URL` setting](https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-MEDIA_URL) appropriately, and ensure your application [serves the uploaded files](https://docs.djangoproject.com/en/stable/howto/static-files/#serving-uploaded-files-in-development).\n\nYou can revert this behavior, and display filenames in the representation by using the `UPLOADED_FILES_USE_URL` settings key:\n\n    REST_FRAMEWORK = {\n        'UPLOADED_FILES_USE_URL': False\n    }\n\nYou can also modify serializer fields individually, using the `use_url` argument:\n\n    uploaded_file = serializers.FileField(use_url=False)\n\nAlso note that you should pass the `request` object to the serializer as context when instantiating it, so that a fully qualified URL can be returned. Returned URLs will then be of the form `https://example.com/url_path/filename.txt`. For example:\n\n    context = {'request': request}\n    serializer = ExampleSerializer(instance, context=context)\n    return Response(serializer.data)\n\nIf the request is omitted from the context, the returned URLs will be of the form `/url_path/filename.txt`.\n\n#### Throttle headers using `Retry-After`.\n\nThe custom `X-Throttle-Wait-Second` header has now been dropped in favor of the standard `Retry-After` header. You can revert this behavior if needed by writing a custom exception handler for your application.\n\n#### Date and time objects as ISO-8601 strings in serializer data.\n\nDate and Time objects are now coerced to strings by default in the serializer output. Previously they were returned as `Date`, `Time` and `DateTime` objects, and later coerced to strings by the renderer.\n\nYou can modify this behavior globally by settings the existing `DATE_FORMAT`, `DATETIME_FORMAT` and `TIME_FORMAT` settings keys. Setting these values to `None` instead of their default value of `'iso-8601'` will result in native objects being returned in serializer data.\n\n    REST_FRAMEWORK = {\n        # Return native `Date` and `Time` objects in `serializer.data`\n        'DATETIME_FORMAT': None\n        'DATE_FORMAT': None\n        'TIME_FORMAT': None\n    }\n\nYou can also modify serializer fields individually, using the `date_format`, `time_format` and `datetime_format` arguments:\n\n    # Return `DateTime` instances in `serializer.data`, not strings.\n    created = serializers.DateTimeField(format=None)\n\n#### Decimals as strings in serializer data.\n\nDecimals are now coerced to strings by default in the serializer output. Previously they were returned as `Decimal` objects, and later coerced to strings by the renderer.\n\nYou can modify this behavior globally by using the `COERCE_DECIMAL_TO_STRING` settings key.\n\n    REST_FRAMEWORK = {\n        'COERCE_DECIMAL_TO_STRING': False\n    }\n\nOr modify it on an individual serializer field, using the `coerce_to_string` keyword argument.\n\n    # Return `Decimal` instances in `serializer.data`, not strings.\n    amount = serializers.DecimalField(\n        max_digits=10,\n        decimal_places=2,\n        coerce_to_string=False\n    )\n\nThe default JSON renderer will return float objects for un-coerced `Decimal` instances. This allows you to easily switch between string or float representations for decimals depending on your API design needs.\n\n---\n\n## Miscellaneous notes\n\n* The serializer `ChoiceField` does not currently display nested choices, as was the case in 2.4. This will be address as part of 3.1.\n* Due to the new templated form rendering, the 'widget' option is no longer valid. This means there's no easy way of using third party \"autocomplete\" widgets for rendering select inputs that contain a large number of choices. You'll either need to use a regular select or a plain text input. We may consider addressing this in 3.1 or 3.2 if there's sufficient demand.\n* Some of the default validation error messages were rewritten and might no longer be pre-translated. You can still [create language files with Django][django-localization] if you wish to localize them.\n* `APIException` subclasses could previously take any arbitrary type in the `detail` argument. These exceptions now use translatable text strings, and as a result call `force_text` on the `detail` argument, which *must be a string*. If you need complex arguments to an `APIException` class, you should subclass it and override the `__init__()` method. Typically you'll instead want to use a custom exception handler to provide for non-standard error responses.\n\n---\n\n## What's coming next\n\n3.0 is an incremental release, and there are several upcoming features that will build on the baseline improvements that it makes.\n\nThe 3.1 release is planned to address improvements in the following components:\n\n* Public API for using serializers as HTML forms.\n* Request parsing, mediatypes & the implementation of the browsable API.\n* Introduction of a new pagination API.\n* Better support for API versioning.\n\nThe 3.2 release is planned to introduce an alternative admin-style interface to the browsable API.\n\nYou can follow development on the GitHub site, where we use [milestones to indicate planning timescales](https://github.com/encode/django-rest-framework/milestones).\n\n[kickstarter]: https://www.kickstarter.com/projects/tomchristie/django-rest-framework-3\n[sponsors]: https://www.django-rest-framework.org/community/kickstarter-announcement/#sponsors\n[mixins.py]: https://github.com/encode/django-rest-framework/blob/main/rest_framework/mixins.py\n[django-localization]: https://docs.djangoproject.com/en/stable/topics/i18n/translation/#localization-how-to-create-language-files\n"
  },
  {
    "path": "docs/community/3.1-announcement.md",
    "content": "# Django REST framework 3.1\n\nThe 3.1 release is an intermediate step in the Kickstarter project releases, and includes a range of new functionality.\n\nSome highlights include:\n\n* A super-smart cursor pagination scheme.\n* An improved pagination API, supporting header or in-body pagination styles.\n* Pagination controls rendering in the browsable API.\n* Better support for API versioning.\n* Built-in internationalization support.\n* Support for Django 1.8's `HStoreField` and `ArrayField`.\n\n---\n\n## Pagination\n\nThe pagination API has been improved, making it both easier to use, and more powerful.\n\nA guide to the headline features follows. For full details, see [the pagination documentation][pagination].\n\nNote that as a result of this work a number of settings keys and generic view attributes are now moved to pending deprecation. Controlling pagination styles is now largely handled by overriding a pagination class and modifying its configuration attributes.\n\n* The `PAGINATE_BY` settings key will continue to work but is now pending deprecation. The more obviously named `PAGE_SIZE` settings key should now be used instead.\n* The `PAGINATE_BY_PARAM`, `MAX_PAGINATE_BY` settings keys will continue to work but are now pending deprecation, in favor of setting configuration attributes on the configured pagination class.\n* The `paginate_by`, `page_query_param`, `paginate_by_param` and `max_paginate_by` generic view attributes will continue to work but are now pending deprecation, in favor of setting configuration attributes on the configured pagination class.\n* The `pagination_serializer_class` view attribute and `DEFAULT_PAGINATION_SERIALIZER_CLASS` settings key **are no longer valid**. The pagination API does not use serializers to determine the output format, and you'll need to instead override the `get_paginated_response` method on a pagination class in order to specify how the output format is controlled.\n\n#### New pagination schemes.\n\nUntil now, there has only been a single built-in pagination style in REST framework. We now have page, limit/offset and cursor based schemes included by default.\n\nThe cursor based pagination scheme is particularly smart, and is a better approach for clients iterating through large or frequently changing result sets. The scheme supports paging against non-unique indexes, by using both cursor and limit/offset information. It also allows for both forward and reverse cursor pagination. Much credit goes to David Cramer for [this blog post](https://cra.mr/2011/03/08/building-cursors-for-the-disqus-api) on the subject.\n\n#### Pagination controls in the browsable API.\n\nPaginated results now include controls that render directly in the browsable API. If you're using the page or limit/offset style, then you'll see a page based control displayed in the browsable API:\n\n![page number based pagination](../img/pages-pagination.png )\n\nThe cursor based pagination renders a more simple style of control:\n\n![cursor based pagination](../img/cursor-pagination.png )\n\n#### Support for header-based pagination.\n\nThe pagination API was previously only able to alter the pagination style in the body of the response. The API now supports being able to write pagination information in response headers, making it possible to use pagination schemes that use the `Link` or `Content-Range` headers.\n\nFor more information, see the [custom pagination styles](../api-guide/pagination.md#custom-pagination-styles) documentation.\n\n---\n\n## Versioning\n\nWe've made it [easier to build versioned APIs][versioning]. Built-in schemes for versioning include both URL based and Accept header based variations.\n\nWhen using a URL based scheme, hyperlinked serializers will resolve relationships to the same API version as used on the incoming request.\n\nFor example, when using `NamespaceVersioning`, and the following hyperlinked serializer:\n\n    class AccountsSerializer(serializer.HyperlinkedModelSerializer):\n        class Meta:\n            model = Accounts\n            fields = ['account_name', 'users']\n\nThe output representation would match the version used on the incoming request. Like so:\n\n    GET http://example.org/v2/accounts/10  # Version 'v2'\n\n    {\n        \"account_name\": \"europa\",\n        \"users\": [\n            \"http://example.org/v2/users/12\",  # Version 'v2'\n            \"http://example.org/v2/users/54\",\n            \"http://example.org/v2/users/87\"\n        ]\n    }\n\n---\n\n## Internationalization\n\nREST framework now includes a built-in set of translations, and [supports internationalized error responses][internationalization]. This allows you to either change the default language, or to allow clients to specify the language via the `Accept-Language` header.\n\nYou can change the default language by using the standard Django `LANGUAGE_CODE` setting:\n\n    LANGUAGE_CODE = \"es-es\"\n\nYou can turn on per-request language requests by adding `LocalMiddleware` to your `MIDDLEWARE_CLASSES` setting:\n\n    MIDDLEWARE_CLASSES = [\n        ...\n        'django.middleware.locale.LocaleMiddleware'\n    ]\n\nWhen per-request internationalization is enabled, client requests will respect the `Accept-Language` header where possible. For example, let's make a request for an unsupported media type:\n\n**Request**\n\n    GET /api/users HTTP/1.1\n    Accept: application/xml\n    Accept-Language: es-es\n    Host: example.org\n\n**Response**\n\n    HTTP/1.0 406 NOT ACCEPTABLE\n\n    {\n        \"detail\": \"No se ha podido satisfacer la solicitud de cabecera de Accept.\"\n    }\n\nNote that the structure of the error responses is still the same. We still have a `detail` key in the response. If needed you can modify this behavior too, by using a [custom exception handler][custom-exception-handler].\n\nWe include built-in translations both for standard exception cases, and for serializer validation errors.\n\nThe full list of supported languages can be found on our [Transifex project page](https://www.transifex.com/django-rest-framework-1/django-rest-framework/).\n\nIf you only wish to support a subset of the supported languages, use Django's standard `LANGUAGES` setting:\n\n    LANGUAGES = [\n        ('de', _('German')),\n        ('en', _('English')),\n    ]\n\nFor more details, see the [internationalization documentation][internationalization].\n\nMany thanks to [Craig Blaszczyk](https://github.com/jakul) for helping push this through.\n\n---\n\n## New field types\n\nDjango 1.8's new `ArrayField`, `HStoreField` and `UUIDField` are now all fully supported.\n\nThis work also means that we now have both `serializers.DictField()`, and `serializers.ListField()` types, allowing you to express and validate a wider set of representations.\n\nIf you're building a new 1.8 project, then you should probably consider using `UUIDField` as the primary keys for all your models. This style will work automatically with hyperlinked serializers, returning URLs in the following style:\n\n    http://example.org/api/purchases/9b1a433f-e90d-4948-848b-300fdc26365d\n\n---\n\n## ModelSerializer API\n\nThe serializer redesign in 3.0 did not include any public API for modifying how ModelSerializer classes automatically generate a set of fields from a given mode class. We've now re-introduced an API for this, allowing you to create new ModelSerializer base classes that behave differently, such as using a different default style for relationships.\n\nFor more information, see the documentation on [customizing field mappings][customizing-field-mappings] for ModelSerializer classes.\n\n---\n\n## Moving packages out of core\n\nWe've now moved a number of packages out of the core of REST framework, and into separately installable packages. If you're currently using these you don't need to worry, you simply need to `pip install` the new packages, and change any import paths.\n\nWe're making this change in order to help distribute the maintenance workload, and keep better focus of the core essentials of the framework.\n\nThe change also means we can be more flexible with which external packages we recommend. For example, the excellently maintained [Django OAuth toolkit](https://github.com/jazzband/django-oauth-toolkit) has now been promoted as our recommended option for integrating OAuth support.\n\nThe following packages are now moved out of core and should be separately installed:\n\n* OAuth - [djangorestframework-oauth](https://jpadilla.github.io/django-rest-framework-oauth/)\n* XML - [djangorestframework-xml](https://jpadilla.github.io/django-rest-framework-xml/)\n* YAML - [djangorestframework-yaml](https://jpadilla.github.io/django-rest-framework-yaml/)\n* JSONP - [djangorestframework-jsonp](https://jpadilla.github.io/django-rest-framework-jsonp/)\n\nIt's worth reiterating that this change in policy shouldn't mean any work in your codebase other than adding a new requirement and modifying some import paths. For example to install XML rendering, you would now do:\n\n    pip install djangorestframework-xml\n\nAnd modify your settings, like so:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_RENDERER_CLASSES': [\n            'rest_framework.renderers.JSONRenderer',\n            'rest_framework.renderers.BrowsableAPIRenderer',\n            'rest_framework_xml.renderers.XMLRenderer'\n        ]\n    }\n\nThanks go to the latest member of our maintenance team, [José Padilla](https://github.com/jpadilla/), for handling this work and taking on ownership of these packages.\n\n---\n\n## Deprecations\n\nThe `request.DATA`, `request.FILES` and `request.QUERY_PARAMS` attributes move from pending deprecation, to deprecated. Use `request.data` and `request.query_params` instead, as discussed in the 3.0 release notes.\n\nThe ModelSerializer Meta options for `write_only_fields`, `view_name` and `lookup_field` are also moved from pending deprecation, to deprecated. Use `extra_kwargs` instead, as discussed in the 3.0 release notes.\n\nAll these attributes and options will still work in 3.1, but their usage will raise a warning. They will be fully removed in 3.2.\n\n---\n\n## What's next?\n\nThe next focus will be on HTML renderings of API output and will include:\n\n* HTML form rendering of serializers.\n* Filtering controls built-in to the browsable API.\n* An alternative admin-style interface.\n\nThis will either be made as a single 3.2 release, or split across two separate releases, with the HTML forms and filter controls coming in 3.2, and the admin-style interface coming in a 3.3 release.\n\n[custom-exception-handler]: ../api-guide/exceptions.md#custom-exception-handling\n[pagination]: ../api-guide/pagination.md\n[versioning]: ../api-guide/versioning.md\n[internationalization]: ../topics/internationalization.md\n[customizing-field-mappings]: ../api-guide/serializers.md#customizing-field-mappings\n"
  },
  {
    "path": "docs/community/3.10-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.10\n\nThe 3.10 release drops support for Python 2.\n\n* Our supported Python versions are now: 3.5, 3.6, and 3.7.\n* Our supported Django versions are now: 1.11, 2.0, 2.1, and 2.2.\n\n## OpenAPI Schema Generation\n\nSince we first introduced schema support in Django REST Framework 3.5, OpenAPI has emerged as the widely adopted standard for modeling Web APIs.\n\nThis release begins the deprecation process for the CoreAPI based schema generation, and introduces OpenAPI schema generation in its place.\n\n---\n\n## Continuing to use CoreAPI\n\nIf you're currently using the CoreAPI schemas, you'll need to make sure to\nupdate your REST framework settings to include `DEFAULT_SCHEMA_CLASS` explicitly.\n\n**settings.py**:\n\n```python\nREST_FRAMEWORK = {\n    ...: ...,\n    \"DEFAULT_SCHEMA_CLASS\": \"rest_framework.schemas.coreapi.AutoSchema\",\n}\n```\n\nYou'll still be able to keep using CoreAPI schemas, API docs, and client for the\nforeseeable future. We'll aim to ensure that the CoreAPI schema generator remains\navailable as a third party package, even once it has eventually been removed\nfrom REST framework, scheduled for version 3.12.\n\nWe have removed the old documentation for the CoreAPI based schema generation.\nYou may view the [Legacy CoreAPI documentation here][legacy-core-api-docs].\n\n----\n\n## OpenAPI Quickstart\n\nYou can generate a static OpenAPI schema, using the `generateschema` management\ncommand.\n\nAlternately, to have the project serve an API schema, use the `get_schema_view()`\nshortcut.\n\nIn your `urls.py`:\n\n```python\nfrom rest_framework.schemas import get_schema_view\n\nurlpatterns = [\n    # ...\n    # Use the `get_schema_view()` helper to add a `SchemaView` to project URLs.\n    #   * `title` and `description` parameters are passed to `SchemaGenerator`.\n    #   * Provide view name for use with `reverse()`.\n    path(\n        \"openapi\",\n        get_schema_view(title=\"Your Project\", description=\"API for all things …\"),\n        name=\"openapi-schema\",\n    ),\n    # ...\n]\n```\n\n### Customization\n\nFor customizations that you want to apply across the entire API, you can subclass `rest_framework.schemas.openapi.SchemaGenerator` and provide it as an argument\nto the `generateschema` command or `get_schema_view()` helper function.\n\nFor specific per-view customizations, you can subclass `AutoSchema`,\nmaking sure to set `schema = <YourCustomClass>` on the view.\n\nFor more details, see the [API Schema documentation](../api-guide/schemas.md).\n\n### API Documentation\n\nThere are some great third party options for documenting your API, based on the\nOpenAPI schema.\n\nSee the [Documenting you API](../topics/documenting-your-api.md) section for more details.\n\n---\n\n## Feature Roadmap\n\nGiven that our OpenAPI schema generation is a new feature, it's likely that there\nwill still be some iterative improvements for us to make. There will be two\nmain cases here:\n\n* Expanding the supported range of OpenAPI schemas that are generated by default.\n* Improving the ability for developers to customize the output.\n\nWe'll aim to bring the first type of change quickly in point releases. For the\nsecond kind we'd like to adopt a slower approach, to make sure we keep the API\nsimple, and as widely applicable as possible, before we bring in API changes.\n\nIt's also possible that we'll end up implementing API documentation and API client\ntooling that are driven by the OpenAPI schema. The `apistar` project has a\nsignificant amount of work towards this. However, if we do so, we'll plan\non keeping any tooling outside of the core framework.\n\n---\n\n## Funding\n\nREST framework is a *collaboratively funded project*. If you use\nREST framework commercially we strongly encourage you to invest in its\ncontinued development by **[signing up for a paid plan][funding]**.\n\n*Every single sign-up helps us make REST framework long-term financially sustainable.*\n\n<ul class=\"premium-promo promo\">\n    <li><a href=\"https://getsentry.com/welcome/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)\">Sentry</a></li>\n    <li><a href=\"https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)\">Stream</a></li>\n    <li><a href=\"https://software.esg-usa.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/esg-new-logo.png)\">ESG</a></li>\n    <li><a href=\"https://rollbar.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar2.png)\">Rollbar</a></li>\n    <li><a href=\"https://cadre.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/cadre.png)\">Cadre</a></li>\n    <li><a href=\"https://hubs.ly/H0f30Lf0\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/kloudless-plus-text.png)\">Kloudless</a></li>\n    <li><a href=\"https://lightsonsoftware.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/lightson-dark.png)\">Lights On Software</a></li>\n</ul>\n<div style=\"clear: both; padding-bottom: 20px;\"></div>\n\n*Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [ESG](https://software.esg-usa.com/), [Rollbar](https://rollbar.com/?utm_source=django&utm_medium=sponsorship&utm_campaign=freetrial), [Cadre](https://cadre.com), [Kloudless](https://hubs.ly/H0f30Lf0), and [Lights On Software](https://lightsonsoftware.com).*\n\n[legacy-core-api-docs]:https://github.com/encode/django-rest-framework/blob/3.14.0/docs/coreapi/index.md\n[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors\n[funding]: https://opencollective.com/django-rest-framework\n"
  },
  {
    "path": "docs/community/3.11-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.11\n\nThe 3.11 release adds support for Django 3.0.\n\n* Our supported Python versions are now: 3.5, 3.6, 3.7, and 3.8.\n* Our supported Django versions are now: 1.11, 2.0, 2.1, 2.2, and 3.0.\n\nThis release will be the last to support Python 3.5 or Django 1.11.\n\n## OpenAPI Schema Generation Improvements\n\nThe OpenAPI schema generation continues to mature. Some highlights in 3.11\ninclude:\n\n* Automatic mapping of Django REST Framework renderers and parsers into OpenAPI\n  request and response media-types.\n* Improved mapping JSON schema mapping types, for example in HStoreFields, and\n  with large integer values.\n* Porting of the old CoreAPI parsing of docstrings to form OpenAPI operation\n  descriptions.\n\nIn this example view operation descriptions for the `get` and `post` methods will\nbe extracted from the class docstring:\n\n```python\nclass DocStringExampleListView(APIView):\n    \"\"\"\n    get: A description of my GET operation.\n    post: A description of my POST operation.\n    \"\"\"\n\n    permission_classes = [permissions.IsAuthenticatedOrReadOnly]\n\n    def get(self, request, *args, **kwargs): ...\n\n    def post(self, request, *args, **kwargs): ...\n```\n\n## Validator / Default Context\n\nIn some circumstances a Validator class or a Default class may need to access the serializer field with which it is called, or the `.context` with which the serializer was instantiated. In particular:\n\n* Uniqueness validators need to be able to determine the name of the field to which they are applied, in order to run an appropriate database query.\n* The `CurrentUserDefault` needs to be able to determine the context with which the serializer was instantiated, in order to return the current user instance.\n\nOur previous approach to this was that implementations could include a `set_context` method, which would be called prior to validation. However this approach had issues with potential race conditions. We have now move this approach into a pending deprecation state. It will continue to function, but will be escalated to a deprecated state in 3.12, and removed entirely in 3.13.\n\nInstead, validators or defaults which require the serializer context, should include a `requires_context = True` attribute on the class.\n\nThe `__call__` method should then include an additional `serializer_field` argument.\n\nValidator implementations will look like this:\n\n```python\nclass CustomValidator:\n    requires_context = True\n\n    def __call__(self, value, serializer_field): ...\n```\n\nDefault implementations will look like this:\n\n```python\nclass CustomDefault:\n    requires_context = True\n\n    def __call__(self, serializer_field): ...\n```\n\n---\n\n## Funding\n\nREST framework is a *collaboratively funded project*. If you use\nREST framework commercially we strongly encourage you to invest in its\ncontinued development by **[signing up for a paid plan][funding]**.\n\n*Every single sign-up helps us make REST framework long-term financially sustainable.*\n\n<ul class=\"premium-promo promo\">\n    <li><a href=\"https://getsentry.com/welcome/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)\">Sentry</a></li>\n    <li><a href=\"https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)\">Stream</a></li>\n    <li><a href=\"https://software.esg-usa.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/esg-new-logo.png)\">ESG</a></li>\n    <li><a href=\"https://rollbar.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar2.png)\">Rollbar</a></li>\n    <li><a href=\"https://cadre.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/cadre.png)\">Cadre</a></li>\n    <li><a href=\"https://hubs.ly/H0f30Lf0\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/kloudless-plus-text.png)\">Kloudless</a></li>\n    <li><a href=\"https://lightsonsoftware.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/lightson-dark.png)\">Lights On Software</a></li>\n    <li><a href=\"https://retool.com/?utm_source=djangorest&utm_medium=sponsorship\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/retool-sidebar.png)\">Retool</a></li>\n</ul>\n<div style=\"clear: both; padding-bottom: 20px;\"></div>\n\n*Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [ESG](https://software.esg-usa.com/), [Rollbar](https://rollbar.com/?utm_source=django&utm_medium=sponsorship&utm_campaign=freetrial), [Cadre](https://cadre.com), [Kloudless](https://hubs.ly/H0f30Lf0), [Lights On Software](https://lightsonsoftware.com), and [Retool](https://retool.com/?utm_source=djangorest&utm_medium=sponsorship).*\n\n[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors\n[funding]: https://opencollective.com/django-rest-framework\n"
  },
  {
    "path": "docs/community/3.12-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.12\n\nREST framework 3.12 brings a handful of refinements to the OpenAPI schema\ngeneration, plus support for Django's new database-agnostic `JSONField`,\nand some improvements to the `SearchFilter` class.\n\n## Grouping operations with tags.\n\nOpen API schemas will now automatically include tags, based on the first element\nin the URL path.\n\nFor example...\n\nMethod                          | Path            | Tags\n--------------------------------|-----------------|-------------\n`GET`, `PUT`, `PATCH`, `DELETE` | `/users/{id}/`  | `['users']`\n`GET`, `POST`                   | `/users/`       | `['users']`\n`GET`, `PUT`, `PATCH`, `DELETE` | `/orders/{id}/` | `['orders']`\n`GET`, `POST`                   | `/orders/`      | `['orders']`\n\nThe tags used for a particular view may also be overridden...\n\n```python\nclass MyOrders(APIView):\n    schema = AutoSchema(tags=[\"users\", \"orders\"])\n    ...\n```\n\nSee [the schema documentation](https://www.django-rest-framework.org/api-guide/schemas/#grouping-operations-with-tags) for more information.\n\n## Customizing the operation ID.\n\nREST framework automatically determines operation IDs to use in OpenAPI\nschemas. The latest version provides more control for overriding the behavior\nused to generate the operation IDs.\n\nSee [the schema documentation](https://www.django-rest-framework.org/api-guide/schemas/#operationid) for more information.\n\n## Support for OpenAPI components.\n\nIn order to output more graceful OpenAPI schemes, REST framework 3.12 now\ndefines components in the schema, and then references them inside request\nand response objects. This is in contrast with the previous approach, which\nfully expanded the request and response bodies for each operation.\n\nThe names used for a component default to using the serializer class name, [but\nmay be overridden if needed](https://www.django-rest-framework.org/api-guide/schemas/#components\n)...\n\n```python\nclass MyOrders(APIView):\n    schema = AutoSchema(component_name=\"OrderDetails\")\n```\n\n## More Public API\n\nMany methods on the `AutoSchema` class have now been promoted to public API,\nallowing you to more fully customize the schema generation. The following methods\nare now available for overriding...\n\n* `get_path_parameters`\n* `get_pagination_parameters`\n* `get_filter_parameters`\n* `get_request_body`\n* `get_responses`\n* `get_serializer`\n* `get_paginator`\n* `map_serializer`\n* `map_field`\n* `map_choice_field`\n* `map_field_validators`\n* `allows_filters`.\n\nSee [the schema docs](https://www.django-rest-framework.org/api-guide/schemas/#per-view-customization)\nfor details on using custom `AutoSchema` subclasses.\n\n## Support for JSONField.\n\nDjango 3.1 deprecated the existing `django.contrib.postgres.fields.JSONField`\nin favor of a new database-agnositic `JSONField`.\n\nREST framework 3.12 now supports this new model field, and `ModelSerializer`\nclasses will correctly map the model field.\n\n## SearchFilter improvements\n\nThere are a couple of significant improvements to the `SearchFilter` class.\n\n### Nested searches against JSONField and HStoreField\n\nThe class now supports nested search within `JSONField` and `HStoreField`, using\nthe double underscore notation for traversing which element of the field the\nsearch should apply to.\n\n```python\nclass SitesSearchView(generics.ListAPIView):\n    \"\"\"\n    An API view to return a list of archaeological sites, optionally filtered\n    by a search against the site name or location. (Location searches are\n    matched against the region and country names.)\n    \"\"\"\n\n    queryset = Sites.objects.all()\n    serializer_class = SitesSerializer\n    filter_backends = [filters.SearchFilter]\n    search_fields = [\"site_name\", \"location__region\", \"location__country\"]\n```\n\n### Searches against annotate fields\n\nDjango allows querysets to create additional virtual fields, using the `.annotate`\nmethod. We now support searching against annotate fields.\n\n```python\nclass PublisherSearchView(generics.ListAPIView):\n    \"\"\"\n    Search for publishers, optionally filtering the search against the average\n    rating of all their books.\n    \"\"\"\n\n    queryset = Publisher.objects.annotate(avg_rating=Avg(\"book__rating\"))\n    serializer_class = PublisherSerializer\n    filter_backends = [filters.SearchFilter]\n    search_fields = [\"avg_rating\"]\n```\n\n---\n\n## Deprecations\n\n### `serializers.NullBooleanField`\n\n`serializers.NullBooleanField` is now pending deprecation, and will be removed in 3.14.\n\nInstead use `serializers.BooleanField` field and set `allow_null=True` which does the same thing.\n\n---\n\n## Funding\n\nREST framework is a *collaboratively funded project*. If you use\nREST framework commercially we strongly encourage you to invest in its\ncontinued development by **[signing up for a paid plan][funding]**.\n\n*Every single sign-up helps us make REST framework long-term financially sustainable.*\n\n<ul class=\"premium-promo promo\">\n    <li><a href=\"https://getsentry.com/welcome/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)\">Sentry</a></li>\n    <li><a href=\"https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)\">Stream</a></li>\n    <li><a href=\"https://software.esg-usa.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/esg-new-logo.png)\">ESG</a></li>\n    <li><a href=\"https://rollbar.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar2.png)\">Rollbar</a></li>\n    <li><a href=\"https://cadre.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/cadre.png)\">Cadre</a></li>\n    <li><a href=\"https://hubs.ly/H0f30Lf0\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/kloudless-plus-text.png)\">Kloudless</a></li>\n    <li><a href=\"https://lightsonsoftware.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/lightson-dark.png)\">Lights On Software</a></li>\n    <li><a href=\"https://retool.com/?utm_source=djangorest&utm_medium=sponsorship\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/retool-sidebar.png)\">Retool</a></li>\n</ul>\n<div style=\"clear: both; padding-bottom: 20px;\"></div>\n\n*Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [ESG](https://software.esg-usa.com/), [Rollbar](https://rollbar.com/?utm_source=django&utm_medium=sponsorship&utm_campaign=freetrial), [Cadre](https://cadre.com), [Kloudless](https://hubs.ly/H0f30Lf0), [Lights On Software](https://lightsonsoftware.com), and [Retool](https://retool.com/?utm_source=djangorest&utm_medium=sponsorship).*\n\n[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors\n[funding]: https://opencollective.com/django-rest-framework\n"
  },
  {
    "path": "docs/community/3.13-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.13\n\n## Django 4.0 support\n\nThe latest release now fully supports Django 4.0.\n\nOur requirements are now:\n\n* Python 3.6+\n* Django 4.0, 3.2, 3.1, 2.2 (LTS)\n\n## Fields arguments are now keyword-only\n\nWhen instantiating fields on serializers, you should always use keyword arguments,\nsuch as `serializers.CharField(max_length=200)`. This has always been the case,\nand all the examples that we have in the documentation use keyword arguments,\nrather than positional arguments.\n\nFrom REST framework 3.13 onwards, this is now *explicitly enforced*.\n\nThe most feasible cases where users might be accidentally omitting the keyword arguments\nare likely in the composite fields, `ListField` and `DictField`. For instance...\n\n```python\naliases = serializers.ListField(serializers.CharField())\n```\n\nThey must now use the more explicit keyword argument style...\n\n```python\naliases = serializers.ListField(child=serializers.CharField())\n```\n\nThis change has been made because using positional arguments here *does not* result in the expected behavior.\n\nSee Pull Request [#7632](https://github.com/encode/django-rest-framework/pull/7632) for more details.\n"
  },
  {
    "path": "docs/community/3.14-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.14\n\n## Django 4.1 support\n\nThe latest release now fully supports Django 4.1, and drops support for Django 2.2.\n\nOur requirements are now:\n\n* Python 3.6+\n* Django 4.1, 4.0, 3.2, 3.1, 3.0\n\n## `raise_exception` argument for `is_valid` is now keyword-only.\n\nCalling `serializer_instance.is_valid(True)` is no longer acceptable syntax.\nIf you'd like to use the `raise_exception` argument, you must use it as a\nkeyword argument.\n\nSee Pull Request [#7952](https://github.com/encode/django-rest-framework/pull/7952) for more details.\n\n## `ManyRelatedField` supports returning the default when the source attribute doesn't exist.\n\nPreviously, if you used a serializer field with `many=True` with a dot notated source field\nthat didn't exist, it would raise an `AttributeError`. Now it will return the default or be\nskipped depending on the other arguments.\n\nSee Pull Request [#7574](https://github.com/encode/django-rest-framework/pull/7574) for more details.\n\n\n## Make Open API `get_reference` public.\n\nReturns a reference to the serializer component. This may be useful if you override `get_schema()`.\n\n## Change semantic of OR of two permission classes.\n\nWhen OR-ing two permissions, the request has to pass either class's `has_permission() and has_object_permission()`.\n\nPreviously, both class's `has_permission()` was ignored when OR-ing two permissions together.\n\nSee Pull Request [#7522](https://github.com/encode/django-rest-framework/pull/7522) for more details.\n\n## Minor fixes and improvements\n\nThere are a number of minor fixes and improvements in this release. See the [release notes](release-notes.md) page for a complete listing.\n\n---\n\n## Deprecations\n\n### `serializers.NullBooleanField`\n\n`serializers.NullBooleanField` was moved to pending deprecation in 3.12, and deprecated in 3.13. It has now been removed from the core framework.\n\nInstead use `serializers.BooleanField` field and set `allow_null=True` which does the same thing.\n"
  },
  {
    "path": "docs/community/3.15-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.15\n\nAt the Internet, on March 15th, 2024, with 176 commits by 138 authors, we are happy to announce the release of Django REST framework 3.15.\n\n## Django 5.0 and Python 3.12 support\n\nThe latest release now fully supports Django 5.0 and Python 3.12.\n\nThe current minimum versions of Django still is 3.0 and Python 3.6.\n\n## Primary Support of UniqueConstraint\n\n`ModelSerializer` generates validators for [UniqueConstraint](https://docs.djangoproject.com/en/4.0/ref/models/constraints/#uniqueconstraint) (both UniqueValidator and UniqueTogetherValidator)\n\n## SimpleRouter non-regex matching support\n\nBy default the URLs created by `SimpleRouter` use regular expressions. This behavior can be modified by setting the `use_regex_path` argument to `False` when instantiating the router.\n\n## ZoneInfo as the primary source of timezone data\n\nDependency on pytz has been removed and deprecation warnings have been added, Django will provide ZoneInfo instances as long as USE_DEPRECATED_PYTZ is not enabled. More info on the migration can be found [in this guide](https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html).\n\n##  Align `SearchFilter` behavior to `django.contrib.admin` search\n\nSearches now may contain _quoted phrases_ with spaces, each phrase is considered as a single search term, and it will raise a validation error if any null-character is provided in search. See the [Filtering API guide](../api-guide/filtering.md) for more information.\n\n## Other fixes and improvements\n\nThere are a number of fixes and minor improvements in this release, ranging from documentation, internal infrastructure (typing, testing, requirements, deprecation, etc.), security and overall behavior.\n\nSee the [release notes](release-notes.md) page for a complete listing.\n"
  },
  {
    "path": "docs/community/3.16-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.16\n\nAt the Internet, on March 28th, 2025, we are happy to announce the release of Django REST framework 3.16.\n\n## Updated Django and Python support\n\nThe latest release now fully supports Django 5.1 and the upcoming 5.2 LTS as well as Python 3.13.\n\nThe current minimum versions of Django is now 4.2 and Python 3.9.\n\n## Django LoginRequiredMiddleware\n\nThe new `LoginRequiredMiddleware` introduced by Django 5.1 can now be used alongside Django REST Framework, however it is not honored for API views as an equivalent behavior can be configured via `DEFAULT_AUTHENTICATION_CLASSES`. See [our dedicated section](../api-guide/authentication.md#django-51-loginrequiredmiddleware) in the docs for more information.\n\n## Improved support for UniqueConstraint\n\nThe generation of validators for [UniqueConstraint](https://docs.djangoproject.com/en/stable/ref/models/constraints/#uniqueconstraint) has been improved to support better nullable fields and constraints with conditions.\n\n## Other fixes and improvements\n\nThere are a number of fixes and minor improvements in this release, ranging from documentation, internal infrastructure (typing, testing, requirements, deprecation, etc.), security and overall behavior.\n\nSee the [release notes](release-notes.md) page for a complete listing.\n"
  },
  {
    "path": "docs/community/3.2-announcement.md",
    "content": "# Django REST framework 3.2\n\nThe 3.2 release is the first version to include an admin interface for the browsable API.\n\n![The AdminRenderer](../img/admin.png)\n\nThis interface is intended to act as a more user-friendly interface to the API. It can be used either as a replacement to the existing `BrowsableAPIRenderer`, or used together with it, allowing you to switch between the two styles as required.\n\nWe've also fixed a huge number of issues, and made numerous cleanups and improvements.\n\nOver the course of the 3.1.x series we've [resolved nearly 600 tickets](https://github.com/encode/django-rest-framework/issues?utf8=%E2%9C%93&q=closed%3A%3E2015-03-05) on our GitHub issue tracker. This means we're currently running at a rate of **closing around 100 issues or pull requests per month**.\n\nNone of this would have been possible without the support of our wonderful Kickstarter backers. If you're looking for a job in Django development we'd strongly recommend taking [a look through our sponsors](https://www.django-rest-framework.org/community/kickstarter-announcement/#sponsors) and finding out who's hiring.\n\n## AdminRenderer\n\nTo include `AdminRenderer` simply add it to your settings:\n\n    REST_FRAMEWORK = {\n        'DEFAULT_RENDERER_CLASSES': [\n            'rest_framework.renderers.JSONRenderer',\n            'rest_framework.renderers.AdminRenderer',\n            'rest_framework.renderers.BrowsableAPIRenderer'\n        ],\n        'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',\n        'PAGE_SIZE': 100\n    }\n\nThere are some limitations to the `AdminRenderer`, in particular it is not yet able to handle list or dictionary inputs, as we do not have any HTML form fields that support those.\n\nAlso note that this is an initial release and we do not yet have a public API for modifying the behavior or documentation on overriding the templates.\n\nThe idea is to get this released to users early, so we can start getting feedback and release a more fully featured version in 3.3.\n\n## Supported versions\n\nThis release drops support for Django 1.4.\n\nOur supported Django versions are now 1.5.6+, 1.6.3+, 1.7 and 1.8.\n\n## Deprecations\n\nThere are no new deprecations in 3.2, although a number of existing deprecations have now escalated in line with our deprecation policy.\n\n* `request.DATA` was put on the deprecation path in 3.0. It has now been removed and its usage will result in an error. Use the more pythonic style of `request.data` instead.\n* `request.QUERY_PARAMS` was put on the deprecation path in 3.0. It has now been removed and its usage will result in an error. Use the more pythonic style of `request.query_params` instead.\n* The following `ModelSerializer.Meta` options have now been removed: `write_only_fields`, `view_name`, `lookup_field`. Use the more general `extra_kwargs` option instead.\n\nThe following pagination view attributes and settings have been moved into attributes on the pagination class since 3.1. Their usage was formerly in 'pending deprecation', and has now escalated to 'deprecated'. They will continue to function but will raise errors.\n\n* `view.paginate_by` - Use `paginator.page_size` instead.\n* `view.page_query_param` - Use `paginator.page_query_param` instead.\n* `view.paginate_by_param` - Use `paginator.page_size_query_param` instead.\n* `view.max_paginate_by` - Use `paginator.max_page_size` instead.\n* `settings.PAGINATE_BY` - Use `paginator.page_size` instead.\n* `settings.PAGINATE_BY_PARAM` - Use `paginator.page_size_query_param` instead.\n* `settings.MAX_PAGINATE_BY` - Use `paginator.max_page_size` instead.\n\n## Modifications to list behaviors\n\nThere are a couple of bug fixes that are worth calling out as they introduce differing behavior.\n\nThese are a little subtle and probably won't affect most users, but are worth understanding before upgrading your project.\n\n### ManyToMany fields and blank=True\n\nWe've now added an `allow_empty` argument, which can be used with `ListSerializer`, or with `many=True` relationships. This is `True` by default, but can be set to `False` if you want to disallow empty lists as valid input.\n\nAs a follow-up to this we are now able to properly mirror the behavior of Django's `ModelForm` with respect to how many-to-many fields are validated.\n\nPreviously a many-to-many field on a model would map to a serializer field that would allow either empty or non-empty list inputs. Now, a many-to-many field will map to a serializer field that requires at least one input, unless the model field has `blank=True` set.\n\nHere's what the mapping looks like in practice:\n\n* `models.ManyToManyField()` → `serializers.PrimaryKeyRelatedField(many=True, allow_empty=False)`\n* `models.ManyToManyField(blank=True)` → `serializers.PrimaryKeyRelatedField(many=True)`\n\nThe upshot is this: If you have many to many fields in your models, then make sure you've included the argument `blank=True` if you want to allow empty inputs in the equivalent `ModelSerializer` fields.\n\n### List fields and allow_null\n\nWhen using `allow_null` with `ListField` or a nested `many=True` serializer the previous behavior was to allow `null` values as items in the list. The behavior is now to allow `null` values instead of the list.\n\nFor example, take the following field:\n\n    NestedSerializer(many=True, allow_null=True)\n\nPreviously the validation behavior would be:\n\n* `[{…}, null, {…}]` is **valid**.\n* `null` is **invalid**.\n\nOur validation behavior as of 3.2.0 is now:\n\n* `[{…}, null, {…}]` is **invalid**.\n* `null` is **valid**.\n\nIf you want to allow `null` child items, you'll need to instead specify `allow_null` on the child class, using an explicit `ListField` instead of `many=True`. For example:\n\n    ListField(child=NestedSerializer(allow_null=True))\n\n## What's next?\n\nThe 3.3 release is currently planned for the start of October, and will be the last Kickstarter-funded release.\n\nThis release is planned to include:\n\n* Search and filtering controls in the browsable API and admin interface.\n* Improvements and public API for the admin interface.\n* Improvements and public API for our templated HTML forms and fields.\n* Nested object and list support in HTML forms.\n\nThanks once again to all our sponsors and supporters.\n"
  },
  {
    "path": "docs/community/3.3-announcement.md",
    "content": "# Django REST framework 3.3\n\nThe 3.3 release marks the final work in the Kickstarter funded series. We'd like to offer a final resounding **thank you** to all our wonderful sponsors and supporters.\n\nThe amount of work that has been achieved as a direct result of the funding is immense. We've added a huge amounts of new functionality, resolved nearly 2,000 tickets, and redesigned & refined large parts of the project.\n\nIn order to continue driving REST framework forward, we'll shortly be announcing a new set of funding plans. Follow [@_tomchristie](https://twitter.com/_tomchristie) to keep up to date with these announcements, and be among the first set of sign ups.\n\nWe strongly believe that collaboratively funded software development yields outstanding results for a relatively low investment-per-head. If you or your company use REST framework commercially, then we would strongly urge you to participate in this latest funding drive, and help us continue to build an increasingly polished & professional product.\n\n---\n\n## Release notes\n\nSignificant new functionality in the 3.3 release includes:\n\n* Filters presented as HTML controls in the browsable API.\n* A [forms API][forms-api], allowing serializers to be rendered as HTML forms.\n* Django 1.9 support.\n* A [`JSONField` serializer field][jsonfield], corresponding to Django 1.9's Postgres `JSONField` model field.\n* Browsable API support [via AJAX][ajax-form], rather than server side request overloading.\n\n![Filter Controls](../img/filter-controls.png)\n\n*Example of the new filter controls*\n\n---\n\n## Supported versions\n\nThis release drops support for Django 1.5 and 1.6. Django 1.7, 1.8 or 1.9 are now required.\n\nThis brings our supported versions into line with Django's [currently supported versions][django-supported-versions]\n\n## Deprecations\n\nThe AJAX based support for the browsable API means that there are a number of internal cleanups in the `request` class. For the vast majority of developers this should largely remain transparent:\n\n* To support form based `PUT` and `DELETE`, or to support form content types such as JSON, you should now use the [AJAX forms][ajax-form] javascript library. This replaces the previous 'method and content type overloading' that required significant internal complexity to the request class.\n* The `accept` query parameter is no longer supported by the default content negotiation class. If you require it then you'll need to [use a custom content negotiation class][accept-headers].\n* The custom `HTTP_X_HTTP_METHOD_OVERRIDE` header is no longer supported by default. If you require it then you'll need to [use custom middleware][method-override].\n\nThe following pagination view attributes and settings have been moved into attributes on the pagination class since 3.1. Their usage was formerly deprecated, and has now been removed entirely, in line with the deprecation policy.\n\n* `view.paginate_by` - Use `paginator.page_size` instead.\n* `view.page_query_param` - Use `paginator.page_query_param` instead.\n* `view.paginate_by_param` - Use `paginator.page_size_query_param` instead.\n* `view.max_paginate_by` - Use `paginator.max_page_size` instead.\n* `settings.PAGINATE_BY` - Use `paginator.page_size` instead.\n* `settings.PAGINATE_BY_PARAM` - Use `paginator.page_size_query_param` instead.\n* `settings.MAX_PAGINATE_BY` - Use `paginator.max_page_size` instead.\n\nThe `ModelSerializer` and `HyperlinkedModelSerializer` classes should now include either a `fields` or `exclude` option, although the `fields = '__all__'` shortcut may be used. Failing to include either of these two options is currently pending deprecation, and will be removed entirely in the 3.5 release. This behavior brings `ModelSerializer` more closely in line with Django's `ModelForm` behavior.\n\n[forms-api]: ../topics/html-and-forms.md\n[ajax-form]: https://github.com/encode/ajax-form\n[jsonfield]: ../api-guide/fields.md#jsonfield\n[accept-headers]: ../topics/browser-enhancements.md#url-based-accept-headers\n[method-override]: ../topics/browser-enhancements.md#http-header-based-method-overriding\n[django-supported-versions]: https://www.djangoproject.com/download/#supported-versions\n"
  },
  {
    "path": "docs/community/3.4-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.4\n\nThe 3.4 release is the first in a planned series that will be addressing schema\ngeneration, hypermedia support, API clients, and finally realtime support.\n\n---\n\n## Funding\n\nThe 3.4 release has been made possible a recent [Mozilla grant][moss], and by our\n[collaborative funding model][funding]. If you use REST framework commercially, and would\nlike to see this work continue, we strongly encourage you to invest in its\ncontinued development by **[signing up for a paid plan][funding]**.\n\nThe initial aim is to provide a single full-time position on REST framework.\nRight now we're over 60% of the way towards achieving that.\n*Every single sign-up makes a significant impact.*\n\n<ul class=\"premium-promo promo\">\n    <li><a href=\"https://www.rover.com/careers/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)\">Rover.com</a></li>\n    <li><a href=\"https://sentry.io/welcome/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)\">Sentry</a></li>\n    <li><a href=\"https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)\">Stream</a></li>\n</ul>\n<div style=\"clear: both; padding-bottom: 20px;\"></div>\n\n*Many thanks to all our [awesome sponsors][sponsors], and in particular to our premium backers, [Rover](https://www.rover.com/careers/), [Sentry](https://sentry.io/welcome/), and [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf).*\n\n---\n\n## Schemas & client libraries\n\nREST framework 3.4 brings built-in support for generating API schemas.\n\nWe provide this support by using [Core API][core-api], a Document Object Model\nfor describing APIs.\n\nBecause Core API represents the API schema in an format-independent\nmanner, we're able to render the Core API `Document` object into many different\nschema formats, by allowing the renderer class to determine how the internal\nrepresentation maps onto the external schema format.\n\nThis approach should also open the door to a range of auto-generated API\ndocumentation options in the future, by rendering the `Document` object into\nHTML documentation pages.\n\nAlongside the built-in schema support, we're also now providing the following:\n\n* A [command line tool][command-line-client] for interacting with APIs.\n* A [Python client library][client-library] for interacting with APIs.\n\nThese API clients are dynamically driven, and able to interact with any API\nthat exposes a supported schema format.\n\nDynamically driven clients allow you to interact with an API at an application\nlayer interface, rather than a network layer interface, while still providing\nthe benefits of RESTful Web API design.\n\nWe're expecting to expand the range of languages that we provide client libraries\nfor over the coming months.\n\nFurther work on maturing the API schema support is also planned, including\ndocumentation on supporting file upload and download, and improved support for\ndocumentation generation and parameter annotation.\n\n---\n\nCurrent support for schema formats is as follows:\n\nName                             | Support                             | PyPI package\n---------------------------------|-------------------------------------|--------------------------------\n[Core JSON][core-json]           | Schema generation & client support. | Built-in support in `coreapi`.\n[Swagger / OpenAPI][swagger]     | Schema generation & client support. | The `openapi-codec` package.\n[JSON Hyper-Schema][hyperschema] | Currently client support only.      | The `hyperschema-codec` package.\n[API Blueprint][api-blueprint]   | Not yet available.                  | Not yet available.\n\n---\n\nYou can read more about any of this new functionality in the following:\n\n* New tutorial section on [schemas & client libraries][tut-7].\n* Documentation page on [schema generation][schema-generation].\n* Topic page on [API clients][api-clients].\n\nIt is also worth noting that Marc Gibbons is currently working towards a 2.0 release of\nthe popular Django REST Swagger package, which will tie in with our new built-in support.\n\n---\n\n## Supported versions\n\nThe 3.4.0 release adds support for Django 1.10.\n\nThe following versions of Python and Django are now supported:\n\n* Django versions 1.8, 1.9, and 1.10.\n* Python versions 2.7, 3.2(\\*), 3.3(\\*), 3.4, 3.5.\n\n(\\*) Note that Python 3.2 and 3.3 are not supported from Django 1.9 onwards.\n\n---\n\n## Deprecations and changes\n\nThe 3.4 release includes very limited deprecation or behavioral changes, and\nshould present a straightforward upgrade.\n\n### Use fields or exclude on serializer classes.\n\nThe following change in 3.3.0 is now escalated from \"pending deprecation\" to\n\"deprecated\". Its usage will continue to function but will raise warnings:\n\n`ModelSerializer` and `HyperlinkedModelSerializer` should include either a `fields`\noption, or an `exclude` option. The `fields = '__all__'` shortcut may be used\nto explicitly include all fields.\n\n### Microsecond precision when returning time or datetime.\n\nUsing the default JSON renderer and directly returning a `datetime` or `time`\ninstance will now render with microsecond precision (6 digits), rather than\nmillisecond precision (3 digits). This makes the output format consistent with the\ndefault string output of `serializers.DateTimeField` and `serializers.TimeField`.\n\nThis change *does not affect the default behavior when using serializers*,\nwhich is to serialize `datetime` and `time` instances into strings with\nmicrosecond precision.\n\nThe serializer behavior can be modified if needed, using the `DATETIME_FORMAT`\nand `TIME_FORMAT` settings.\n\nThe renderer behavior can be modified by setting a custom `encoder_class`\nattribute on a `JSONRenderer` subclass.\n\n### Relational choices no longer displayed in OPTIONS requests.\n\nMaking an `OPTIONS` request to views that have a serializer choice field\nwill result in a list of the available choices being returned in the response.\n\nIn cases where there is a relational field, the previous behavior would be\nto return a list of available instances to choose from for that relational field.\n\nIn order to minimize exposed information the behavior now is to *not* return\nchoices information for relational fields.\n\nIf you want to override this new behavior you'll need to [implement a custom\nmetadata class][metadata].\n\nSee [issue #3751][gh3751] for more information on this behavioral change.\n\n---\n\n## Other improvements\n\nThis release includes further work from a huge number of [pull requests and issues][milestone].\n\nMany thanks to all our contributors who've been involved in the release, either through raising issues, giving feedback, improving the documentation, or suggesting and implementing code changes.\n\nThe full set of itemized release notes [are available here][release-notes].\n\n[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors\n[moss]: mozilla-grant.md\n[funding]: https://opencollective.com/django-rest-framework\n[core-api]: https://www.coreapi.org/\n[command-line-client]: https://github.com/encode/django-rest-framework/blob/3.4.7/docs/topics/api-clients.md#command-line-client\n[client-library]: https://github.com/encode/django-rest-framework/blob/3.4.7/docs/topics/api-clients.md#python-client-library\n[core-json]: https://www.coreapi.org/specification/encoding/#core-json-encoding\n[swagger]: https://openapis.org/specification\n[hyperschema]: https://json-schema.org/latest/json-schema-hypermedia.html\n[api-blueprint]: https://apiblueprint.org/\n[tut-7]: https://github.com/encode/django-rest-framework/blob/3.4.7/docs/tutorial/7-schemas-and-client-libraries.md\n[schema-generation]: ../api-guide/schemas.md\n[api-clients]: https://github.com/encode/django-rest-framework/blob/3.14.0/docs/topics/api-clients.md\n[milestone]: https://github.com/encode/django-rest-framework/milestone/35\n[release-notes]: ./release-notes.md#34x-series\n[metadata]: ../api-guide/metadata.md#custom-metadata-classes\n[gh3751]: https://github.com/encode/django-rest-framework/issues/3751\n"
  },
  {
    "path": "docs/community/3.5-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.5\n\nThe 3.5 release is the second in a planned series that is addressing schema\ngeneration, hypermedia support, API client libraries, and finally realtime support.\n\n---\n\n## Funding\n\nThe 3.5 release would not have been possible without our [collaborative funding model][funding].\nIf you use REST framework commercially and would like to see this work continue,\nwe strongly encourage you to invest in its continued development by\n**[signing up for a paid&nbsp;plan][funding]**.\n\n<ul class=\"premium-promo promo\">\n    <li><a href=\"https://www.rover.com/careers/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)\">Rover.com</a></li>\n    <li><a href=\"https://sentry.io/welcome/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)\">Sentry</a></li>\n    <li><a href=\"https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)\">Stream</a></li>\n    <li><a href=\"https://www.machinalis.com/#services\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/Machinalis130.png)\">Machinalis</a></li>\n</ul>\n<div style=\"clear: both; padding-bottom: 20px;\"></div>\n\n*Many thanks to all our [sponsors][sponsors], and in particular to our premium backers, [Rover](https://www.rover.com/careers/), [Sentry](https://sentry.io/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), and [Machinalis](https://www.machinalis.com/#services).*\n\n---\n\n## Improved schema generation\n\nDocstrings on views are now pulled through into schema definitions, allowing\nyou to [use the schema definition to document your&nbsp;API][schema-docs].\n\nThere is now also a shortcut function, `get_schema_view()`, which makes it easier to\n[adding schema views][schema-view] to your API.\n\nFor example, to include a swagger schema to your API, you would do the following:\n\n* Run `pip install django-rest-swagger`.\n\n* Add `'rest_framework_swagger'` to your `INSTALLED_APPS` setting.\n\n* Include the schema view in your URL conf:\n\n```py\nfrom rest_framework.schemas import get_schema_view\nfrom rest_framework_swagger.renderers import OpenAPIRenderer, SwaggerUIRenderer\n\nschema_view = get_schema_view(\n    title=\"Example API\", renderer_classes=[OpenAPIRenderer, SwaggerUIRenderer]\n)\n\nurlpatterns = [path(\"swagger/\", schema_view), ...]\n```\n\nThere have been a large number of fixes to the schema generation. These should\nresolve issues for anyone using the latest version of the `django-rest-swagger`\npackage.\n\nSome of these changes do affect the resulting schema structure,\nso if you're already using schema generation you should make sure to review\n[the deprecation notes](#deprecations), particularly if you're currently using\na dynamic client library to interact with your API.\n\nFinally, we're also now exposing the schema generation as a\n[publicly documented API][schema-generation-api], allowing you to more easily\noverride the behavior.\n\n## Requests test client\n\nYou can now test your project using the `requests` library.\n\nThis exposes exactly the same interface as if you were using a standard\nrequests session instance.\n\n    client = RequestsClient()\n    response = client.get('http://testserver/users/')\n    assert response.status_code == 200\n\nRather than sending any HTTP requests to the network, this interface will\ncoerce all outgoing requests into WSGI, and call into your application directly.\n\n## Core API client\n\nYou can also now test your project by interacting with it using the `coreapi`\nclient library.\n\n    # Fetch the API schema\n    client = CoreAPIClient()\n    schema = client.get('http://testserver/schema/')\n\n    # Create a new organization\n    params = {'name': 'MegaCorp', 'status': 'active'}\n    client.action(schema, ['organizations', 'create'], params)\n\n    # Ensure that the organization exists in the listing\n    data = client.action(schema, ['organizations', 'list'])\n    assert(len(data) == 1)\n    assert(data == [{'name': 'MegaCorp', 'status': 'active'}])\n\nAgain, this will call directly into the application using the WSGI interface,\nrather than making actual network calls.\n\nThis is a good option if you are planning for clients to mainly interact with\nyour API using the `coreapi` client library, or some other auto-generated client.\n\n## Live tests\n\nOne interesting aspect of both the `requests` client and the `coreapi` client\nis that they allow you to write tests in such a way that they can also be made\nto run against a live service.\n\nBy switching the WSGI based client instances to actual instances of `requests.Session`\nor `coreapi.Client` you can have the test cases make actual network calls.\n\nBeing able to write test cases that can exercise your staging or production\nenvironment is a powerful tool. However in order to do this, you'll need to pay\nclose attention to how you handle setup and teardown to ensure a strict isolation\nof test data from other live or staging data.\n\n## RAML support\n\nWe now have preliminary support for [RAML documentation generation][django-rest-raml].\n\n![RAML Example][raml-image]\n\nFurther work on the encoding and documentation generation is planned, in order to\nmake features such as the 'Try it now' support available at a later date.\n\nThis work also now means that you can use the Core API client libraries to interact\nwith APIs that expose a RAML specification. The [RAML codec][raml-codec] gives some examples of\ninteracting with the Spotify API in this way.\n\n## Validation codes\n\nExceptions raised by REST framework now include short code identifiers.\nWhen used together with our customizable error handling, this now allows you to\nmodify the style of API error messages.\n\nAs an example, this allows for the following style of error responses:\n\n    {\n        \"message\": \"You do not have permission to perform this action.\",\n        \"code\": \"permission_denied\"\n    }\n\nThis is particularly useful with validation errors, which use appropriate\ncodes to identify differing kinds of failure...\n\n    {\n        \"name\": {\"message\": \"This field is required.\", \"code\": \"required\"},\n        \"age\": {\"message\": \"A valid integer is required.\", \"code\": \"invalid\"}\n    }\n\n## Client upload & download support\n\nThe Python `coreapi` client library and the Core API command line tool both\nnow fully support file [uploads][uploads] and [downloads][downloads].\n\n---\n\n## Deprecations\n\n### Generating schemas from Router\n\nThe router arguments for generating a schema view, such as `schema_title`,\nare now pending deprecation.\n\nInstead of using `DefaultRouter(schema_title='Example API')`, you should use\nthe `get_schema_view()` function, and include the view in your URL conf.\n\nMake sure to include the view before your router urls. For example:\n\n    from rest_framework.schemas import get_schema_view\n    from my_project.routers import router\n\n    schema_view = get_schema_view(title='Example API')\n\n    urlpatterns = [\n        path('', schema_view),\n        path('', include(router.urls)),\n    ]\n\n### Schema path representations\n\nThe `'pk'` identifier in schema paths is now mapped onto the actually model field\nname by default. This will typically be `'id'`.\n\nThis gives a better external representation for schemas, with less implementation\ndetail being exposed. It also reflects the behavior of using a ModelSerializer\nclass with `fields = '__all__'`.\n\nYou can revert to the previous behavior by setting `'SCHEMA_COERCE_PATH_PK': False`\nin the REST framework settings.\n\n### Schema action name representations\n\nThe internal `retrieve()` and `destroy()` method names are now coerced to an\nexternal representation of `read` and `delete`.\n\nYou can revert to the previous behavior by setting `'SCHEMA_COERCE_METHOD_NAMES': {}`\nin the REST framework settings.\n\n### DjangoFilterBackend\n\nThe functionality of the built-in `DjangoFilterBackend` is now completely\nincluded by the `django-filter` package.\n\nYou should change your imports and REST framework filter settings as follows:\n\n* `rest_framework.filters.DjangoFilterBackend` becomes `django_filters.rest_framework.DjangoFilterBackend`.\n* `rest_framework.filters.FilterSet` becomes `django_filters.rest_framework.FilterSet`.\n\nThe existing imports will continue to work but are now pending deprecation.\n\n### CoreJSON media type\n\nThe media type for `CoreJSON` is now `application/json+coreapi`, rather than\nthe previous `application/vnd.json+coreapi`. This brings it more into line with\nother custom media types, such as those used by Swagger and RAML.\n\nThe clients currently accept either media type. The old style-media type will\nbe deprecated at a later date.\n\n### ModelSerializer 'fields' and 'exclude'\n\nModelSerializer and HyperlinkedModelSerializer must include either a fields\noption, or an exclude option. The `fields = '__all__'` shortcut may be used to\nexplicitly include all fields.\n\nFailing to set either `fields` or `exclude` raised a pending deprecation warning\nin version 3.3 and raised a deprecation warning in 3.4. Its usage is now mandatory.\n\n---\n\n[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors\n[funding]: https://opencollective.com/django-rest-framework\n[uploads]: https://core-api.github.io/python-client/api-guide/utils/#file\n[downloads]: https://core-api.github.io/python-client/api-guide/codecs/#downloadcodec\n[schema-generation-api]: ../api-guide/schemas.md#schemagenerator\n[schema-docs]: ../api-guide/schemas.md#schemas-as-documentation\n[schema-view]: ../api-guide/schemas.md#get_schema_view\n[django-rest-raml]: https://github.com/encode/django-rest-raml\n[raml-image]: ../img/raml.png\n[raml-codec]: https://github.com/core-api/python-raml-codec\n"
  },
  {
    "path": "docs/community/3.6-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.6\n\nThe 3.6 release adds two major new features to REST framework.\n\n1. Built-in interactive API documentation support.\n2. A new JavaScript client&nbsp;library.\n\n![API Documentation](/img/api-docs.gif)\n\n*Above: The interactive API documentation.*\n\n---\n\n## Funding\n\nThe 3.6 release would not have been possible without our [backing from Mozilla](mozilla-grant.md) to the project, and our [collaborative funding&nbsp;model][funding].\n\nIf you use REST framework commercially and would like to see this work continue,\nwe strongly encourage you to invest in its continued development by\n**[signing up for a paid&nbsp;plan][funding]**.\n\n<ul class=\"premium-promo promo\">\n    <li><a href=\"https://www.rover.com/careers/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)\">Rover.com</a></li>\n    <li><a href=\"https://sentry.io/welcome/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)\">Sentry</a></li>\n    <li><a href=\"https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)\">Stream</a></li>\n    <li><a href=\"https://machinalis.com/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/Machinalis130.png)\">Machinalis</a></li>\n    <li><a href=\"https://rollbar.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar.png)\">Rollbar</a></li>\n    <li><a href=\"https://micropyramid.com/django-rest-framework-development-services/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/mp-text-logo.png)\">MicroPyramid</a></li>\n</ul>\n<div style=\"clear: both; padding-bottom: 20px;\"></div>\n\n*Many thanks to all our [sponsors][sponsors], and in particular to our premium backers, [Rover](https://www.rover.com/careers/), [Sentry](https://sentry.io/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [Machinalis](https://machinalis.com/), [Rollbar](https://rollbar.com), and [MicroPyramid](https://micropyramid.com/django-rest-framework-development-services/).*\n\n---\n\n## Interactive API documentation\n\nREST framework's new API documentation supports a number of features:\n\n* Live API interaction.\n* Support for various authentication schemes.\n* Code snippets for the Python, JavaScript, and Command Line clients.\n\nThe `coreapi` library is required as a dependency for the API docs. Make sure\nto install the latest version (2.3.0 or above). The `pygments` and `markdown`\nlibraries are optional but recommended.\n\nTo install the API documentation, you'll need to include it in your projects URLconf:\n\n    from rest_framework.documentation import include_docs_urls\n\n    API_TITLE = 'API title'\n    API_DESCRIPTION = '...'\n\n    urlpatterns = [\n        ...\n        path('docs/', include_docs_urls(title=API_TITLE, description=API_DESCRIPTION))\n    ]\n\nOnce installed you should see something a little like this:\n\n![API Documentation](/img/api-docs.png)\n\nWe'll likely be making further refinements to the API documentation over the\ncoming weeks. Keep in mind that this is a new feature, and please do give\nus feedback if you run into any issues or limitations.\n\nFor more information on documenting your API endpoints see the [\"Documenting your API\"][api-docs] section.\n\n---\n\n## JavaScript client library\n\nThe JavaScript client library allows you to load an API schema, and then interact\nwith that API at an application layer interface, rather than constructing fetch\nrequests explicitly.\n\nHere's a brief example that demonstrates:\n\n* Loading the client library and schema.\n* Instantiating an authenticated client.\n* Making an API request using the client.\n\n**index.html**\n\n    <html>\n        <head>\n            <script src=\"/static/rest_framework/js/coreapi-0.1.0.js\"></script>\n            <script src=\"/docs/schema.js\"></script>\n            <script>\n                const coreapi = window.coreapi\n                const schema = window.schema\n\n                // Instantiate a client...\n                let auth = coreapi.auth.TokenAuthentication({scheme: 'JWT', token: 'xxx'})\n                let client = coreapi.Client({auth: auth})\n\n                // Make an API request...\n                client.action(schema, ['projects', 'list']).then(function(result) {\n                    alert(result)\n                })\n            </script>\n        </head>\n    </html>\n\nThe JavaScript client library supports various authentication schemes, and can be\nused by your project itself, or as an external client interacting with your API.\n\nThe client is not limited to usage with REST framework APIs, although it does\ncurrently only support loading CoreJSON API schemas. Support for Swagger and\nother API schemas is planned.\n\nFor more details see the [JavaScript client library documentation][js-docs].\n\n## Authentication classes for the Python client library\n\nPrevious authentication support in the Python client library was limited to\nallowing users to provide explicit header values.\n\nWe now have better support for handling the details of authentication, with\nthe introduction of the `BasicAuthentication`, `TokenAuthentication`, and\n`SessionAuthentication` schemes.\n\nYou can include the authentication scheme when instantiating a new client.\n\n    auth = coreapi.auth.TokenAuthentication(scheme='JWT', token='xxx-xxx-xxx')\n    client = coreapi.Client(auth=auth)\n\nFor more information see the [Python client library documentation][py-docs].\n\n---\n\n## Deprecations\n\n### Updating coreapi\n\nIf you're using REST framework's schema generation, or want to use the API docs,\nthen you'll need to update to the latest version of coreapi. (2.3.0)\n\n### Generating schemas from Router\n\nThe 3.5 \"pending deprecation\" of router arguments for generating a schema view, such as `schema_title`, `schema_url` and `schema_renderers`, have now been escalated to a\n\"deprecated\" warning.\n\nInstead of using `DefaultRouter(schema_title='Example API')`, you should use the `get_schema_view()` function, and include the view explicitly in your URL conf.\n\n### DjangoFilterBackend\n\nThe 3.5 \"pending deprecation\" warning of the built-in `DjangoFilterBackend` has now\nbeen escalated to a \"deprecated\" warning.\n\nYou should change your imports and REST framework filter settings as follows:\n\n* `rest_framework.filters.DjangoFilterBackend` becomes `django_filters.rest_framework.DjangoFilterBackend`.\n* `rest_framework.filters.FilterSet` becomes `django_filters.rest_framework.FilterSet`.\n\n---\n\n## What's next\n\nThere are likely to be a number of refinements to the API documentation and\nJavaScript client library over the coming weeks, which could include some of the following:\n\n* Support for private API docs, requiring login.\n* File upload and download support in the JavaScript client & API docs.\n* Comprehensive documentation for the JavaScript client library.\n* Automatically including authentication details in the API doc code snippets.\n* Adding authentication support in the command line client.\n* Support for loading Swagger and other schemas in the JavaScript client.\n* Improved support for documenting parameter schemas and response schemas.\n* Refining the API documentation interaction modal.\n\nOnce work on those refinements is complete, we'll be starting feature work\non realtime support, for the 3.7 release.\n\n[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors\n[funding]: https://opencollective.com/django-rest-framework\n[api-docs]: ../topics/documenting-your-api.md\n[js-docs]: https://github.com/encode/django-rest-framework/blob/3.14.0/docs/topics/api-clients.md#javascript-client-library\n[py-docs]: https://github.com/encode/django-rest-framework/blob/3.14.0/docs/topics/api-clients.md#python-client-library\n"
  },
  {
    "path": "docs/community/3.7-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.7\n\nThe 3.7 release focuses on improvements to schema generation and the interactive API documentation.\n\nThis release has been made possible by [Bayer](https://www.bayer.com/) who have sponsored the release.\n\n<a href=\"https://www.bayer.com/\"><img src=\"/img/bayer.png\"/></a>\n\n---\n\n## Funding\n\nIf you use REST framework commercially and would like to see this work continue, we strongly encourage you to invest in its continued development by\n**[signing up for a paid&nbsp;plan][funding]**.\n\n<ul class=\"premium-promo promo\">\n    <li><a href=\"https://www.rover.com/careers/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)\">Rover.com</a></li>\n    <li><a href=\"https://sentry.io/welcome/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)\">Sentry</a></li>\n    <li><a href=\"https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)\">Stream</a></li>\n    <li><a href=\"https://machinalis.com/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/Machinalis130.png)\">Machinalis</a></li>\n    <li><a href=\"https://rollbar.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar.png)\">Rollbar</a></li>\n</ul>\n<div style=\"clear: both; padding-bottom: 20px;\"></div>\n\n*As well as our release sponsor, we'd like to say thanks in particular our premium backers, [Rover](https://www.rover.com/careers/), [Sentry](https://sentry.io/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [Machinalis](https://machinalis.com/), and [Rollbar](https://rollbar.com).*\n\n---\n\n## Customizing API docs & schema generation.\n\nThe schema generation introduced in 3.5 and the related API docs generation in 3.6 are both hugely powerful features, however they've been somewhat limited in cases where the view introspection isn't able to correctly identify the schema for a particular view.\n\nIn order to try to address this we're now adding the ability for per-view customization of the API schema. The interface that we're adding for this allows either basic manual overrides over which fields should be included on a view, or for more complex programmatic overriding of the schema generation. We believe this release comprehensively addresses some of the existing shortcomings of the schema features.\n\nLet's take a quick look at using the new functionality...\n\nThe `APIView` class has a `schema` attribute, that is used to control how the Schema for that particular view is generated. The default behavior is to use the `AutoSchema` class.\n\n    from rest_framework.views import APIView\n    from rest_framework.schemas import AutoSchema\n\n    class CustomView(APIView):\n        schema = AutoSchema()  # Included for demonstration only. This is the default behavior.\n\nWe can remove a view from the API schema and docs, like so:\n\n    class CustomView(APIView):\n        schema = None\n\nIf we want to mostly use the default behavior, but additionally include some additional fields on a particular view, we can now do so easily...\n\n    class CustomView(APIView):\n        schema = AutoSchema(manual_fields=[\n            coreapi.Field('search', location='query')\n        ])\n\nTo ignore the automatic generation for a particular view, and instead specify the schema explicitly, we use the `ManualSchema` class instead...\n\n    class CustomView(APIView):\n        schema = ManualSchema(fields=[...])\n\nFor more advanced behaviors you can subclass `AutoSchema` to provide for customized schema generation, and apply that to particular views.\n\n    class CustomView(APIView):\n        schema = CustomizedSchemaGeneration()\n\nFor full details on the new functionality, please see the [Schema Documentation][schema-docs].\n\n---\n\n## Django 2.0 support\n\nREST framework 3.7 supports Django versions 1.10, 1.11, and 2.0 alpha.\n\n---\n\n## Minor fixes and improvements\n\nThere are a large number of minor fixes and improvements in this release. See the [release notes](release-notes.md) page for a complete listing.\n\nThe number of [open tickets against the project](https://github.com/encode/django-rest-framework/issues) currently at its lowest number in quite some time, and we're continuing to focus on reducing these to a manageable amount.\n\n---\n\n## Deprecations\n\n### `exclude_from_schema`\n\nBoth `APIView.exclude_from_schema` and the `exclude_from_schema` argument to the `@api_view` decorator and now `PendingDeprecation`. They will be moved to deprecated in the 3.8 release, and removed entirely in 3.9.\n\nFor `APIView` you should instead set a `schema = None` attribute on the view class.\n\nFor function based views the `@schema` decorator can be used to exclude the view from the schema, by using `@schema(None)`.\n\n### `DjangoFilterBackend`\n\nThe `DjangoFilterBackend` was moved to pending deprecation in 3.5, and deprecated in 3.6. It has now been removed from the core framework.\n\nThe functionality remains fully available, but is instead provided in the `django-filter` package.\n\n---\n\n## What's next\n\nWe're still planning to work on improving real-time support for REST framework by providing documentation on integrating with Django channels, as well adding support for more easily adding WebSocket support to existing HTTP endpoints.\n\nThis will likely be timed so that any REST framework development here ties in with similar work on [API Star][api-star].\n\n[funding]: https://opencollective.com/django-rest-framework\n[schema-docs]: ../api-guide/schemas.md\n[api-star]: https://github.com/encode/apistar\n"
  },
  {
    "path": "docs/community/3.8-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.8\n\nThe 3.8 release is a maintenance focused release resolving a large number of previously outstanding issues and laying\nthe foundations for future changes.\n\n---\n\n## Funding\n\nIf you use REST framework commercially and would like to see this work continue, we strongly encourage you to invest in its continued development by\n**[signing up for a paid&nbsp;plan][funding]**.\n\n\n*We'd like to say thanks in particular our premium backers, [Rover](https://www.rover.com/careers/), [Sentry](https://sentry.io/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [Machinalis](https://machinalis.com/), and [Rollbar](https://rollbar.com).*\n\n---\n\n## Breaking Changes\n\n### Altered the behavior of `read_only` plus `default` on Field.\n\n[#5886][gh5886] `read_only` fields will now **always** be excluded from writable fields.\n\nPreviously `read_only` fields when combined with a `default` value would use the `default` for create and update\noperations. This was counter-intuitive in some circumstances and led to difficulties supporting dotted `source`\nattributes on nullable relations.\n\nIn order to maintain the old behavior you may need to pass the value of `read_only` fields when calling `save()` in\nthe view:\n\n    def perform_create(self, serializer):\n        serializer.save(owner=self.request.user)\n\nAlternatively you may override `save()` or `create()` or `update()` on the serializer as appropriate.\n\n---\n\n## Deprecations\n\n### `action` decorator replaces `list_route` and `detail_route`\n\n[#5705][gh5705] `list_route` and `detail_route` have been merge into a single `action` decorator. This improves viewset action introspection, and will allow extra actions to be displayed in the Browsable API in future versions.\n\nBoth `list_route` and `detail_route` are now pending deprecation. They will be deprecated in 3.9 and removed entirely\nin 3.10.\n\nThe new `action` decorator takes a boolean `detail` argument.\n\n* Replace `detail_route` uses with `@action(detail=True)`.\n* Replace `list_route` uses with `@action(detail=False)`.\n\n\n### `exclude_from_schema`\n\nBoth `APIView.exclude_from_schema` and the `exclude_from_schema` argument to the `@api_view` decorator are now deprecated. They will be removed entirely in 3.9.\n\nFor `APIView` you should instead set a `schema = None` attribute on the view class.\n\nFor function based views the `@schema` decorator can be used to exclude the view from the schema, by using `@schema(None)`.\n\n---\n\n## Minor fixes and improvements\n\nThere are a large number of minor fixes and improvements in this release. See the [release notes](release-notes.md) page\nfor a complete listing.\n\n\n## What's next\n\nWe're currently working towards moving to using [OpenAPI][openapi] as our default schema output. We'll also be revisiting our API documentation generation and client libraries.\n\nWe're doing some consolidation in order to make this happen. It's planned that 3.9 will drop the `coreapi` and `coreschema` libraries, and instead use `apistar` for the API documentation generation, schema generation, and API client libraries.\n\n[funding]: https://opencollective.com/django-rest-framework\n[gh5886]: https://github.com/encode/django-rest-framework/issues/5886\n[gh5705]: https://github.com/encode/django-rest-framework/issues/5705\n[openapi]: https://www.openapis.org/\n"
  },
  {
    "path": "docs/community/3.9-announcement.md",
    "content": "<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n# Django REST framework 3.9\n\nThe 3.9 release gives access to _extra actions_ in the Browsable API, introduces composable permissions and built-in [OpenAPI][openapi] schema support. (Formerly known as Swagger)\n\n---\n\n## Funding\n\nIf you use REST framework commercially and would like to see this work continue, we strongly encourage you to invest in its continued development by\n**[signing up for a paid&nbsp;plan][funding]**.\n\n\n<ul class=\"premium-promo promo\">\n    <li><a href=\"https://www.rover.com/careers/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rover_130x130.png)\">Rover.com</a></li>\n    <li><a href=\"https://sentry.io/welcome/\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)\">Sentry</a></li>\n    <li><a href=\"https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)\">Stream</a></li>\n    <li><a href=\"https://auklet.io\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/auklet-new.png)\">Auklet</a></li>\n    <li><a href=\"https://rollbar.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar2.png)\">Rollbar</a></li>\n    <li><a href=\"https://cadre.com\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/cadre.png)\">Cadre</a></li>\n    <li><a href=\"https://loadimpact.com/?utm_campaign=Sponsorship%20links&utm_source=drf&utm_medium=drf\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/load-impact.png)\">Load Impact</a></li>\n    <li><a href=\"https://hubs.ly/H0f30Lf0\" style=\"background-image: url(https://fund-rest-framework.s3.amazonaws.com/kloudless.png)\">Kloudless</a></li>\n</ul>\n<div style=\"clear: both; padding-bottom: 20px;\"></div>\n\n*Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Rover](https://www.rover.com/careers/), [Sentry](https://sentry.io/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [Auklet](https://auklet.io/), [Rollbar](https://rollbar.com), [Cadre](https://cadre.com), [Load Impact](https://loadimpact.com/?utm_campaign=Sponsorship%20links&utm_source=drf&utm_medium=drf), and [Kloudless](https://hubs.ly/H0f30Lf0).*\n\n---\n\n## Built-in OpenAPI schema support\n\nREST framework now has a first-pass at directly including OpenAPI schema support. (Formerly known as Swagger)\n\nSpecifically:\n\n* There are now `OpenAPIRenderer`, and `JSONOpenAPIRenderer` classes that deal with encoding `coreapi.Document` instances into OpenAPI YAML or OpenAPI JSON.\n* The `get_schema_view(...)` method now defaults to OpenAPI YAML, with CoreJSON as a secondary\noption if it is selected via HTTP content negotiation.\n* There is a new management command `generateschema`, which you can use to dump\nthe schema into your repository.\n\nHere's an example of adding an OpenAPI schema to the URL conf:\n\n```python\nfrom rest_framework.schemas import get_schema_view\nfrom rest_framework.renderers import JSONOpenAPIRenderer\nfrom django.urls import path\n\nschema_view = get_schema_view(\n    title=\"Server Monitoring API\",\n    url=\"https://www.example.org/api/\",\n    renderer_classes=[JSONOpenAPIRenderer],\n)\n\nurlpatterns = [path(\"schema.json\", schema_view), ...]\n```\n\nAnd here's how you can use the `generateschema` management command:\n\n```shell\n$ python manage.py generateschema --format openapi > schema.yml\n```\n\nThere's lots of different tooling that you can use for working with OpenAPI\nschemas. One option that we're working on is the [API Star](https://docs.apistar.com/)\ncommand line tool.\n\nYou can use `apistar` to validate your API schema:\n\n```shell\n$ apistar validate --path schema.json --format openapi\n✓ Valid OpenAPI schema.\n```\n\nOr to build API documentation:\n\n```shell\n$ apistar docs --path schema.json --format openapi\n✓ Documentation built at \"build/index.html\".\n```\n\nAPI Star also includes a [dynamic client library](https://docs.apistar.com/client-library/)\nthat uses an API schema to automatically provide a client library interface for making requests.\n\n## Composable permission classes\n\nYou can now compose permission classes using the and/or operators, `&` and `|`.\n\nFor example...\n\n```python\npermission_classes = [IsAuthenticated & (ReadOnly | IsAdminUser)]\n```\n\nIf you're using custom permission classes then make sure that you are subclassing\nfrom `BasePermission` in order to enable this support.\n\n## ViewSet _Extra Actions_ available in the Browsable API\n\nFollowing the introduction of the `action` decorator in v3.8, _extra actions_ defined on a ViewSet are now available\nfrom the Browsable API.\n\n![Extra Actions displayed in the Browsable API](https://user-images.githubusercontent.com/2370209/32976956-1ca9ab7e-cbf1-11e7-981a-a20cb1e83d63.png)\n\nWhen defined, a dropdown of \"Extra Actions\", appropriately filtered to detail/non-detail actions, is displayed.\n\n---\n\n## Supported Versions\n\nREST framework 3.9 supports Django versions 1.11, 2.0, and 2.1.\n\n---\n\n## Deprecations\n\n### `DjangoObjectPermissionsFilter` moved to third-party package.\n\nThe `DjangoObjectPermissionsFilter` class is pending deprecation, will be deprecated in 3.10 and removed entirely in 3.11.\n\nIt has been moved to the third-party [`djangorestframework-guardian`](https://github.com/rpkilby/django-rest-framework-guardian)\npackage. Please use this instead.\n\n### Router argument/method renamed to use `basename` for consistency.\n\n* The `Router.register` `base_name` argument has been renamed in favor of `basename`.\n* The `Router.get_default_base_name` method has been renamed in favor of `Router.get_default_basename`. [#5990][gh5990]\n\nSee [#5990][gh5990].\n\n[gh5990]: https://github.com/encode/django-rest-framework/pull/5990\n\n`base_name` and `get_default_base_name()` are pending deprecation. They will be deprecated in 3.10 and removed entirely in 3.11.\n\n### `action` decorator replaces `list_route` and `detail_route`\n\nBoth `list_route` and `detail_route` are now deprecated in favor of the single `action` decorator.\nThey will be removed entirely in 3.10.\n\nThe `action` decorator takes a boolean `detail` argument.\n\n* Replace `detail_route` uses with `@action(detail=True)`.\n* Replace `list_route` uses with `@action(detail=False)`.\n\n### `exclude_from_schema`\n\nBoth `APIView.exclude_from_schema` and the `exclude_from_schema` argument to the `@api_view` have now been removed.\n\nFor `APIView` you should instead set a `schema = None` attribute on the view class.\n\nFor function-based views the `@schema` decorator can be used to exclude the view from the schema, by using `@schema(None)`.\n\n---\n\n## Minor fixes and improvements\n\nThere are a large number of minor fixes and improvements in this release. See the [release notes](release-notes.md) page for a complete listing.\n\n\n## What's next\n\nWe're planning to iteratively work towards OpenAPI becoming the standard schema\nrepresentation. This will mean that the `coreapi` dependency will gradually become\nremoved, and we'll instead generate the schema directly, rather than building\na CoreAPI `Document` object.\n\nOpenAPI has clearly become the standard for specifying Web APIs, so there's not\nmuch value any more in our schema-agnostic document model. Making this change\nwill mean that we'll more easily be able to take advantage of the full set of\nOpenAPI functionality.\n\nThis will also make a wider range of tooling available.\n\nWe'll focus on continuing to develop the [API Star](https://docs.apistar.com/)\nlibrary and client tool into a recommended option for generating API docs,\nvalidating API schemas, and providing a dynamic client library.\n\nThere's also a huge amount of ongoing work on maturing the ASGI landscape,\nwith the possibility that some of this work will eventually [feed back into\nDjango](https://www.aeracode.org/2018/06/04/django-async-roadmap/).\n\nThere will be further work on the [Uvicorn](https://www.uvicorn.org/)\nweb server, as well as lots of functionality planned for the [Starlette](https://www.starlette.io/)\nweb framework, which is building a foundational set of tooling for working with\nASGI.\n\n\n[funding]: https://opencollective.com/django-rest-framework\n[gh5886]: https://github.com/encode/django-rest-framework/issues/5886\n[gh5705]: https://github.com/encode/django-rest-framework/issues/5705\n[openapi]: https://www.openapis.org/\n[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors\n"
  },
  {
    "path": "docs/community/contributing.md",
    "content": "# Contributing to REST framework\n\n> The world can only really be changed one piece at a time.  The art is picking that piece.\n>\n> &mdash; [Tim Berners-Lee][cite]\n\nThere are many ways you can contribute to Django REST framework.  We'd like it to be a community-led project, so please get involved and help shape the future of the project.\n\n!!! note\n\n    At this point in its lifespan we consider Django REST framework to be feature-complete. We focus on pull requests that track the continued development of Django versions, and generally do not accept new features or code formatting changes.\n\n## Community\n\nThe most important thing you can do to help push the REST framework project forward is to be actively involved wherever possible.  Code contributions are often overvalued as being the primary way to get involved in a project, we don't believe that needs to be the case.\n\nIf you use REST framework, we'd love you to be vocal about your experiences with it - you might consider writing a blog post about using REST framework, or publishing a tutorial about building a project with a particular JavaScript framework.  Experiences from beginners can be particularly helpful because you'll be in the best position to assess which bits of REST framework are more difficult to understand and work with.\n\nOther really great ways you can help move the community forward include helping to answer questions on the [discussion group][google-group], or setting up an [email alert on StackOverflow][so-filter] so that you get notified of any new questions with the `django-rest-framework` tag.\n\nWhen answering questions make sure to help future contributors find their way around by hyperlinking wherever possible to related threads and tickets, and include backlinks from those items if relevant.\n\n## Code of conduct\n\nPlease keep the tone polite & professional.  For some users a discussion on the REST framework mailing list or ticket tracker may be their first engagement with the open source community.  First impressions count, so let's try to make everyone feel welcome.\n\nBe mindful in the language you choose.  As an example, in an environment that is heavily male-dominated, posts that start 'Hey guys,' can come across as unintentionally exclusive.  It's just as easy, and more inclusive to use gender neutral language in those situations.\n\nThe [Django code of conduct][code-of-conduct] gives a fuller set of guidelines for participating in community forums.\n\n## Issues\n\nOur contribution process is that the [GitHub discussions page](https://github.com/encode/django-rest-framework/discussions) should generally be your starting point. Some tips on good potential issue reporting:\n\n* Django REST framework is considered feature-complete. Please do not file requests to change behavior, unless it is required for security reasons or to maintain compatibility with upcoming Django or Python versions.\n* Search the GitHub project page for related items, and make sure you're running the latest version of REST framework before reporting an issue.\n* Feature requests will typically be closed with a recommendation that they be implemented outside the core REST framework library (e.g. as third-party libraries).  This approach allows us to keep down the maintenance overhead of REST framework, so that the focus can be on continued stability and great documentation.\n\n### Triaging issues\n\nGetting involved in triaging incoming issues is a good way to start contributing.  Every single ticket that comes into the ticket tracker needs to be reviewed in order to determine what the next steps should be.  Anyone can help out with this, you just need to be willing to\n\n* Read through the ticket - does it make sense, is it missing any context that would help explain it better?\n* Is the ticket reported in the correct place, would it be better suited as a discussion on the discussion group?\n* If the ticket is a bug report, can you reproduce it? Are you able to write a failing test case that demonstrates the issue and that can be submitted as a pull request?\n* If the ticket is a feature request, could the feature request instead be implemented as a third party package?\n* If a ticket hasn't had much activity and addresses something you need, then comment on the ticket and try to find out what's needed to get it moving again.\n\n## Development\n\nTo start developing on Django REST framework, first create a Fork from the\n[Django REST Framework repo][repo] on GitHub.\n\nThen clone your fork. The clone command will look like this, with your GitHub\nusername instead of YOUR-USERNAME:\n\n    git clone https://github.com/YOUR-USERNAME/django-rest-framework\n\nSee GitHub's [_Fork a Repo_][how-to-fork] Guide for more help.\n\nChanges should broadly follow the [PEP 8][pep-8] style conventions, and we recommend you set up your editor to automatically indicate non-conforming styles.\nYou can check your contributions against these conventions each time you commit using the [pre-commit](https://pre-commit.com/) hooks, which we also run on CI.\nTo set them up, first ensure you have the pre-commit tool installed, for example:\n\n    python -m pip install pre-commit\n\nThen run:\n\n    pre-commit install\n\n### Testing\n\nTo run the tests, clone the repository, and then:\n\n    # Setup the virtual environment\n    python3 -m venv env\n    source env/bin/activate\n    pip install -e . --group dev\n\n    # Run the tests\n    ./runtests.py\n\n!!! tip\n    If your tests require access to the database, do not forget to inherit from `django.test.TestCase` or use the `@pytest.mark.django_db()` decorator.\n\n    For example, with TestCase:\n    \n        from django.test import TestCase\n    \n        class MyDatabaseTest(TestCase):\n            def test_something(self):\n                # Your test code here\n                pass\n    \n    Or with decorator:\n    \n        import pytest\n    \n        @pytest.mark.django_db()\n        class MyDatabaseTest:\n            def test_something(self):\n                # Your test code here\n                pass\n    \n    You can reuse existing models defined in `tests/models.py` for your tests.\n\n#### Test options\n\nRun using a more concise output style.\n\n    ./runtests.py -q\n\n\nIf you do not want the output to be captured (for example, to see print statements directly), you can use the `-s` flag.\n\n    ./runtests.py -s\n\n\nRun the tests for a given test case.\n\n    ./runtests.py MyTestCase\n\nRun the tests for a given test method.\n\n    ./runtests.py MyTestCase.test_this_method\n\nShorter form to run the tests for a given test method.\n\n    ./runtests.py test_this_method\n\n\n!!! note\n    The test case and test method matching is fuzzy and will sometimes run other tests that contain a partial string match to the given  command line input.\n\n#### Running against multiple environments\n\nYou can also use the excellent [tox][tox] testing tool to run the tests against all supported versions of Python and Django.  Install `tox` globally, and then simply run:\n\n    tox\n\n### Pull requests\n\nIt's a good idea to make pull requests early on.  A pull request represents the start of a discussion, and doesn't necessarily need to be the final, finished submission.\n\nIt's also always best to make a new branch before starting work on a pull request.  This means that you'll be able to later switch back to working on another separate issue without interfering with an ongoing pull requests.\n\nIt's also useful to remember that if you have an outstanding pull request then pushing new commits to your GitHub repo will also automatically update the pull requests.\n\nGitHub's documentation for working on pull requests is [available here][pull-requests].\n\nAlways run the tests before submitting pull requests, and ideally run `tox` in order to check that your modifications are compatible on all supported versions of Python and Django.\n\nOnce you've made a pull request take a look at the build status in the GitHub interface and make sure the tests are running as you'd expect.\n\n![Build status][build-status]\n\n*Above: build notifications*\n\n### Managing compatibility issues\n\nSometimes, in order to ensure your code works on various different versions of Django, Python or third party libraries, you'll need to run slightly different code depending on the environment.  Any code that branches in this way should be isolated into the `compat.py` module, and should provide a single common interface that the rest of the codebase can use.\n\n## Documentation\n\nThe documentation for REST framework is built from the [Markdown][markdown] source files in [the docs directory][docs].\n\nThere are many great Markdown editors that make working with the documentation really easy.  The [Mou editor for Mac][mou] is one such editor that comes highly recommended.\n\n### Building the documentation\n\nTo build the documentation, install MkDocs with `pip install mkdocs` and then run the following command.\n\n    mkdocs build\n\nThis will build the documentation into the `site` directory.\n\nYou can build the documentation and open a preview in a browser window by using the `serve` command.\n\n    mkdocs serve\n\n### Language style\n\nDocumentation should be in American English.  The tone of the documentation is very important - try to stick to a simple, plain, objective and well-balanced style where possible.\n\nSome other tips:\n\n* Keep paragraphs reasonably short.\n* Don't use abbreviations such as 'e.g.' but instead use the long form, such as 'For example'.\n\n### Markdown style\n\nThere are a couple of conventions you should follow when working on the documentation.\n\n#### 1. Headers\n\nHeaders should use the hash style.  For example:\n\n    ### Some important topic\n\nThe underline style should not be used.  **Don't do this:**\n\n    Some important topic\n    ====================\n\n#### 2. Links\n\nLinks should always use the reference style, with the referenced hyperlinks kept at the end of the document.\n\n    Here is a link to [some other thing][other-thing].\n\n    More text...\n\n    [other-thing]: http://example.com/other/thing\n\nThis style helps keep the documentation source consistent and readable.\n\nIf you are hyperlinking to another REST framework document, you should use a relative link, and link to the `.md` suffix.  For example:\n\n    [authentication]: ../api-guide/authentication.md\n\nLinking in this style means you'll be able to click the hyperlink in your Markdown editor to open the referenced document.  When the documentation is built, these links will be converted into regular links to HTML pages.\n\n#### 3. Notes\n\nIf you want to draw attention to a note or warning, use an [admonition], like so:\n\n    !!! note\n        A useful documentation note.\n\nThe documentation theme styles `info`, `warning`, `tip` and `danger` admonition types, but more could be added if the need arise.\n\n\n[cite]: https://www.w3.org/People/Berners-Lee/FAQ.html\n[code-of-conduct]: https://www.djangoproject.com/conduct/\n[google-group]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework\n[so-filter]: https://stackexchange.com/filters/66475/rest-framework\n[pep-8]: https://www.python.org/dev/peps/pep-0008/\n[build-status]: ../img/build-status.png\n[pull-requests]: https://help.github.com/articles/using-pull-requests\n[tox]: https://tox.readthedocs.io/en/latest/\n[markdown]: https://daringfireball.net/projects/markdown/basics\n[docs]: https://github.com/encode/django-rest-framework/tree/main/docs\n[mou]: http://mouapp.com/\n[repo]: https://github.com/encode/django-rest-framework\n[how-to-fork]: https://help.github.com/articles/fork-a-repo/\n[admonition]: https://python-markdown.github.io/extensions/admonition/\n"
  },
  {
    "path": "docs/community/jobs.md",
    "content": "# Jobs\n\nLooking for a new Django REST Framework related role? On this site we provide a list of job resources that may be helpful. It's also worth checking out if any of [our sponsors are hiring][sponsors].\n\n\n## Places to look for Django REST Framework Jobs\n\n* [https://www.djangoproject.com/community/jobs/][djangoproject-website]\n* [https://www.python.org/jobs/][python-org-jobs]\n* [https://django.on-remote.com][django-on-remote]\n* [https://djangogigs.com][django-gigs-com]\n* [https://djangojobs.net/jobs/][django-jobs-net]\n* [https://findwork.dev/django-rest-framework-jobs][findwork-dev]\n* [https://www.indeed.com/q-Django-jobs.html][indeed-com]\n* [https://stackoverflow.com/jobs/companies?tl=django][stackoverflow-com]\n* [https://www.upwork.com/o/jobs/browse/skill/django-framework/][upwork-com]\n* [https://www.technojobs.co.uk/django-jobs][technobjobs-co-uk]\n* [https://remoteok.com/remote-django-jobs][remoteok-com]\n* [https://www.remotepython.com/jobs/][remotepython-com]\n* [https://www.pyjobs.com/][pyjobs-com]\n\n\nKnow of any other great resources for Django REST Framework jobs that are missing in our list? Please [submit a pull request][submit-pr] or [email us][anna-email].\n\nWonder how else you can help? One of the best ways you can help Django REST Framework is to ask interviewers if their company is signed up for [REST Framework sponsorship][sponsors] yet.\n\n\n[djangoproject-website]: https://www.djangoproject.com/community/jobs/\n[python-org-jobs]: https://www.python.org/jobs/\n[django-on-remote]: https://django.on-remote.com/\n[django-gigs-com]: https://djangogigs.com\n[django-jobs-net]: https://djangojobs.net/jobs/\n[findwork-dev]: https://findwork.dev/django-rest-framework-jobs\n[indeed-com]: https://www.indeed.com/q-Django-jobs.html\n[stackoverflow-com]: https://stackoverflow.com/jobs/companies?tl=django\n[upwork-com]: https://www.upwork.com/o/jobs/browse/skill/django-framework/\n[technobjobs-co-uk]: https://www.technojobs.co.uk/django-jobs\n[remoteok-com]: https://remoteok.com/remote-django-jobs\n[remotepython-com]: https://www.remotepython.com/jobs/\n[pyjobs-com]: https://www.pyjobs.com/\n[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors\n[submit-pr]: https://github.com/encode/django-rest-framework\n[anna-email]: mailto:anna@django-rest-framework.org\n"
  },
  {
    "path": "docs/community/kickstarter-announcement.md",
    "content": "# Kickstarting Django REST framework 3\n\n---\n\n<iframe style=\"display: block; margin: 0 auto 0 auto\" width=\"480\" height=\"360\" src=\"https://www.kickstarter.com/projects/tomchristie/django-rest-framework-3/widget/video.html\" frameborder=\"0\" scrolling=\"no\"> </iframe>\n\n---\n\nIn order to continue to drive the project forward, I'm launching a Kickstarter campaign to help fund the development of a major new release - Django REST framework 3.\n\n## Project details\n\nThis new release will allow us to comprehensively address some of the shortcomings of the framework, and will aim to include the following:\n\n* Faster, simpler and easier-to-use serializers.\n* An alternative admin-style interface for the browsable API.\n* Search and filtering controls made accessible in the browsable API.\n* Alternative API pagination styles.\n* Documentation around API versioning.\n* Triage of outstanding tickets.\n* Improving the ongoing quality and maintainability of the project.\n\nFull details are available now on the [project page](https://www.kickstarter.com/projects/tomchristie/django-rest-framework-3).\n\nIf you're interested in helping make sustainable open source development a reality please [visit the Kickstarter page](https://www.kickstarter.com/projects/tomchristie/django-rest-framework-3) and consider funding the project.\n\nI can't wait to see where this takes us!\n\nMany thanks to everyone for your support so far,\n\n  Tom Christie :)\n\n---\n\n## Sponsors\n\nWe've now blazed way past all our goals, with a staggering £30,000 (~$50,000), meaning I'll be in a position to work on the project significantly beyond what we'd originally planned for. I owe a huge debt of gratitude to all the wonderful companies and individuals who have been backing the project so generously, and making this possible.\n\n---\n\n### Platinum sponsors\n\nOur platinum sponsors have each made a hugely substantial contribution to the future development of Django REST framework, and I simply can't thank them enough.\n\n<ul class=\"sponsor diamond\">\n<li><a href=\"https://www.eventbrite.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/0-eventbrite.png);\">Eventbrite</a></li>\n</ul>\n\n<ul class=\"sponsor platinum\">\n<li><a href=\"https://www.divio.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/1-divio.png);\">Divio</a></li>\n<li><a href=\"https://onlulu.com\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/1-lulu.png);\">Lulu</a></li>\n<li><a href=\"https://p.ota.to/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/1-potato.png);\">Potato</a></li>\n<li><a href=\"http://www.wiredrive.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/1-wiredrive.png);\">Wiredrive</a></li>\n<li><a href=\"http://www.cyaninc.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/1-cyan.png);\">Cyan</a></li>\n<li><a href=\"https://www.runscope.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/1-runscope.png);\">Runscope</a></li>\n<li><a href=\"http://simpleenergy.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/1-simple-energy.png);\">Simple Energy</a></li>\n<li><a href=\"http://vokalinteractive.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/1-vokal_interactive.png);\">VOKAL Interactive</a></li>\n<li><a href=\"http://www.purplebit.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/1-purplebit.png);\">Purple Bit</a></li>\n<li><a href=\"http://www.kuwaitnet.net/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/1-kuwaitnet.png);\">KuwaitNET</a></li>\n</ul>\n\n<div style=\"clear: both\"></div>\n\n---\n\n### Gold sponsors\n\nOur gold sponsors include companies large and small. Many thanks for their significant funding of the project and their commitment to sustainable open-source development.\n\n<ul class=\"sponsor gold\">\n<li><a href=\"https://laterpay.net/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-laterpay.png);\">LaterPay</a></li>\n<li><a href=\"https://www.schubergphilis.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-schuberg_philis.png);\">Schuberg Philis</a></li>\n<li><a href=\"http://prorenata.se/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-prorenata.png);\">ProReNata AB</a></li>\n<li><a href=\"https://www.sgawebsites.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-sga.png);\">SGA Websites</a></li>\n<li><a href=\"https://www.sirono.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-sirono.png);\">Sirono</a></li>\n<li><a href=\"https://www.vinta.com.br/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-vinta.png);\">Vinta Software Studio</a></li>\n<li><a href=\"https://www.rapasso.nl/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-rapasso.png);\">Rapasso</a></li>\n<li><a href=\"https://mirusresearch.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-mirus_research.png);\">Mirus Research</a></li>\n<li><a href=\"https://hipolabs.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-hipo.png);\">Hipo</a></li>\n<li><a href=\"https://www.byte.nl/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-byte.png);\">Byte</a></li>\n<li><a href=\"https://www.lightningkite.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-lightning_kite.png);\">Lightning Kite</a></li>\n<li><a href=\"https://opbeat.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-opbeat.png);\">Opbeat</a></li>\n<li><a href=\"https://koordinates.com\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-koordinates.png);\">Koordinates</a></li>\n<li><a rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-pulsecode.png);\">Pulsecode Inc.</a></li>\n<li><a rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-singing-horse.png);\">Singing Horse Studio Ltd.</a></li>\n<li><a href=\"https://www.heroku.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-heroku.png);\">Heroku</a></li>\n<li><a href=\"https://www.rheinwerk-verlag.de/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-rheinwerk_verlag.png);\">Rheinwerk Verlag</a></li>\n<li><a href=\"https://www.securitycompass.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-security_compass.png);\">Security Compass</a></li>\n<li><a href=\"https://www.djangoproject.com/foundation/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-django.png);\">Django Software Foundation</a></li>\n<li><a href=\"http://www.hipflaskapp.com\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-hipflask.png);\">Hipflask</a></li>\n<li><a href=\"http://www.crate.io/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-crate.png);\">Crate</a></li>\n<li><a href=\"http://crypticocorp.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-cryptico.png);\">Cryptico Corp</a></li>\n<li><a rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-nexthub.png);\">NextHub</a></li>\n<li><a href=\"https://www.compile.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-compile.png);\">Compile</a></li>\n<li><a rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/2-wusawork.png);\">WusaWork</a></li>\n<li><a href=\"http://envisionlinux.org/blog\" rel=\"nofollow\">Envision Linux</a></li>\n</ul>\n\n<div style=\"clear: both; padding-bottom: 40px;\"></div>\n\n---\n\n### Silver sponsors\n\nThe serious financial contribution that our silver sponsors have made is very much appreciated. I'd like to say a particular thank&nbsp;you to individuals who have chosen to privately support the project at this level.\n\n<ul class=\"sponsor silver\">\n<li><a href=\"https://www.imtapps.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-imt_computer_services.png);\">IMT Computer Services</a></li>\n<li><a href=\"https://wildfish.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-wildfish.png);\">Wildfish</a></li>\n<li><a href=\"https://www.thermondo.de/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-thermondo-gmbh.png);\">Thermondo GmbH</a></li>\n<li><a href=\"https://providenz.fr/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-providenz.png);\">Providenz</a></li>\n<li><a href=\"https://www.alwaysdata.com\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-alwaysdata.png);\">alwaysdata.com</a></li>\n<li><a href=\"https://www.freshrelevance.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-triggered_messaging.png);\">Triggered Messaging</a></li>\n<li><a href=\"https://www.ipushpull.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-ipushpull.png);\">PushPull Technology Ltd</a></li>\n<li><a href=\"http://www.transcode.de/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-transcode.png);\">Transcode</a></li>\n<li><a href=\"https://garfo.io/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-garfo.png);\">Garfo</a></li>\n<li><a href=\"https://goshippo.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-shippo.png);\">Shippo</a></li>\n<li><a href=\"http://www.gizmag.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-gizmag.png);\">Gizmag</a></li>\n<li><a href=\"https://www.tivix.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-tivix.png);\">Tivix</a></li>\n<li><a href=\"https://www.safaribooksonline.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-safari.png);\">Safari</a></li>\n<li><a href=\"http://brightloop.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-brightloop.png);\">Bright Loop</a></li>\n<li><a href=\"http://www.aba-systems.com.au/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-aba.png);\">ABA Systems</a></li>\n<li><a href=\"http://beefarm.ru/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-beefarm.png);\">beefarm.ru</a></li>\n<li><a href=\"http://www.vzzual.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-vzzual.png);\">Vzzual.com</a></li>\n<li><a href=\"http://infinite-code.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-infinite_code.png);\">Infinite Code</a></li>\n<li><a href=\"https://crosswordtracker.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-crosswordtracker.png);\">Crossword Tracker</a></li>\n<li><a href=\"https://www.pkgfarm.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-pkgfarm.png);\">PkgFarm</a></li>\n<li><a href=\"http://life.tl/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-life_the_game.png);\">Life. The Game.</a></li>\n<li><a href=\"http://blimp.io/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-blimp.png);\">Blimp</a></li>\n<li><a href=\"https://www.pathwright.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-pathwright.png);\">Pathwright</a></li>\n<li><a href=\"https://fluxility.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-fluxility.png);\">Fluxility</a></li>\n<li><a href=\"https://teonite.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-teonite.png);\">Teonite</a></li>\n<li><a href=\"https://trackmaven.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-trackmaven.png);\">TrackMaven</a></li>\n<li><a href=\"https://www.phurba.net/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-phurba.png);\">Phurba</a></li>\n<li><a href=\"https://www.nephila.it/it/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-nephila.png);\">Nephila</a></li>\n<li><a href=\"http://www.aditium.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-aditium.png);\">Aditium</a></li>\n<li><a href=\"https://www.eyesopen.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-openeye.png);\">OpenEye Scientific Software</a></li>\n<li><a href=\"https://holvi.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-holvi.png);\">Holvi</a></li>\n<li><a href=\"https://www.cantemo.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-cantemo.gif);\">Cantemo</a></li>\n<li><a href=\"https://www.makespace.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-makespace.png);\">MakeSpace</a></li>\n<li><a href=\"https://www.ax-semantics.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-ax_semantics.png);\">AX Semantics</a></li>\n<li><a href=\"http://istrategylabs.com/\" rel=\"nofollow\" style=\"background-image:url(../../img/sponsors/3-isl.png);\">ISL</a></li>\n</ul>\n\n<div style=\"clear: both; padding-bottom: 40px;\"></div>\n\n**Individual backers**: Paul Hallett, <a href=\"http://www.paulwhippconsulting.com/\">Paul Whipp</a>, Dylan Roy, Jannis Leidel, <a href=\"https://linovia.com/en/\">Xavier Ordoquy</a>, <a href=\"http://spielmannsolutions.com/\">Johannes Spielmann</a>, <a href=\"http://brooklynhacker.com/\">Rob Spectre</a>, <a href=\"https://chrisheisel.com/\">Chris Heisel</a>, Marwan Alsabbagh, Haris Ali, Tuomas Toivonen.\n\n---\n\n### Advocates\n\nThe following individuals made a significant financial contribution to the development of Django REST framework 3, for which I can only offer a huge, warm and sincere thank you!\n\n**Individual backers**: Jure Cuhalev, Kevin Brolly, Ferenc Szalai, Dougal Matthews, Stefan Foulis, Carlos Hernando, Alen Mujezinovic, Ross Crawford-d'Heureuse, George Kappel, Alasdair Nicol, John Carr, Steve Winton, Trey, Manuel Miranda, David Horn, Vince Mi, Daniel Sears, Jamie Matthews, Ryan Currah, Marty Kemka, Scott Nixon, Moshin Elahi, Kevin Campbell, Jose Antonio Leiva Izquierdo, Kevin Stone, Andrew Godwin, Tijs Teulings, Roger Boardman, Xavier Antoviaque, Darian Moody, Lujeni, Jon Dugan, Wiley Kestner, Daniel C. Silverstein, Daniel Hahler, Subodh Nijsure, Philipp Weidenhiller, Yusuke Muraoka, Danny Roa, Reto Aebersold, Kyle Getrost, Décébal Hormuz, James Dacosta, Matt Long, Mauro Rocco, Tyrel Souza, Ryan Campbell, Ville Jyrkkä, Charalampos Papaloizou, Nikolai Røed Kristiansen, Antoni Aloy López, Celia Oakley, Michał Krawczak, Ivan VenOsdel, Tim Watts, Martin Warne, Nicola Jordan, Ryan Kaskel.\n\n**Corporate backers**: Savannah Informatics, Prism Skylabs, Musical Operating Devices.\n\n---\n\n### Supporters\n\nThere were also almost 300 further individuals choosing to help fund the project at other levels or choosing to give anonymously. Again, thank you, thank you, thank you!\n"
  },
  {
    "path": "docs/community/mozilla-grant.md",
    "content": "# Mozilla Grant\n\nWe have recently been [awarded a Mozilla grant](https://blog.mozilla.org/blog/2016/04/13/mozilla-open-source-support-moss-update-q1-2016/), in order to fund the next major releases of REST framework. This work will focus on seamless client-side integration by introducing supporting client libraries that are able to dynamically interact with REST framework APIs. The framework will provide for either hypermedia or schema endpoints, which will expose the available interface for the client libraries to interact with.\n\nAdditionally, we will be building on the realtime support that Django Channels provides, supporting and documenting how to build realtime APIs with REST framework. Again, this will include supporting work in the associated client libraries, making it easier to build richly interactive applications.\n\nThe [Core API](https://www.coreapi.org/) project will provide the foundations for our client library support, and will allow us to support interaction using a wide range of schemas and hypermedia formats. It's worth noting that these client libraries won't be tightly coupled to solely REST framework APIs either, and will be able to interact with *any* API that exposes a supported schema or hypermedia format.\n\nSpecifically, the work includes:\n\n## Client libraries\n\nThis work will include built-in schema and hypermedia support, allowing dynamic client libraries to interact with the API. I'll also be releasing both Python and Javascript client libraries, plus a command-line client, a new tutorial section, and further documentation.\n\n* Client library support in REST framework.\n  * Schema & hypermedia support for REST framework APIs.\n  * A test client, allowing you to write tests that emulate a client library interacting with your API.\n  * New tutorial sections on using client libraries to interact with REST framework APIs.\n* Python client library.\n* JavaScript client library.\n* Command line client.\n\n## Realtime APIs\n\nThe next goal is to build on the realtime support offered by Django Channels, adding support & documentation for building realtime API endpoints.\n\n* Support for API subscription endpoints, using REST framework and Django Channels.\n* New tutorial section on building realtime API endpoints with REST framework.\n* Realtime support in the Python & Javascript client libraries.\n\n## Accountability\n\nIn order to ensure that I can be fully focused on trying to secure a sustainable\n& well-funded open source business I will be leaving my current role at [DabApps](https://www.dabapps.com/)\nat the end of May 2016.\n\nI have formed a UK limited company, [Encode](https://www.encode.io/), which will\nact as the business entity behind REST framework. I will be issuing monthly reports\nfrom Encode on progress both towards the Mozilla grant, and for development time\nfunded via the REST framework paid plans.\n\n<!-- Begin MailChimp Signup Form -->\n<link href=\"//cdn-images.mailchimp.com/embedcode/classic-10_7.css\" rel=\"stylesheet\" type=\"text/css\">\n<style type=\"text/css\">\n    #mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }\n    /* Add your own MailChimp form style overrides in your site stylesheet or in this style block.\n       We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */\n</style>\n<div id=\"mc_embed_signup\">\n<form action=\"//encode.us13.list-manage.com/subscribe/post?u=b6b66bb5e4c7cb484a85c8dd7&amp;id=e382ef68ef\" method=\"post\" id=\"mc-embedded-subscribe-form\" name=\"mc-embedded-subscribe-form\" class=\"validate\" target=\"_blank\" novalidate>\n    <div id=\"mc_embed_signup_scroll\">\n    <h2>Stay up to date, with our monthly progress reports...</h2>\n<div class=\"mc-field-group\">\n    <label for=\"mce-EMAIL\">Email Address </label>\n    <input type=\"email\" value=\"\" name=\"EMAIL\" class=\"required email\" id=\"mce-EMAIL\">\n</div>\n    <div id=\"mce-responses\" class=\"clear\">\n        <div class=\"response\" id=\"mce-error-response\" style=\"display:none\"></div>\n        <div class=\"response\" id=\"mce-success-response\" style=\"display:none\"></div>\n    </div>    <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->\n    <div style=\"position: absolute; left: -5000px;\" aria-hidden=\"true\"><input type=\"text\" name=\"b_b6b66bb5e4c7cb484a85c8dd7_e382ef68ef\" tabindex=\"-1\" value=\"\"></div>\n    <div class=\"clear\"><input type=\"submit\" value=\"Subscribe\" name=\"subscribe\" id=\"mc-embedded-subscribe\" class=\"button\"></div>\n    </div>\n</form>\n</div>\n<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script><script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';}(jQuery));var $mcj = jQuery.noConflict(true);</script>\n<!--End mc_embed_signup-->\n"
  },
  {
    "path": "docs/community/project-management.md",
    "content": "# Project management\n\n> \"No one can whistle a symphony; it takes a whole orchestra to play it\"\n>\n> &mdash; Halford E. Luccock\n\nThis document outlines our project management processes for REST framework.\n\nThe aim is to ensure that the project has a high\n[\"bus factor\"][bus-factor], and can continue to remain well supported for the foreseeable future. Suggestions for improvements to our process are welcome.\n\n---\n\n## Maintenance team\n\n[Participating actively in the REST framework project](contributing.md) **does not require being part of the maintenance team**. Almost every important part of issue triage and project improvement can be actively worked on regardless of your collaborator status on the repository.\n\n#### Composition\n\nThe composition of the maintenance team is handled by [@tomchristie](https://github.com/encode/). Team members will be added as collaborators to the repository.\n\n#### Responsibilities\n\nTeam members have the following responsibilities.\n\n* Close invalid or resolved tickets.\n* Add triage labels and milestones to tickets.\n* Merge finalized pull requests.\n* Build and deploy the documentation, using `mkdocs gh-deploy`.\n* Build and update the included translation packs.\n\nFurther notes for maintainers:\n\n* Code changes should come in the form of a pull request - do not push directly to main.\n* Maintainers should typically not merge their own pull requests.\n* Each issue/pull request should have exactly one label once triaged.\n* Search for un-triaged issues with [is:open no:label][un-triaged].\n\n---\n\n## Release process\n\n* The release manager is selected.\n* The release manager will then have the maintainer role added to PyPI package.\n* The previous manager will then have the maintainer role removed from the PyPI package.\n\nOur PyPI releases is automated in GitHub actions on tag pushes. The following template can be used as a release checklist:\n\n- Create pull request for [release notes](https://github.com/encode/django-rest-framework/blob/mains/docs/topics/release-notes.md):\n    - Start drafting a [new release in GitHub](https://github.com/encode/django-rest-framework/releases/new)\n    - Select the tag that you want to give to the release and the previous tag\n    - Click the \"Generate release notes\" button\n    - Don't confirm anything! Copy the generated content to a file `input.md`\n    - Run `uv tool run linkify-gh-markdown input.md` to make the links absolute\n    - Put the generated content in the `release-notes.md` file\n- Update supported versions:\n    - `pyproject.toml` ensure the `requires-python` key is up to date\n    - `pyproject.toml` Python & Django version trove classifiers\n    - `README` Python & Django versions\n    - `docs` Python & Django versions\n- Ensure the pull request increments the version to `*.*.*` in [`restframework/__init__.py`](https://github.com/encode/django-rest-framework/blob/main/rest_framework/__init__.py).\n- Ensure documentation validates\n    - Build and serve docs `mkdocs serve`\n    - Validate links `pylinkvalidate.py -P http://127.0.0.1:8000`\n- Confirm with other maintainers that the release is finalized and ready to go.\n- Ensure that release date is included in pull request.\n- Merge the release pull request.\n- Tag the release, either with `git tag -a *.*.* -m 'version *.*.*'; git push --tags` or in GitHub.\n- Wait for the release workflow to run. It will build the distribution, upload it to Test PyPI, PyPI and create the GitHub release.\n- Make a release announcement on the [discussion group](https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework).\n- Make a release announcement on social media (Mastodon, etc...) and on the [Django forum](https://forum.djangoproject.com/).\n- Close the milestone on GitHub.\n\n---\n\n## Project ownership\n\nThe PyPI package is owned by `@tomchristie`. As a backup `@j4mie` also has ownership of the package.\n\nIf `@tomchristie` ceases to participate in the project then `@j4mie` has responsibility for handing over ownership duties.\n\n#### Outstanding management & ownership issues\n\nThe following issues still need to be addressed:\n\n* Ensure `@j4mie` has back-up access to the `django-rest-framework.org` domain setup and admin.\n* Document ownership of the [mailing list][mailing-list] and IRC channel.\n* Document ownership and management of the security mailing list.\n\n[bus-factor]: https://en.wikipedia.org/wiki/Bus_factor\n[un-triaged]: https://github.com/encode/django-rest-framework/issues?q=is%3Aopen+no%3Alabel\n[mailing-list]: https://groups.google.com/forum/#!forum/django-rest-framework\n"
  },
  {
    "path": "docs/community/release-notes.md",
    "content": "# Release Notes\n\n## Versioning\n\n- **Minor** version numbers (0.0.x) are used for changes that are API compatible.  You should be able to upgrade between minor point releases without any other code changes.\n\n- **Medium** version numbers (0.x.0) may include API changes, in line with the [deprecation policy][deprecation-policy].  You should read the release notes carefully before upgrading between medium point releases.\n\n- **Major** version numbers (x.0.0) are reserved for substantial project milestones.\n\nAs REST Framework is considered feature-complete, most releases are expected to be minor releases.\n\n## Deprecation policy\n\nREST framework releases follow a formal deprecation policy, which is in line with [Django's deprecation policy][django-deprecation-policy].\n\nThe timeline for deprecation of a feature present in version 1.0 would work as follows:\n\n* Version 1.1 would remain **fully backwards compatible** with 1.0, but would raise `RemovedInDRF13Warning` warnings, subclassing `PendingDeprecationWarning`, if you use the feature that are due to be deprecated.  These warnings are **silent by default**, but can be explicitly enabled when you're ready to start migrating any required changes.  For example if you start running your tests using `python -Wd manage.py test`, you'll be warned of any API changes you need to make.\n\n* Version 1.2 would escalate these warnings to subclass `DeprecationWarning`, which is loud by default.\n\n* Version 1.3 would remove the deprecated bits of API entirely.\n\nNote that in line with Django's policy, any parts of the framework not mentioned in the documentation should generally be considered private API, and may be subject to change.\n\n## Upgrading\n\nTo upgrade Django REST framework to the latest version, use pip:\n\n    pip install -U djangorestframework\n\nYou can determine your currently installed version using `pip show`:\n\n    pip show djangorestframework\n\n---\n\n## 3.17.x series\n\n### 3.17.0\n\n**Date**: 18th March 2026\n\n#### Breaking changes\n\n* Drop support for Python 3.9 by [@auvipy](https://github.com/auvipy) in [#9781](https://github.com/encode/django-rest-framework/pull/9781)\n* Drop deprecated coreapi support by [@browniebroke](https://github.com/browniebroke) in [#9895](https://github.com/encode/django-rest-framework/pull/9895)\n\n#### Features\n\n* Add Django 6.0 support by [@MehrazRumman](https://github.com/MehrazRumman) in [#9819](https://github.com/encode/django-rest-framework/pull/9819)\n* Add support for Python 3.14 by [@cclauss](https://github.com/cclauss) in [#9780](https://github.com/encode/django-rest-framework/pull/9780)\n* Add ability to specify output format for `DurationField` by [@sevdog](https://github.com/sevdog) in [#8532](https://github.com/encode/django-rest-framework/pull/8532)\n* Add missing decorators: `@versioning_class()`, `@content_negotiation_class()`, `@metadata_class()` for function-based views by [@qqii](https://github.com/qqii) in [#9719](https://github.com/encode/django-rest-framework/pull/9719)\n* Support `violation_error_code` and `violation_error_message` from `UniqueConstraint` in `UniqueTogetherValidator` by [@s-aleshin](https://github.com/s-aleshin) in [#9766](https://github.com/encode/django-rest-framework/pull/9766)\n* Add support for `ipaddress` objects in `JSONEncoder` by [@corenting](https://github.com/corenting) in [#9087](https://github.com/encode/django-rest-framework/pull/9087)\n* Add optional support to serialize `BigInteger` to string by [@HoodyH](https://github.com/HoodyH) in [#9775](https://github.com/encode/django-rest-framework/pull/9775)\n\n#### Bug fixes\n\n* Prevent small risk of `Token` overwrite by [@mahdirahimi1999](https://github.com/mahdirahimi1999) in [#9754](https://github.com/encode/django-rest-framework/pull/9754)\n* Fix `UniqueTogetherValidator` validation when condition references a read-only field by [@ticosax](https://github.com/ticosax) in [#9764](https://github.com/encode/django-rest-framework/pull/9764)\n* Fix validation on many to many field when `default=None` by [@Genarito](https://github.com/Genarito) in [#9790](https://github.com/encode/django-rest-framework/pull/9790)\n* Fix invalid SPDX license expression in `__init__.py` by [@TheFunctionalGuy](https://github.com/TheFunctionalGuy) in [#9799](https://github.com/encode/django-rest-framework/pull/9799)\n* Fix `HTMLFormRenderer` to ensure a valid `datetime-local` format by [@mgaligniana](https://github.com/mgaligniana) in [#9365](https://github.com/encode/django-rest-framework/pull/9365)\n* Fix mutable default arguments in OrderingFilter methods by [@killerdevildog](https://github.com/killerdevildog) in [#9742](https://github.com/encode/django-rest-framework/pull/9742)\n* Update TokenAdmin to respect USERNAME_FIELD of the user model by [@m000](https://github.com/m000) in [#9836](https://github.com/encode/django-rest-framework/pull/9836)\n* Preserve ordering in `MultipleChoiceField` by [@fbozhang](https://github.com/fbozhang) in [#9735](https://github.com/encode/django-rest-framework/pull/9735)\n\n#### Translations\n\n* Update French translation by [@SebCorbin](https://github.com/SebCorbin) in [#9770](https://github.com/encode/django-rest-framework/pull/9770)\n* Update Brazilian Portuguese translations by [@JVPinheiroReis](https://github.com/JVPinheiroReis) in [#9828](https://github.com/encode/django-rest-framework/pull/9828)\n* Fix and improve French translations by [@deronnax](https://github.com/deronnax) in [#9896](https://github.com/encode/django-rest-framework/pull/9896)\n* Add missing Russian translation by [@minorytanaka](https://github.com/minorytanaka) in [#9903](https://github.com/encode/django-rest-framework/pull/9903)\n\n#### Packaging\n\n* Migrate packaging to `pyproject.toml` by [@deronnax](https://github.com/deronnax) in [#9056](https://github.com/encode/django-rest-framework/pull/9056)\n* Move package data rules from `MANIFEST.in` to `pyproject.toml` by [@p-r-a-v-i-n](https://github.com/p-r-a-v-i-n) in [#9825](https://github.com/encode/django-rest-framework/pull/9825)\n* Set up release workflow with trusted publisher by [@browniebroke](https://github.com/browniebroke) in [#9852](https://github.com/encode/django-rest-framework/pull/9852)\n\n#### Other changes\n\n* Refactor token generation to use the `secrets` module by [@mahdirahimi1999](https://github.com/mahdirahimi1999) in [#9760](https://github.com/encode/django-rest-framework/pull/9760)\n* Add validation for decorator out-of-order with `@api_view` by [@kernelshard](https://github.com/kernelshard) in [#9821](https://github.com/encode/django-rest-framework/pull/9821)\n* Switch to mkdocs material theme for documentation by [@browniebroke](https://github.com/browniebroke) in [#9849](https://github.com/encode/django-rest-framework/pull/9849)\n\n#### New Contributors\n\n* [@khaledsukkar2](https://github.com/khaledsukkar2) made their first contribution in [#9717](https://github.com/encode/django-rest-framework/pull/9717)\n* [@qqii](https://github.com/qqii) made their first contribution in [#9719](https://github.com/encode/django-rest-framework/pull/9719)\n* [@zankoAn](https://github.com/zankoAn) made their first contribution in [#9788](https://github.com/encode/django-rest-framework/pull/9788)\n* [@uche-wealth](https://github.com/uche-wealth) made their first contribution in [#9795](https://github.com/encode/django-rest-framework/pull/9795)\n* [@s-aleshin](https://github.com/s-aleshin) made their first contribution in [#9766](https://github.com/encode/django-rest-framework/pull/9766)\n* [@Infamous003](https://github.com/Infamous003) made their first contribution in [#9794](https://github.com/encode/django-rest-framework/pull/9794)\n* [@Genarito](https://github.com/Genarito) made their first contribution in [#9790](https://github.com/encode/django-rest-framework/pull/9790)\n* [@TheFunctionalGuy](https://github.com/TheFunctionalGuy) made their first contribution in [#9799](https://github.com/encode/django-rest-framework/pull/9799)\n* [@mahdighadiriii](https://github.com/mahdighadiriii) made their first contribution in [#9800](https://github.com/encode/django-rest-framework/pull/9800)\n* [@p-r-a-v-i-n](https://github.com/p-r-a-v-i-n) made their first contribution in [#9801](https://github.com/encode/django-rest-framework/pull/9801)\n* [@itssimon](https://github.com/itssimon) made their first contribution in [#9718](https://github.com/encode/django-rest-framework/pull/9718)\n* [@huynguyengl99](https://github.com/huynguyengl99) made their first contribution in [#9785](https://github.com/encode/django-rest-framework/pull/9785)\n* [@corenting](https://github.com/corenting) made their first contribution in [#9087](https://github.com/encode/django-rest-framework/pull/9087)\n* [@killerdevildog](https://github.com/killerdevildog) made their first contribution in [#9742](https://github.com/encode/django-rest-framework/pull/9742)\n* [@dayandavid](https://github.com/dayandavid) made their first contribution in [#9820](https://github.com/encode/django-rest-framework/pull/9820)\n* [@abhishektiwari](https://github.com/abhishektiwari) made their first contribution in [#9826](https://github.com/encode/django-rest-framework/pull/9826)\n* [@HoodyH](https://github.com/HoodyH) made their first contribution in [#9775](https://github.com/encode/django-rest-framework/pull/9775)\n* [@Shrikantgiri25](https://github.com/Shrikantgiri25) made their first contribution in [#9808](https://github.com/encode/django-rest-framework/pull/9808)\n* [@JVPinheiroReis](https://github.com/JVPinheiroReis) made their first contribution in [#9828](https://github.com/encode/django-rest-framework/pull/9828)\n* [@m000](https://github.com/m000) made their first contribution in [#9836](https://github.com/encode/django-rest-framework/pull/9836)\n* [@Nabute](https://github.com/Nabute) made their first contribution in [#9767](https://github.com/encode/django-rest-framework/pull/9767)\n* [@therealjozber](https://github.com/therealjozber) made their first contribution in [#9845](https://github.com/encode/django-rest-framework/pull/9845)\n* [@nexapytech](https://github.com/nexapytech) made their first contribution in [#9867](https://github.com/encode/django-rest-framework/pull/9867)\n* [@RispaJoseph](https://github.com/RispaJoseph) made their first contribution in [#9874](https://github.com/encode/django-rest-framework/pull/9874)\n* [@LorenzoGuideri](https://github.com/LorenzoGuideri) made their first contribution in [#9875](https://github.com/encode/django-rest-framework/pull/9875)\n* [@maldoinc](https://github.com/maldoinc) made their first contribution in [#9893](https://github.com/encode/django-rest-framework/pull/9893)\n* [@0Nafi0](https://github.com/0Nafi0) made their first contribution in [#9861](https://github.com/encode/django-rest-framework/pull/9861)\n* [@MoeSalah1999](https://github.com/MoeSalah1999) made their first contribution in [#9870](https://github.com/encode/django-rest-framework/pull/9870)\n* [@kelsonbrito50](https://github.com/kelsonbrito50) made their first contribution in [#9901](https://github.com/encode/django-rest-framework/pull/9901)\n* [@fbozhang](https://github.com/fbozhang) made their first contribution in [#9735](https://github.com/encode/django-rest-framework/pull/9735)\n* [@minorytanaka](https://github.com/minorytanaka) made their first contribution in [#9903](https://github.com/encode/django-rest-framework/pull/9903)\n* [@kosbemrunal](https://github.com/kosbemrunal) made their first contribution in [#9904](https://github.com/encode/django-rest-framework/pull/9904)\n* [@htvictoire](https://github.com/htvictoire) made their first contribution in [#9916](https://github.com/encode/django-rest-framework/pull/9916)\n\n**Full Changelog**: [3.16.1...3.17.0](https://github.com/encode/django-rest-framework/compare/3.16.1...3.17.0)\n\n## 3.16.x series\n\n### 3.16.1\n\n**Date**: 6th August 2025\n\nThis release fixes a few bugs, clean-up some old code paths for unsupported Python versions and improve translations.\n\n#### Minor changes\n\n* Cleanup optional `backports.zoneinfo` dependency and conditions on unsupported Python 3.8 and lower in [#9681](https://github.com/encode/django-rest-framework/pull/9681). Python versions prior to 3.9 were already unsupported so this shouldn't be a breaking change.\n\n#### Bug fixes\n\n* Fix regression in `unique_together` validation with `SerializerMethodField` in [#9712](https://github.com/encode/django-rest-framework/pull/9712)\n* Fix `UniqueTogetherValidator` to handle fields with `source` attribute in [#9688](https://github.com/encode/django-rest-framework/pull/9688)\n* Drop HTML line breaks on long headers in browsable API in [#9438](https://github.com/encode/django-rest-framework/pull/9438)\n\n#### Translations\n\n* Add Kazakh locale support in [#9713](https://github.com/encode/django-rest-framework/pull/9713)\n* Update translations for Korean translations in [#9571](https://github.com/encode/django-rest-framework/pull/9571)\n* Update German translations in [#9676](https://github.com/encode/django-rest-framework/pull/9676)\n* Update Chinese translations in [#9675](https://github.com/encode/django-rest-framework/pull/9675)\n* Update Arabic translations-sal in [#9595](https://github.com/encode/django-rest-framework/pull/9595)\n* Update Persian translations in [#9576](https://github.com/encode/django-rest-framework/pull/9576)\n* Update Spanish translations in [#9701](https://github.com/encode/django-rest-framework/pull/9701)\n* Update Turkish Translations in [#9749](https://github.com/encode/django-rest-framework/pull/9749)\n* Fix some typos in Brazilian Portuguese translations in [#9673](https://github.com/encode/django-rest-framework/pull/9673)\n\n#### Documentation\n\n* Removed reference to GitHub Issues and Discussions in [#9660](https://github.com/encode/django-rest-framework/pull/9660)\n* Add `drf-restwind` and update outdated images in `browsable-api.md` in [#9680](https://github.com/encode/django-rest-framework/pull/9680)\n* Updated funding page to represent current scope in [#9686](https://github.com/encode/django-rest-framework/pull/9686)\n* Fix broken Heroku JSON Schema link in [#9693](https://github.com/encode/django-rest-framework/pull/9693)\n* Update Django documentation links to use stable version in [#9698](https://github.com/encode/django-rest-framework/pull/9698)\n* Expand docs on unique constraints cause 'required=True' in [#9725](https://github.com/encode/django-rest-framework/pull/9725)\n* Revert extension back from `djangorestframework-guardian2` to `djangorestframework-guardian` in [#9734](https://github.com/encode/django-rest-framework/pull/9734)\n* Add note to tutorial about required `request` in serializer context when using `HyperlinkedModelSerializer` in [#9732](https://github.com/encode/django-rest-framework/pull/9732)\n\n#### Internal changes\n\n* Update GitHub Actions to use Ubuntu 24.04 for testing in [#9677](https://github.com/encode/django-rest-framework/pull/9677)\n* Update test matrix to use Django 5.2 stable version in [#9679](https://github.com/encode/django-rest-framework/pull/9679)\n* Add `pyupgrade` to `pre-commit` hooks in [#9682](https://github.com/encode/django-rest-framework/pull/9682)\n* Fix test with Django 5 when `pytz` is available in [#9715](https://github.com/encode/django-rest-framework/pull/9715)\n\n#### New Contributors\n\n* [`@araggohnxd`](https://github.com/araggohnxd) made their first contribution in [#9673](https://github.com/encode/django-rest-framework/pull/9673)\n* [`@mbeijen`](https://github.com/mbeijen) made their first contribution in [#9660](https://github.com/encode/django-rest-framework/pull/9660)\n* [`@stefan6419846`](https://github.com/stefan6419846) made their first contribution in [#9676](https://github.com/encode/django-rest-framework/pull/9676)\n* [`@ren000thomas`](https://github.com/ren000thomas) made their first contribution in [#9675](https://github.com/encode/django-rest-framework/pull/9675)\n* [`@ulgens`](https://github.com/ulgens) made their first contribution in [#9682](https://github.com/encode/django-rest-framework/pull/9682)\n* [`@bukh-sal`](https://github.com/bukh-sal) made their first contribution in [#9595](https://github.com/encode/django-rest-framework/pull/9595)\n* [`@rezatn0934`](https://github.com/rezatn0934) made their first contribution in [#9576](https://github.com/encode/django-rest-framework/pull/9576)\n* [`@Rohit10jr`](https://github.com/Rohit10jr) made their first contribution in [#9693](https://github.com/encode/django-rest-framework/pull/9693)\n* [`@kushibayev`](https://github.com/kushibayev) made their first contribution in [#9713](https://github.com/encode/django-rest-framework/pull/9713)\n* [`@alihassancods`](https://github.com/alihassancods) made their first contribution in [#9732](https://github.com/encode/django-rest-framework/pull/9732)\n* [`@kulikjak`](https://github.com/kulikjak) made their first contribution in [#9715](https://github.com/encode/django-rest-framework/pull/9715)\n* [`@Natgho`](https://github.com/Natgho) made their first contribution in [#9749](https://github.com/encode/django-rest-framework/pull/9749)\n\n**Full Changelog**: https://github.com/encode/django-rest-framework/compare/3.16.0...3.16.1\n\n### 3.16.0\n\n**Date**: 28th March 2025\n\nThis release is considered a significant release to improve upstream support with Django and Python. Some of these may change the behavior of existing features and pre-existing behavior. Specifically, some fixes were added to around the support of `UniqueConstraint` with nullable fields which will improve built-in serializer validation.\n\n#### Features\n\n* Add official support for Django 5.1 and its new `LoginRequiredMiddleware` in [#9514](https://github.com/encode/django-rest-framework/pull/9514) and [#9657](https://github.com/encode/django-rest-framework/pull/9657)\n* Add official Django 5.2a1 support in [#9634](https://github.com/encode/django-rest-framework/pull/9634)\n* Add support for Python 3.13 in [#9527](https://github.com/encode/django-rest-framework/pull/9527) and [#9556](https://github.com/encode/django-rest-framework/pull/9556)\n* Support Django 2.1+ test client JSON data automatically serialized in [#6511](https://github.com/encode/django-rest-framework/pull/6511) and fix a regression in [#9615](https://github.com/encode/django-rest-framework/pull/9615)\n\n#### Bug fixes\n\n* Fix unique together validator to respect condition's fields from `UniqueConstraint` in [#9360](https://github.com/encode/django-rest-framework/pull/9360)\n* Fix raising on nullable fields part of `UniqueConstraint` in [#9531](https://github.com/encode/django-rest-framework/pull/9531)\n* Fix `unique_together` validation with source in [#9482](https://github.com/encode/django-rest-framework/pull/9482)\n* Added protections to `AttributeError` raised within properties in [#9455](https://github.com/encode/django-rest-framework/pull/9455)\n* Fix `get_template_context` to handle also lists in [#9467](https://github.com/encode/django-rest-framework/pull/9467)\n* Fix \"Converter is already registered\" deprecation warning. in [#9512](https://github.com/encode/django-rest-framework/pull/9512)\n* Fix noisy warning and accept integers as min/max values of `DecimalField` in [#9515](https://github.com/encode/django-rest-framework/pull/9515)\n* Fix usages of `open()` in `setup.py` in [#9661](https://github.com/encode/django-rest-framework/pull/9661)\n\n#### Translations\n\n* Add some missing Chinese translations in [#9505](https://github.com/encode/django-rest-framework/pull/9505)\n* Fix spelling mistakes in Farsi language were corrected in [#9521](https://github.com/encode/django-rest-framework/pull/9521)\n* Fixing and adding missing Brazilian Portuguese translations in [#9535](https://github.com/encode/django-rest-framework/pull/9535)\n\n#### Removals\n\n* Remove support for Python 3.8 in [#9670](https://github.com/encode/django-rest-framework/pull/9670)\n* Remove long deprecated code from request wrapper in [#9441](https://github.com/encode/django-rest-framework/pull/9441)\n* Remove deprecated `AutoSchema._get_reference` method in [#9525](https://github.com/encode/django-rest-framework/pull/9525)\n\n#### Documentation and internal changes\n\n* Provide tests for hashing of `OperandHolder` in [#9437](https://github.com/encode/django-rest-framework/pull/9437)\n* Update documentation: Add `adrf` third party package in [#9198](https://github.com/encode/django-rest-framework/pull/9198)\n* Update tutorials links in Community contributions docs in [#9476](https://github.com/encode/django-rest-framework/pull/9476)\n* Fix usage of deprecated Django function in example from docs in [#9509](https://github.com/encode/django-rest-framework/pull/9509)\n* Move path converter docs into a separate section in [#9524](https://github.com/encode/django-rest-framework/pull/9524)\n* Add test covering update view without `queryset` attribute in [#9528](https://github.com/encode/django-rest-framework/pull/9528)\n* Fix Transifex link in [#9541](https://github.com/encode/django-rest-framework/pull/9541)\n* Fix example `httpie` call in docs in [#9543](https://github.com/encode/django-rest-framework/pull/9543)\n* Fix example for serializer field with choices in docs in [#9563](https://github.com/encode/django-rest-framework/pull/9563)\n* Remove extra `<>` in validators example in [#9590](https://github.com/encode/django-rest-framework/pull/9590)\n* Update `strftime` link in the docs in [#9624](https://github.com/encode/django-rest-framework/pull/9624)\n* Switch to codecov GHA in [#9618](https://github.com/encode/django-rest-framework/pull/9618)\n* Add note regarding availability of the `action` attribute in 'Introspecting ViewSet actions' docs section in [#9633](https://github.com/encode/django-rest-framework/pull/9633)\n* Improved description of allowed throttling rates in documentation in [#9640](https://github.com/encode/django-rest-framework/pull/9640)\n* Add `rest-framework-gm2m-relations` package to the list of 3rd party libraries in [#9063](https://github.com/encode/django-rest-framework/pull/9063)\n* Fix a number of typos in the test suite in the docs in [#9662](https://github.com/encode/django-rest-framework/pull/9662)\n* Add `django-pyoidc` as a third party authentication library in [#9667](https://github.com/encode/django-rest-framework/pull/9667)\n\n#### New Contributors\n\n* [`@maerteijn`](https://github.com/maerteijn) made their first contribution in [#9198](https://github.com/encode/django-rest-framework/pull/9198)\n* [`@FraCata00`](https://github.com/FraCata00) made their first contribution in [#9444](https://github.com/encode/django-rest-framework/pull/9444)\n* [`@AlvaroVega`](https://github.com/AlvaroVega) made their first contribution in [#9451](https://github.com/encode/django-rest-framework/pull/9451)\n* [`@james`](https://github.com/james)-mchugh made their first contribution in [#9455](https://github.com/encode/django-rest-framework/pull/9455)\n* [`@ifeanyidavid`](https://github.com/ifeanyidavid) made their first contribution in [#9479](https://github.com/encode/django-rest-framework/pull/9479)\n* [`@p`](https://github.com/p)-schlickmann made their first contribution in [#9480](https://github.com/encode/django-rest-framework/pull/9480)\n* [`@akkuman`](https://github.com/akkuman) made their first contribution in [#9505](https://github.com/encode/django-rest-framework/pull/9505)\n* [`@rafaelgramoschi`](https://github.com/rafaelgramoschi) made their first contribution in [#9509](https://github.com/encode/django-rest-framework/pull/9509)\n* [`@Sinaatkd`](https://github.com/Sinaatkd) made their first contribution in [#9521](https://github.com/encode/django-rest-framework/pull/9521)\n* [`@gtkacz`](https://github.com/gtkacz) made their first contribution in [#9535](https://github.com/encode/django-rest-framework/pull/9535)\n* [`@sliverc`](https://github.com/sliverc) made their first contribution in [#9556](https://github.com/encode/django-rest-framework/pull/9556)\n* [`@gabrielromagnoli1987`](https://github.com/gabrielromagnoli1987) made their first contribution in [#9543](https://github.com/encode/django-rest-framework/pull/9543)\n* [`@cheehong1030`](https://github.com/cheehong1030) made their first contribution in [#9563](https://github.com/encode/django-rest-framework/pull/9563)\n* [`@amansharma612`](https://github.com/amansharma612) made their first contribution in [#9590](https://github.com/encode/django-rest-framework/pull/9590)\n* [`@Gluroda`](https://github.com/Gluroda) made their first contribution in [#9616](https://github.com/encode/django-rest-framework/pull/9616)\n* [`@deepakangadi`](https://github.com/deepakangadi) made their first contribution in [#9624](https://github.com/encode/django-rest-framework/pull/9624)\n* [`@EXG1O`](https://github.com/EXG1O) made their first contribution in [#9633](https://github.com/encode/django-rest-framework/pull/9633)\n* [`@decadenza`](https://github.com/decadenza) made their first contribution in [#9640](https://github.com/encode/django-rest-framework/pull/9640)\n* [`@mojtabaakbari221b`](https://github.com/mojtabaakbari221b) made their first contribution in [#9063](https://github.com/encode/django-rest-framework/pull/9063)\n* [`@mikemanger`](https://github.com/mikemanger) made their first contribution in [#9661](https://github.com/encode/django-rest-framework/pull/9661)\n* [`@gbip`](https://github.com/gbip) made their first contribution in [#9667](https://github.com/encode/django-rest-framework/pull/9667)\n\n**Full Changelog**: https://github.com/encode/django-rest-framework/compare/3.15.2...3.16.0\n\n## 3.15.x series\n\n### 3.15.2\n\n**Date**: 14th June 2024\n\n* Fix potential XSS vulnerability in browsable API. [#9435](https://github.com/encode/django-rest-framework/pull/9435)\n* Revert \"Ensure CursorPagination respects nulls in the ordering field\". [#9381](https://github.com/encode/django-rest-framework/pull/9381)\n* Use warnings rather than logging a warning for DecimalField. [#9367](https://github.com/encode/django-rest-framework/pull/9367)\n* Remove unused code. [#9393](https://github.com/encode/django-rest-framework/pull/9393)\n* Django < 4.2 and Python < 3.8 no longer supported. [#9393](https://github.com/encode/django-rest-framework/pull/9393)\n\n### 3.15.1\n\nDate: 22nd March 2024\n\n* Fix `SearchFilter` handling of quoted and comma separated strings, when `.get_search_terms` is being called into by a custom class. See [[#9338](https://github.com/encode/django-rest-framework/issues/9338)]\n* Revert number of 3.15.0 issues which included unintended side-effects. See [[#9331](https://github.com/encode/django-rest-framework/issues/9331)]\n\n### 3.15.0\n\nDate: 15th March 2024\n\n* Django 5.0 and Python 3.12 support [[#9157](https://github.com/encode/django-rest-framework/pull/9157)]\n* Use POST method instead of GET to perform logout in browsable API [[9208](https://github.com/encode/django-rest-framework/pull/9208)]\n* Added jQuery 3.7.1 support & dropped previous version [[#9094](https://github.com/encode/django-rest-framework/pull/9094)]\n* Use str as default path converter [[#9066](https://github.com/encode/django-rest-framework/pull/9066)]\n* Document support for http.HTTPMethod in the @action decorator added in Python 3.11 [[#9067](https://github.com/encode/django-rest-framework/pull/9067)]\n* Update exceptions.md [[#9071](https://github.com/encode/django-rest-framework/pull/9071)]\n* Partial serializer should not have required fields [[#7563](https://github.com/encode/django-rest-framework/pull/7563)]\n* Propagate 'default' from model field to serializer field. [[#9030](https://github.com/encode/django-rest-framework/pull/9030)]\n* Allow to override child.run_validation call in ListSerializer [[#8035](https://github.com/encode/django-rest-framework/pull/8035)]\n* Align SearchFilter behavior to django.contrib.admin search [[#9017](https://github.com/encode/django-rest-framework/pull/9017)]\n* Class name added to unknown field error [[#9019](https://github.com/encode/django-rest-framework/pull/9019)]\n* Fix: Pagination response schemas. [[#9049](https://github.com/encode/django-rest-framework/pull/9049)]\n* Fix choices in ChoiceField to support IntEnum [[#8955](https://github.com/encode/django-rest-framework/pull/8955)]\n* Fix `SearchFilter` rendering search field with invalid value [[#9023](https://github.com/encode/django-rest-framework/pull/9023)]\n* Fix OpenAPI Schema yaml rendering for `timedelta` [[#9007](https://github.com/encode/django-rest-framework/pull/9007)]\n* Fix `NamespaceVersioning` ignoring `DEFAULT_VERSION` on non-None namespaces [[#7278](https://github.com/encode/django-rest-framework/pull/7278)]\n* Added Deprecation Warnings for CoreAPI [[#7519](https://github.com/encode/django-rest-framework/pull/7519)]\n* Removed usage of `field.choices` that triggered full table load [[#8950](https://github.com/encode/django-rest-framework/pull/8950)]\n* Permit mixed casing of string values for `BooleanField` validation [[#8970](https://github.com/encode/django-rest-framework/pull/8970)]\n* Fixes `BrowsableAPIRenderer` for usage with `ListSerializer`. [[#7530](https://github.com/encode/django-rest-framework/pull/7530)]\n* Change semantic of `OR` of two permission classes [[#7522](https://github.com/encode/django-rest-framework/pull/7522)]\n* Remove dependency on `pytz` [[#8984](https://github.com/encode/django-rest-framework/pull/8984)]\n* Make set_value a method within `Serializer` [[#8001](https://github.com/encode/django-rest-framework/pull/8001)]\n* Fix URLPathVersioning reverse fallback [[#7247](https://github.com/encode/django-rest-framework/pull/7247)]\n* Warn about Decimal type in min_value and max_value arguments of DecimalField [[#8972](https://github.com/encode/django-rest-framework/pull/8972)]\n* Fix mapping for choice values [[#8968](https://github.com/encode/django-rest-framework/pull/8968)]\n* Refactor read function to use context manager for file handling [[#8967](https://github.com/encode/django-rest-framework/pull/8967)]\n* Fix: fallback on CursorPagination ordering if unset on the view [[#8954](https://github.com/encode/django-rest-framework/pull/8954)]\n* Replaced `OrderedDict` with `dict` [[#8964](https://github.com/encode/django-rest-framework/pull/8964)]\n* Refactor get_field_info method to include max_digits and decimal_places attributes in SimpleMetadata class [[#8943](https://github.com/encode/django-rest-framework/pull/8943)]\n* Implement `__eq__` for validators [[#8925](https://github.com/encode/django-rest-framework/pull/8925)]\n* Ensure CursorPagination respects nulls in the ordering field [[#8912](https://github.com/encode/django-rest-framework/pull/8912)]\n* Use ZoneInfo as primary source of timezone data [[#8924](https://github.com/encode/django-rest-framework/pull/8924)]\n* Add username search field for TokenAdmin (#8927) [[#8934](https://github.com/encode/django-rest-framework/pull/8934)]\n* Handle Nested Relation in SlugRelatedField when many=False [[#8922](https://github.com/encode/django-rest-framework/pull/8922)]\n* Bump version of jQuery to 3.6.4 & updated ref links [[#8909](https://github.com/encode/django-rest-framework/pull/8909)]\n* Support UniqueConstraint [[#7438](https://github.com/encode/django-rest-framework/pull/7438)]\n* Allow Request, Response, Field, and GenericAPIView to be subscriptable. This allows the classes to be made generic for type checking. [[#8825](https://github.com/encode/django-rest-framework/pull/8825)]\n* Feat: Add some changes to ValidationError to support django style validation errors [[#8863](https://github.com/encode/django-rest-framework/pull/8863)]\n* Fix Respect `can_read_model` permission in DjangoModelPermissions [[#8009](https://github.com/encode/django-rest-framework/pull/8009)]\n* Add SimplePathRouter [[#6789](https://github.com/encode/django-rest-framework/pull/6789)]\n* Re-prefetch related objects after updating [[#8043](https://github.com/encode/django-rest-framework/pull/8043)]\n* Fix FilePathField required argument [[#8805](https://github.com/encode/django-rest-framework/pull/8805)]\n* Raise ImproperlyConfigured exception if `basename` is not unique  [[#8438](https://github.com/encode/django-rest-framework/pull/8438)]\n* Use PrimaryKeyRelatedField pkfield in openapi [[#8315](https://github.com/encode/django-rest-framework/pull/8315)]\n* replace partition with split in BasicAuthentication [[#8790](https://github.com/encode/django-rest-framework/pull/8790)]\n* Fix BooleanField's allow_null behavior [[#8614](https://github.com/encode/django-rest-framework/pull/8614)]\n* Handle Django's ValidationErrors in ListField [[#6423](https://github.com/encode/django-rest-framework/pull/6423)]\n* Remove a bit of inline CSS. Add CSP nonce where it might be required and is available [[#8783](https://github.com/encode/django-rest-framework/pull/8783)]\n* Use autocomplete widget for user selection in Token admin [[#8534](https://github.com/encode/django-rest-framework/pull/8534)]\n* Make browsable API compatible with strong CSP [[#8784](https://github.com/encode/django-rest-framework/pull/8784)]\n* Avoid inline script execution for injecting CSRF token [[#7016](https://github.com/encode/django-rest-framework/pull/7016)]\n* Mitigate global dependency on inflection [[#8017](https://github.com/encode/django-rest-framework/pull/8017)] [[#8781](https://github.com/encode/django-rest-framework/pull/8781)]\n* Register Django urls  [[#8778](https://github.com/encode/django-rest-framework/pull/8778)]\n* Implemented Verbose Name Translation for TokenProxy [[#8713](https://github.com/encode/django-rest-framework/pull/8713)]\n* Properly handle OverflowError in DurationField deserialization [[#8042](https://github.com/encode/django-rest-framework/pull/8042)]\n* Fix OpenAPI operation name plural appropriately [[#8017](https://github.com/encode/django-rest-framework/pull/8017)]\n* Represent SafeString as plain string on schema rendering [[#8429](https://github.com/encode/django-rest-framework/pull/8429)]\n* Fix #8771 - Checking for authentication even if `_ignore_model_permissions = True` [[#8772](https://github.com/encode/django-rest-framework/pull/8772)]\n* Fix 404 when page query parameter is empty string [[#8578](https://github.com/encode/django-rest-framework/pull/8578)]\n* Fixes instance check in ListSerializer.to_representation [[#8726](https://github.com/encode/django-rest-framework/pull/8726)] [[#8727](https://github.com/encode/django-rest-framework/pull/8727)]\n* FloatField will crash if the input is a number that is too big [[#8725](https://github.com/encode/django-rest-framework/pull/8725)]\n* Add missing DurationField to SimpleMetadata label_lookup [[#8702](https://github.com/encode/django-rest-framework/pull/8702)]\n* Add support for Python 3.11 [[#8752](https://github.com/encode/django-rest-framework/pull/8752)]\n* Make request consistently available in pagination classes [[#8764](https://github.com/encode/django-rest-framework/pull/9764)]\n* Possibility to remove trailing zeros on DecimalFields representation [[#6514](https://github.com/encode/django-rest-framework/pull/6514)]\n* Add a method for getting serializer field name (OpenAPI) [[#7493](https://github.com/encode/django-rest-framework/pull/7493)]\n* Add `__eq__` method for `OperandHolder` class [[#8710](https://github.com/encode/django-rest-framework/pull/8710)]\n* Avoid importing `django.test` package when not testing  [[#8699](https://github.com/encode/django-rest-framework/pull/8699)]\n* Preserve exception messages for wrapped Django exceptions [[#8051](https://github.com/encode/django-rest-framework/pull/8051)]\n* Include `examples` and `format` to OpenAPI schema of CursorPagination [[#8687](https://github.com/encode/django-rest-framework/pull/8687)] [[#8686](https://github.com/encode/django-rest-framework/pull/8686)]\n* Fix infinite recursion with deepcopy on Request [[#8684](https://github.com/encode/django-rest-framework/pull/8684)]\n* Refactor: Replace try/except with contextlib.suppress() [[#8676](https://github.com/encode/django-rest-framework/pull/8676)]\n* Minor fix to SerializeMethodField docstring [[#8629](https://github.com/encode/django-rest-framework/pull/8629)]\n* Minor refactor: Unnecessary use of list() function [[#8672](https://github.com/encode/django-rest-framework/pull/8672)]\n* Unnecessary list comprehension [[#8670](https://github.com/encode/django-rest-framework/pull/8670)]\n* Use correct class to indicate present deprecation [[#8665](https://github.com/encode/django-rest-framework/pull/8665)]\n\n## 3.14.x series\n\n### 3.14.0\n\nDate: 22nd September 2022\n\n* Django 2.2 is no longer supported. [[#8662](https://github.com/encode/django-rest-framework/pull/8662)]\n* Django 4.1 compatibility. [[#8591](https://github.com/encode/django-rest-framework/pull/8591)]\n* Add `--api-version` CLI option to `generateschema` management command. [[#8663](https://github.com/encode/django-rest-framework/pull/8663)]\n* Enforce `is_valid(raise_exception=False)` as a keyword-only argument. [[#7952](https://github.com/encode/django-rest-framework/pull/7952)]\n* Stop calling `set_context` on Validators. [[#8589](https://github.com/encode/django-rest-framework/pull/8589)]\n* Return `NotImplemented` from `ErrorDetails.__ne__`. [[#8538](https://github.com/encode/django-rest-framework/pull/8538)]\n* Don't evaluate `DateTimeField.default_timezone` when a custom timezone is set. [[#8531](https://github.com/encode/django-rest-framework/pull/8531)]\n* Make relative URLs clickable in Browsable API. [[#8464](https://github.com/encode/django-rest-framework/pull/8464)]\n* Support `ManyRelatedField` falling back to the default value when the attribute specified by dot notation doesn't exist. Matches `ManyRelatedField.get_attribute` to `Field.get_attribute`. [[#7574](https://github.com/encode/django-rest-framework/pull/7574)]\n* Make `schemas.openapi.get_reference` public. [[#7515](https://github.com/encode/django-rest-framework/pull/7515)]\n* Make `ReturnDict` support `dict` union operators on Python 3.9 and later. [[#8302](https://github.com/encode/django-rest-framework/pull/8302)]\n* Update throttling to check if `request.user` is set before checking if the user is authenticated. [[#8370](https://github.com/encode/django-rest-framework/pull/8370)]\n\n## 3.13.x series\n\n### 3.13.1\n\nDate: 15th December 2021\n\n* Revert schema naming changes with function based `@api_view`. [#8297]\n\n### 3.13.0\n\nDate: 13th December 2021\n\n* Django 4.0 compatibility. [#8178]\n* Add `max_length` and `min_length` options to `ListSerializer`. [#8165]\n* Add `get_request_serializer` and `get_response_serializer` hooks to `AutoSchema`. [#7424]\n* Fix OpenAPI representation of null-able read only fields. [#8116]\n* Respect `UNICODE_JSON` setting in API schema outputs. [#7991]\n* Fix for `RemoteUserAuthentication`. [#7158]\n* Make Field constructors keyword-only. [#7632]\n\n---\n\n## 3.12.x series\n\n### 3.12.4\n\nDate: 26th March 2021\n\n* Revert use of `deque` instead of `list` for tracking throttling `.history`. (Due to incompatibility with DjangoRedis cache backend. See #7870) [#7872]\n\n### 3.12.3\n\nDate: 25th March 2021\n\n* Properly handle ATOMIC_REQUESTS when multiple database configurations are used. [#7739]\n* Bypass `COUNT` query when `LimitOffsetPagination` is configured but pagination params are not included on the request. [#6098]\n* Respect `allow_null=True` on `DecimalField`. [#7718]\n* Allow title cased `\"Yes\"`/`\"No\"` values with `BooleanField`. [#7739]\n* Add `PageNumberPagination.get_page_number()` method for overriding behavior. [#7652]\n* Fixed rendering of timedelta values in OpenAPI schemas, when present as default, min, or max fields. [#7641]\n* Render JSONFields with indentation in browsable API forms. [#6243]\n* Remove unnecessary database query in admin Token views. [#7852]\n* Raise validation errors when bools are passed to `PrimaryKeyRelatedField` fields, instead of casting to ints. [#7597]\n* Don't include model properties as automatically generated ordering fields with `OrderingFilter`. [#7609]\n* Use `deque` instead of `list` for tracking throttling `.history`. [#7849]\n\n### 3.12.2\n\nDate: 13th October 2020\n\n* Fix issue if `rest_framework.authtoken.models` is imported, but `rest_framework.authtoken` is not in INSTALLED_APPS. [#7571]\n* Ignore subclasses of BrowsableAPIRenderer in OpenAPI schema. [#7497]\n* Narrower exception catching in serilizer fields, to ensure that any errors in broken `get_queryset()` methods are not masked. [#7480]\n\n### 3.12.1\n\nDate: 28th September 2020\n\n* Add `TokenProxy` migration. [#7557]\n\n### 3.12.0\n\nDate: 28th September 2020\n\n* Add `--file` option to `generateschema` command. [#7130]\n* Support `tags` for OpenAPI schema generation. See [the schema docs](https://www.django-rest-framework.org/api-guide/schemas/#grouping-operations-with-tags). [#7184]\n* Support customizing the operation ID for schema generation. See [the schema docs](https://www.django-rest-framework.org/api-guide/schemas/#operationid). [#7190]\n* Support OpenAPI components for schema generation. See [the schema docs](https://www.django-rest-framework.org/api-guide/schemas/#components). [#7124]\n* The following methods on `AutoSchema` become public API: `get_path_parameters`, `get_pagination_parameters`, `get_filter_parameters`, `get_request_body`, `get_responses`, `get_serializer`, `get_paginator`, `map_serializer`, `map_field`, `map_choice_field`, `map_field_validators`, `allows_filters`. See [the schema docs](https://www.django-rest-framework.org/api-guide/schemas/#autoschema)\n* Add support for Django 3.1's database-agnositic `JSONField`. [#7467]\n* `SearchFilter` now supports nested search on `JSONField` and `HStoreField` model fields. [#7121]\n* `SearchFilter` now supports searching on `annotate()` fields. [#6240]\n* The authtoken model no longer exposes the `pk` in the admin URL. [#7341]\n* Add `__repr__` for Request instances. [#7239]\n* UTF-8 decoding with Latin-1 fallback for basic auth credentials. [#7193]\n* CharField treats surrogate characters as a validation failure. [#7026]\n* Don't include callables as default values in schemas. [#7105]\n* Improve `ListField` schema output to include all available child information. [#7137]\n* Allow `default=False` to be included for `BooleanField` schema outputs. [#7165]\n* Include `\"type\"` information in `ChoiceField` schema outputs. [#7161]\n* Include `\"type\": \"object\"` on schema objects. [#7169]\n* Don't include component in schema output for DELETE requests. [#7229]\n* Fix schema types for `DecimalField`. [#7254]\n* Fix schema generation for `ObtainAuthToken` view. [#7211]\n* Support passing `context=...` to view `.get_serializer()` methods. [#7298]\n* Pass custom code to `PermissionDenied` if permission class has one set. [#7306]\n* Include \"example\" in schema pagination output. [#7275]\n* Default status code of 201 on schema output for POST requests. [#7206]\n* Use camelCase for operation IDs in schema output. [#7208]\n* Warn if duplicate operation IDs exist in schema output. [#7207]\n* Improve handling of decimal type when mapping `ChoiceField` to a schema output. [#7264]\n* Disable YAML aliases for OpenAPI schema outputs. [#7131]\n* Fix action URL names for APIs included under a namespaced URL. [#7287]\n* Update jQuery version from 3.4 to 3.5. [#7313]\n* Fix `UniqueTogether` handling when serializer fields use `source=...`. [#7143]\n* HTTP `HEAD` requests now set `self.action` correctly on a ViewSet instance. [#7223]\n* Return a valid OpenAPI schema for the case where no API schema paths exist. [#7125]\n* Include tests in package distribution. [#7145]\n* Allow type checkers to support annotations like `ModelSerializer[Author]`. [#7385]\n* Don't include invalid `charset=None` portion in the request `Content-Type` header when using APIClient. [#7400]\n* Fix `\\Z`/`\\z` tokens in OpenAPI regexs. [#7389]\n* Fix `PrimaryKeyRelatedField` and `HyperlinkedRelatedField` when source field is actually a property. [#7142]\n* `Token.generate_key` is now a class method. [#7502]\n* `@action` warns if method is wrapped in a decorator that does not preserve information using `@functools.wraps`. [#7098]\n* Deprecate `serializers.NullBooleanField` in favor of `serializers.BooleanField` with `allow_null=True` [#7122]\n\n---\n\n## 3.11.x series\n\n### 3.11.2\n\n**Date**: 30th September 2020\n\n* **Security**: Drop `urlize_quoted_links` template tag in favor of Django's built-in `urlize`. Removes a XSS vulnerability for some kinds of content in the browsable API.\n\n### 3.11.1\n\n**Date**: 5th August 2020\n\n* Fix compat with Django 3.1\n\n### 3.11.0\n\n**Date**: 12th December 2019\n\n* Drop `.set_context` API [in favor of a `requires_context` marker](3.11-announcement.md#validator-default-context).\n* Changed default widget for TextField with choices to select box. [#6892][gh6892]\n* Supported nested writes on non-relational fields, such as JSONField. [#6916][gh6916]\n* Include request/response media types in OpenAPI schemas, based on configured parsers/renderers. [#6865][gh6865]\n* Include operation descriptions in OpenAPI schemas, based on the docstring on the view. [#6898][gh6898]\n* Fix representation of serializers with all optional fields in OpenAPI schemas. [#6941][gh6941], [#6944][gh6944]\n* Fix representation of `serializers.HStoreField` in OpenAPI schemas. [#6914][gh6914]\n* Fix OpenAPI generation when title or version is not provided. [#6912][gh6912]\n* Use `int64` representation for large integers in OpenAPI schemas. [#7018][gh7018]\n* Improved error messages if no `.to_representation` implementation is provided on a field subclass. [#6996][gh6996]\n* Fix for serializer classes that use multiple inheritance. [#6980][gh6980]\n* Fix for reversing Hyperlinked URL fields with percent encoded components in the path. [#7059][gh7059]\n* Update bootstrap to 3.4.1. [#6923][gh6923]\n\n## 3.10.x series\n\n### 3.10.3\n\n**Date**: 4th September 2019\n\n* Include API version in OpenAPI schema generation, defaulting to empty string.\n* Add pagination properties to OpenAPI response schemas.\n* Add missing \"description\" property to OpenAPI response schemas.\n* Only include \"required\" for non-empty cases in OpenAPI schemas.\n* Fix response schemas for \"DELETE\" case in OpenAPI schemas.\n* Use an array type for list view response schemas.\n* Use consistent `lowerInitialCamelCase` style in OpenAPI operation IDs.\n* Fix `minLength`/`maxLength`/`minItems`/`maxItems` properties in OpenAPI schemas.\n* Only call `FileField.url` once in serialization, for improved performance.\n* Fix an edge case where throttling calculations could error after a configuration change.\n\n### 3.10.2\n\n**Date**: 29th July 2019\n\n* Various `OpenAPI` schema fixes.\n* Ability to specify urlconf in include_docs_urls.\n\n### 3.10.1\n\n**Date**: 17th July 2019\n\n* Don't include autocomplete fields on TokenAuth admin, since it forces constraints on custom user models & admin.\n* Require `uritemplate` for OpenAPI schema generation, but not `coreapi`.\n\n### 3.10.0\n\n**Date**: [15th July 2019][3.10.0-milestone]\n\n* Switch to OpenAPI schema generation.\n* Drop Python 2 support.\n* Add `generateschema --generator_class` CLI option\n* Updated PyYaml dependency for OpenAPI schema generation to `pyyaml>=5.1` [#6680][gh6680]\n* Resolve DeprecationWarning with markdown. [#6317][gh6317]\n* Use `user.get_username` in templates, in preference to `user.username`.\n* Fix for cursor pagination issue that could occur after object deletions.\n* Fix for nullable fields with `source=\"*\"`\n* Always apply all throttle classes during throttling checks.\n* Updates to jQuery and Markdown dependencies.\n* Don't strict disallow redundant `SerializerMethodField` field name arguments.\n* Don't render extra actions in browable API if not authenticated.\n* Strip null characters from search parameters.\n* Deprecate the `detail_route` decorator in favor of `action`, which accepts a `detail` bool. Use `@action(detail=True)` instead. [gh6687]\n* Deprecate the `list_route` decorator in favor of `action`, which accepts a `detail` bool. Use `@action(detail=False)` instead. [gh6687]\n\n## 3.9.x series\n\n### 3.9.4\n\n**Date**: 10th May 2019\n\nThis is a maintenance release that fixes an error handling bug under Python 2.\n\n### 3.9.3\n\n**Date**: 29th April 2019\n\nThis is the last Django REST Framework release that will support Python 2.\nBe sure to upgrade to Python 3 before upgrading to Django REST Framework 3.10.\n\n* Adjusted the compat check for django-guardian to allow the last guardian\n  version (v1.4.9) compatible with Python 2. [#6613][gh6613]\n\n### 3.9.2\n\n**Date**: [3rd March 2019][3.9.2-milestone]\n\n* Routers: invalidate `_urls` cache on `register()` [#6407][gh6407]\n* Deferred schema renderer creation to avoid requiring pyyaml. [#6416][gh6416]\n* Added 'request_forms' block to base.html [#6340][gh6340]\n* Fixed SchemaView to reset renderer on exception. [#6429][gh6429]\n* Update Django Guardian dependency. [#6430][gh6430]\n* Ensured support for Django 2.2 [#6422][gh6422] & [#6455][gh6455]\n* Made templates compatible with session-based CSRF. [#6207][gh6207]\n* Adjusted field `validators` to accept non-list iterables. [#6282][gh6282]\n* Added SearchFilter.get_search_fields() hook. [#6279][gh6279]\n* Fix DeprecationWarning when accessing collections.abc classes via collections [#6268][gh6268]\n* Allowed Q objects in limit_choices_to introspection. [#6472][gh6472]\n* Added lazy evaluation to composed permissions. [#6463][gh6463]\n* Add negation ~ operator to permissions composition [#6361][gh6361]\n* Avoided calling distinct on annotated fields in SearchFilter. [#6240][gh6240]\n* Introduced `RemovedInDRF…Warning` classes to simplify deprecations. [#6480][gh6480]\n\n### 3.9.1\n\n**Date**: [16th January 2019][3.9.1-milestone]\n\n* Resolve XSS issue in browsable API. [#6330][gh6330]\n* Upgrade Bootstrap to 3.4.0 to resolve XSS issue.\n* Resolve issues with composable permissions. [#6299][gh6299]\n* Respect `limit_choices_to` on foreign keys. [#6371][gh6371]\n\n### 3.9.0\n\n**Date**: [18th October 2018][3.9.0-milestone]\n\n* Improvements to ViewSet extra actions [#5605][gh5605]\n* Fix `action` support for ViewSet suffixes [#6081][gh6081]\n* Allow `action` docs sections [#6060][gh6060]\n* Deprecate the `Router.register` `base_name` argument in favor of `basename`. [#5990][gh5990]\n* Deprecate the `Router.get_default_base_name` method in favor of `Router.get_default_basename`. [#5990][gh5990]\n* Change `CharField` to disallow null bytes. [#6073][gh6073]\n  To revert to the old behavior, subclass `CharField` and remove `ProhibitNullCharactersValidator` from the validators.\n  ```python\n  class NullableCharField(serializers.CharField):\n      def __init__(self, *args, **kwargs):\n          super().__init__(*args, **kwargs)\n          self.validators = [\n              v\n              for v in self.validators\n              if not isinstance(v, ProhibitNullCharactersValidator)\n          ]\n  ```\n* Add `OpenAPIRenderer` and `generate_schema` management command. [#6229][gh6229]\n* Add OpenAPIRenderer by default, and add schema docs. [#6233][gh6233]\n* Allow permissions to be composed [#5753][gh5753]\n* Allow nullable BooleanField in Django 2.1 [#6183][gh6183]\n* Add testing of Python 3.7 support [#6141][gh6141]\n* Test using Django 2.1 final release. [#6109][gh6109]\n* Added djangorestframework-datatables to third-party packages [#5931][gh5931]\n* Change ISO 8601 date format to exclude year/month-only options [#5936][gh5936]\n* Update all pypi.python.org URLs to pypi.org [#5942][gh5942]\n* Ensure that html forms (multipart form data) respect optional fields [#5927][gh5927]\n* Allow hashing of ErrorDetail. [#5932][gh5932]\n* Correct schema parsing for JSONField [#5878][gh5878]\n* Render descriptions (from help_text) using safe [#5869][gh5869]\n* Removed input value from default_error_message [#5881][gh5881]\n* Added min_value/max_value support in DurationField [#5643][gh5643]\n* Fixed instance being overwritten in pk-only optimization try/except block [#5747][gh5747]\n* Fixed AttributeError from items filter when value is None [#5981][gh5981]\n* Fixed Javascript `e.indexOf` is not a function error [#5982][gh5982]\n* Fix schemas for extra actions [#5992][gh5992]\n* Improved get_error_detail to use error_dict/error_list [#5785][gh5785]\n* Improved URLs in Admin renderer [#5988][gh5988]\n* Add \"Community\" section to docs, minor cleanup [#5993][gh5993]\n* Moved guardian imports out of compat [#6054][gh6054]\n* Deprecate the `DjangoObjectPermissionsFilter` class, moved to the `djangorestframework-guardian` package. [#6075][gh6075]\n* Drop Django 1.10 support [#5657][gh5657]\n* Only catch TypeError/ValueError for object lookups [#6028][gh6028]\n* Handle models without .objects manager in ModelSerializer. [#6111][gh6111]\n* Improve ModelSerializer.create() error message. [#6112][gh6112]\n* Fix CSRF cookie check failure when using session auth with django 1.11.6+ [#6113][gh6113]\n* Updated JWT docs. [#6138][gh6138]\n* Fix autoescape not getting passed to urlize_quoted_links filter [#6191][gh6191]\n\n\n## 3.8.x series\n\n### 3.8.2\n\n**Date**: [6th April 2018][3.8.2-milestone]\n\n* Fix `read_only` + `default` `unique_together` validation. [#5922][gh5922]\n* authtoken.views import coreapi from rest_framework.compat, not directly. [#5921][gh5921]\n* Docs: Add missing argument 'detail' to Route [#5920][gh5920]\n\n\n### 3.8.1\n\n**Date**: [4th April 2018][3.8.1-milestone]\n\n* Use old `url_name` behavior in route decorators [#5915][gh5915]\n\n    For `list_route` and `detail_route` maintain the old behavior of `url_name`,\n    basing it on the `url_path` instead of the function name.\n\n\n### 3.8.0\n\n**Date**: [3rd April 2018][3.8.0-milestone]\n\n\n* **Breaking Change**: Alter `read_only` plus `default` behavior. [#5886][gh5886]\n\n    `read_only` fields will now **always** be excluded from writable fields.\n\n    Previously `read_only` fields with a `default` value would use the `default` for create and update operations.\n\n    In order to maintain the old behavior you may need to pass the value of `read_only` fields when calling `save()` in\n    the view:\n\n        def perform_create(self, serializer):\n            serializer.save(owner=self.request.user)\n\n    Alternatively you may override `save()` or `create()` or `update()` on the serializer as appropriate.\n\n* Correct allow_null behavior when required=False [#5888][gh5888]\n\n    Without an explicit `default`, `allow_null` implies a default of `null` for outgoing serialization. Previously such\n    fields were being skipped when read-only or otherwise not required.\n\n    **Possible backwards compatibility break** if you were relying on such fields being excluded from the outgoing\n    representation. In order to restore the old behavior you can override `data` to exclude the field when `None`.\n\n    For example:\n\n        @property\n        def data(self):\n            \"\"\"\n            Drop `maybe_none` field if None.\n            \"\"\"\n            data = super().data\n            if 'maybe_none' in data and data['maybe_none'] is None:\n                del data['maybe_none']\n            return data\n\n* Refactor dynamic route generation and improve viewset action introspectibility. [#5705][gh5705]\n\n    `ViewSet`s have been provided with new attributes and methods that allow\n    it to introspect its set of actions and the details of the current action.\n\n    * Merged `list_route` and `detail_route` into a single `action` decorator.\n    * Get all extra actions on a `ViewSet` with `.get_extra_actions()`.\n    * Extra actions now set the `url_name` and `url_path` on the decorated method.\n    * `url_name` is now based on the function name, instead of the `url_path`,\n      as the path is not always suitable (e.g., capturing arguments in the path).\n    * Enable action url reversing through `.reverse_action()` method (added in 3.7.4)\n    * Example reverse call: `self.reverse_action(self.custom_action.url_name)`\n    * Add `detail` initkwarg to indicate if the current action is operating on a\n      collection or a single instance.\n\n    Additional changes:\n\n    * Deprecated `list_route` & `detail_route` in favor of `action` decorator with `detail` boolean.\n    * Deprecated dynamic list/detail route variants in favor of `DynamicRoute` with `detail` boolean.\n    * Refactored the router's dynamic route generation.\n    * `list_route` and `detail_route` maintain the old behavior of `url_name`,\n      basing it on the `url_path` instead of the function name.\n\n* Fix formatting of the 3.7.4 release note [#5704][gh5704]\n* Docs: Update DRF Writable Nested Serializers references [#5711][gh5711]\n* Docs: Fixed typo in auth URLs example. [#5713][gh5713]\n* Improve composite field child errors [#5655][gh5655]\n* Disable HTML inputs for dict/list fields [#5702][gh5702]\n* Fix typo in HostNameVersioning doc [#5709][gh5709]\n* Use rsplit to get module and classname for imports [#5712][gh5712]\n* Formalize URLPatternsTestCase [#5703][gh5703]\n* Add exception translation test [#5700][gh5700]\n* Test staticfiles [#5701][gh5701]\n* Add drf-yasg to documentation and schema 3rd party packages [#5720][gh5720]\n* Remove unused `compat._resolve_model()` [#5733][gh5733]\n* Drop compat workaround for unsupported Python 3.2 [#5734][gh5734]\n* Prefer `iter(dict)` over `iter(dict.keys())` [#5736][gh5736]\n* Pass `python_requires` argument to setuptools [#5739][gh5739]\n* Remove unused links from docs [#5735][gh5735]\n* Prefer https protocol for links in docs when available [#5729][gh5729]\n* Add HStoreField, postgres fields tests [#5654][gh5654]\n* Always fully qualify ValidationError in docs [#5751][gh5751]\n* Remove unreachable code from ManualSchema [#5766][gh5766]\n* Allowed customizing API documentation code samples [#5752][gh5752]\n* Updated docs to use `pip show` [#5757][gh5757]\n* Load 'static' instead of 'staticfiles' in templates [#5773][gh5773]\n* Fixed a typo in `fields` docs [#5783][gh5783]\n* Refer to \"NamespaceVersioning\" instead of \"NamespacedVersioning\" in the documentation [#5754][gh5754]\n* ErrorDetail: add `__eq__`/`__ne__` and `__repr__` [#5787][gh5787]\n* Replace `background-attachment: fixed` in docs [#5777][gh5777]\n* Make 404 & 403 responses consistent with `exceptions.APIException` output [#5763][gh5763]\n* Small fix to API documentation: schemas [#5796][gh5796]\n* Fix schema generation for PrimaryKeyRelatedField [#5764][gh5764]\n* Represent serializer DictField as an Object in schema [#5765][gh5765]\n* Added docs example reimplementing ObtainAuthToken [#5802][gh5802]\n* Add schema to the ObtainAuthToken view [#5676][gh5676]\n* Fix request formdata handling [#5800][gh5800]\n* Fix authtoken views imports [#5818][gh5818]\n* Update pytest, isort [#5815][gh5815] [#5817][gh5817] [#5894][gh5894]\n* Fixed active timezone handling for non ISO8601 datetimes. [#5833][gh5833]\n* Made TemplateHTMLRenderer render IntegerField inputs when value is `0`. [#5834][gh5834]\n* Corrected endpoint in tutorial instructions [#5835][gh5835]\n* Add Django Rest Framework Role Filters to Third party packages [#5809][gh5809]\n* Use single copy of static assets. Update jQuery [#5823][gh5823]\n* Changes ternary conditionals to be PEP308 compliant [#5827][gh5827]\n* Added links to 'A Todo List API with React' and 'Blog API' tutorials [#5837][gh5837]\n* Fix comment typo in ModelSerializer [#5844][gh5844]\n* Add admin to installed apps to avoid test failures. [#5870][gh5870]\n* Fixed schema for UUIDField in SimpleMetadata. [#5872][gh5872]\n* Corrected docs on router include with namespaces. [#5843][gh5843]\n* Test using model objects for dotted source default [#5880][gh5880]\n* Allow traversing nullable related fields [#5849][gh5849]\n* Added: Tutorial: Django REST with React (Django 2.0) [#5891][gh5891]\n* Add `LimitOffsetPagination.get_count` to allow method override [#5846][gh5846]\n* Don't show hidden fields in metadata [#5854][gh5854]\n* Enable OrderingFilter to handle an empty tuple (or list) for the 'ordering' field. [#5899][gh5899]\n* Added generic 500 and 400 JSON error handlers. [#5904][gh5904]\n\n\n## 3.7.x series\n\n### 3.7.7\n\n**Date**: [21st December 2017][3.7.7-milestone]\n\n* Fix typo to include *.mo locale files to packaging. [#5697][gh5697], [#5695][gh5695]\n\n### 3.7.6\n\n**Date**: [21st December 2017][3.7.6-milestone]\n\n* Add missing *.ico icon files to packaging.\n\n### 3.7.5\n\n**Date**: [21st December 2017][3.7.5-milestone]\n\n* Add missing *.woff2 font files to packaging. [#5692][gh5692]\n* Add missing *.mo locale files to packaging. [#5695][gh5695], [#5696][gh5696]\n\n### 3.7.4\n\n**Date**: [20th December 2017][3.7.4-milestone]\n\n* Schema: Extract method for `manual_fields` processing [#5633][gh5633]\n\n    Allows for easier customization of `manual_fields` processing, for example\n    to provide per-method manual fields. `AutoSchema` adds `get_manual_fields`,\n    as the intended override point, and a utility method `update_fields`, to\n    handle by-name field replacement from a list, which, in general, you are not\n    expected to override.\n\n    Note: `AutoSchema.__init__` now ensures `manual_fields` is a list.\n    Previously may have been stored internally as `None`.\n\n* Remove ulrparse compatibility shim; use six instead [#5579][gh5579]\n* Drop compat wrapper for `TimeDelta.total_seconds()` [#5577][gh5577]\n* Clean up all whitespace throughout project [#5578][gh5578]\n* Compat cleanup [#5581][gh5581]\n* Add pygments CSS block in browsable API views [#5584][gh5584] [#5587][gh5587]\n* Remove `set_rollback()` from compat [#5591][gh5591]\n* Fix request body/POST access [#5590][gh5590]\n* Rename test to reference correct issue [#5610][gh5610]\n* Documentation Fixes [#5611][gh5611] [#5612][gh5612]\n* Remove references to unsupported Django versions in docs and code [#5602][gh5602]\n* Test Serializer exclude for declared fields [#5599][gh5599]\n* Fixed schema generation for filter backends [#5613][gh5613]\n* Minor cleanup for ModelSerializer tests [#5598][gh5598]\n* Reimplement request attribute access w/ `__getattr__` [#5617][gh5617]\n* Fixed SchemaJSRenderer renders invalid Javascript [#5607][gh5607]\n* Make Django 2.0 support official/explicit [#5619][gh5619]\n* Perform type check on passed request argument [#5618][gh5618]\n* Fix AttributeError hiding on request authenticators [#5600][gh5600]\n* Update test requirements [#5626][gh5626]\n* Docs: `Serializer._declared_fields` enable modifying fields on a serializer [#5629][gh5629]\n* Fix packaging [#5624][gh5624]\n* Fix readme rendering for PyPI, add readme build to CI [#5625][gh5625]\n* Update tutorial [#5622][gh5622]\n* Non-required fields with `allow_null=True` should not imply a default value [#5639][gh5639]\n* Docs: Add `allow_null` serialization output note [#5641][gh5641]\n* Update to use the Django 2.0 release in tox.ini [#5645][gh5645]\n* Fix `Serializer.data` for Browsable API rendering when provided invalid `data` [#5646][gh5646]\n* Docs: Note AutoSchema limitations on bare APIView [#5649][gh5649]\n* Add `.basename` and `.reverse_action()` to ViewSet [#5648][gh5648]\n* Docs: Fix typos in serializers documentation [#5652][gh5652]\n* Fix `override_settings` compat [#5668][gh5668]\n* Add DEFAULT_SCHEMA_CLASS setting [#5658][gh5658]\n* Add docs note re generated BooleanField being `required=False` [#5665][gh5665]\n* Add 'dist' build [#5656][gh5656]\n* Fix typo in docstring [#5678][gh5678]\n* Docs: Add `UNAUTHENTICATED_USER = None` note [#5679][gh5679]\n* Update OPTIONS example from “Documenting Your API” [#5680][gh5680]\n* Docs: Add note on object permissions for FBVs [#5681][gh5681]\n* Docs: Add example to `to_representation` docs [#5682][gh5682]\n* Add link to Classy DRF in docs [#5683][gh5683]\n* Document ViewSet.action [#5685][gh5685]\n* Fix schema docs typo [#5687][gh5687]\n* Fix URL pattern parsing in schema generation [#5689][gh5689]\n* Add example using `source=‘*’` to custom field docs. [#5688][gh5688]\n* Fix format_suffix_patterns behavior with Django 2 path() routes [#5691][gh5691]\n\n\n### 3.7.3\n\n**Date**: [6th November 2017][3.7.3-milestone]\n\n* Fix `AppRegistryNotReady` error from contrib.auth view imports [#5567][gh5567]\n\n\n### 3.7.2\n\n**Date**: [6th November 2017][3.7.2-milestone]\n\n* Fixed Django 2.1 compatibility due to removal of django.contrib.auth.login()/logout() views. [#5510][gh5510]\n* Add missing import for TextLexer. [#5512][gh5512]\n* Adding examples and documentation for caching [#5514][gh5514]\n* Include date and date-time format for schema generation [#5511][gh5511]\n* Use triple backticks for markdown code blocks [#5513][gh5513]\n* Interactive docs - make bottom sidebar items sticky [#5516][gh5516]\n* Clarify pagination system check [#5524][gh5524]\n* Stop JSONBoundField mangling invalid JSON [#5527][gh5527]\n* Have JSONField render as textarea in Browsable API [#5530][gh5530]\n* Schema: Exclude OPTIONS/HEAD for ViewSet actions [#5532][gh5532]\n* Fix ordering for dotted sources [#5533][gh5533]\n* Fix: Fields with `allow_null=True` should imply a default serialization value [#5518][gh5518]\n* Ensure Location header is strictly a 'str', not subclass. [#5544][gh5544]\n* Add import to example in api-guide/parsers [#5547][gh5547]\n* Catch OverflowError for \"out of range\" datetimes [#5546][gh5546]\n* Add djangorestframework-rapidjson to third party packages [#5549][gh5549]\n* Increase test coverage for `drf_create_token` command [#5550][gh5550]\n* Add trove classifier for Python 3.6 support. [#5555][gh5555]\n* Add pip cache support to the Travis CI configuration [#5556][gh5556]\n* Rename [`wheel`] section to [`bdist_wheel`] as the former is legacy [#5557][gh5557]\n* Fix invalid escape sequence deprecation warnings [#5560][gh5560]\n* Add interactive docs error template [#5548][gh5548]\n* Add rounding parameter to DecimalField [#5562][gh5562]\n* Fix all BytesWarning caught during tests [#5561][gh5561]\n* Use dict and set literals instead of calls to dict() and set() [#5559][gh5559]\n* Change ImageField validation pattern, use validators from DjangoImageField [#5539][gh5539]\n* Fix processing unicode symbols in query_string by Python 2 [#5552][gh5552]\n\n\n### 3.7.1\n\n**Date**: [16th October 2017][3.7.1-milestone]\n\n* Fix Interactive documentation always uses false for boolean fields in requests [#5492][gh5492]\n* Improve compatibility with Django 2.0 alpha. [#5500][gh5500] [#5503][gh5503]\n* Improved handling of schema naming collisions [#5486][gh5486]\n* Added additional docs and tests around providing a default value for dotted `source` fields [#5489][gh5489]\n\n\n### 3.7.0\n\n**Date**: [6th October 2017][3.7.0-milestone]\n\n* Fix `DjangoModelPermissions` to ensure user authentication before calling the view's `get_queryset()` method. As a side effect, this changes the order of the HTTP method permissions and authentication checks, and 405 responses will only be returned when authenticated. If you want to replicate the old behavior, see the PR for details. [#5376][gh5376]\n* Deprecated `exclude_from_schema` on `APIView` and `api_view` decorator. Set `schema = None` or `@schema(None)` as appropriate. [#5422][gh5422]\n* Timezone-aware `DateTimeField`s now respect active or default `timezone` during serialization, instead of always using UTC. [#5435][gh5435]\n\n    Resolves inconsistency whereby instances were serialized with supplied datetime for `create` but UTC for `retrieve`. [#3732][gh3732]\n\n    **Possible backwards compatibility break** if you were relying on datetime strings being UTC. Have client interpret datetimes or [set default or active timezone (docs)][djangodocs-set-timezone] to UTC if needed.\n\n* Removed DjangoFilterBackend inline with deprecation policy. Use `django_filters.rest_framework.FilterSet` and/or `django_filters.rest_framework.DjangoFilterBackend` instead. [#5273][gh5273]\n* Don't strip microseconds from `time` when encoding. Makes consistent with `datetime`.\n    **BC Change**: Previously only milliseconds were encoded. [#5440][gh5440]\n* Added `STRICT_JSON` setting (default `True`) to raise exception for the extended float values (`nan`, `inf`, `-inf`) accepted by Python's `json` module.\n    **BC Change**: Previously these values would converted to corresponding strings. Set `STRICT_JSON` to `False` to restore the previous behavior. [#5265][gh5265]\n* Add support for `page_size` parameter in CursorPaginator class [#5250][gh5250]\n* Make `DEFAULT_PAGINATION_CLASS` `None` by default.\n    **BC Change**: If your were **just** setting `PAGE_SIZE` to enable pagination you will need to add `DEFAULT_PAGINATION_CLASS`.\n    The previous default was `rest_framework.pagination.PageNumberPagination`. There is a system check warning to catch this case. You may silence that if you are setting pagination class on a per-view basis. [#5170][gh5170]\n* Catch `APIException` from `get_serializer_fields` in schema generation. [#5443][gh5443]\n* Allow custom authentication and permission classes when using `include_docs_urls` [#5448][gh5448]\n* Defer translated string evaluation on validators. [#5452][gh5452]\n* Added default value for 'detail' param into 'ValidationError' exception [#5342][gh5342]\n* Adjust schema get_filter_fields rules to match framework [#5454][gh5454]\n* Updated test matrix to add Django 2.0 and drop Django 1.8 & 1.9\n    **BC Change**: This removes Django 1.8 and Django 1.9 from Django REST Framework supported versions. [#5457][gh5457]\n* Fixed a deprecation warning in serializers.ModelField [#5058][gh5058]\n* Added a more explicit error message when `get_queryset` returned `None` [#5348][gh5348]\n* Fix docs for Response `data` description [#5361][gh5361]\n* Fix __pycache__/.pyc excludes when packaging [#5373][gh5373]\n* Fix default value handling for dotted sources [#5375][gh5375]\n* Ensure content_type is set when passing empty body to RequestFactory [#5351][gh5351]\n* Fix ErrorDetail Documentation [#5380][gh5380]\n* Allow optional content in the generic content form [#5372][gh5372]\n* Updated supported values for the NullBooleanField [#5387][gh5387]\n* Fix ModelSerializer custom named fields with source on model [#5388][gh5388]\n* Fixed the MultipleFieldLookupMixin documentation example to properly check for object level permission [#5398][gh5398]\n* Update get_object() example in permissions.md [#5401][gh5401]\n* Fix authtoken management command [#5415][gh5415]\n* Fix schema generation markdown [#5421][gh5421]\n* Allow `ChoiceField.choices` to be set dynamically [#5426][gh5426]\n* Add the project layout to the quickstart [#5434][gh5434]\n* Reuse 'apply_markdown' function in 'render_markdown' templatetag [#5469][gh5469]\n* Added links to `drf-openapi` package in docs [#5470][gh5470]\n* Added docstrings code highlighting with pygments [#5462][gh5462]\n* Fixed documentation rendering for views named `data` [#5472][gh5472]\n* Docs: Clarified 'to_internal_value()' validation behavior [#5466][gh5466]\n* Fix missing six.text_type() call on APIException.__str__ [#5476][gh5476]\n* Document documentation.py [#5478][gh5478]\n* Fix naming collisions in Schema Generation [#5464][gh5464]\n* Call Django's authenticate function with the request object [#5295][gh5295]\n* Update coreapi JS to 0.1.1 [#5479][gh5479]\n* Have `is_list_view` recognize RetrieveModel… views [#5480][gh5480]\n* Remove Django 1.8 & 1.9 compatibility code [#5481][gh5481]\n* Remove deprecated schema code from DefaultRouter [#5482][gh5482]\n* Refactor schema generation to allow per-view customization.\n    **BC Change**: `SchemaGenerator.get_serializer_fields` has been refactored as `AutoSchema.get_serializer_fields` and drops the `view` argument [#5354][gh5354]\n\n## 3.6.x series\n\n### 3.6.4\n\n**Date**: [21st August 2017][3.6.4-milestone]\n\n* Ignore any invalidly formed query parameters for OrderingFilter. [#5131][gh5131]\n* Improve memory footprint when reading large JSON requests. [#5147][gh5147]\n* Fix schema generation for pagination. [#5161][gh5161]\n* Fix exception when `HTML_CUTOFF` is set to `None`. [#5174][gh5174]\n* Fix browsable API not supporting `multipart/form-data` correctly. [#5176][gh5176]\n* Fixed `test_hyperlinked_related_lookup_url_encoded_exists`. [#5179][gh5179]\n* Make sure max_length is in FileField kwargs. [#5186][gh5186]\n* Fix `list_route` & `detail_route` with kwargs contains curly bracket in `url_path` [#5187][gh5187]\n* Add Django manage command to create a DRF user Token. [#5188][gh5188]\n* Ensure API documentation templates do not check for user authentication [#5162][gh5162]\n* Fix special case where OneToOneField is also primary key. [#5192][gh5192]\n* Added aria-label and a new region for accessibility purposes in base.html [#5196][gh5196]\n* Quote nested API parameters in api.js. [#5214][gh5214]\n* Set ViewSet args/kwargs/request before dispatch. [#5229][gh5229]\n* Added unicode support to SlugField. [#5231][gh5231]\n* Fix HiddenField appears in Raw Data form initial content. [#5259][gh5259]\n* Raise validation error on invalid timezone parsing. [#5261][gh5261]\n* Fix SearchFilter to-many behavior/performance. [#5264][gh5264]\n* Simplified chained comparisons and minor code fixes. [#5276][gh5276]\n* RemoteUserAuthentication, docs, and tests. [#5306][gh5306]\n* Revert \"Cached the field's root and context property\" [#5313][gh5313]\n* Fix introspection of list field in schema. [#5326][gh5326]\n* Fix interactive docs for multiple nested and extra methods. [#5334][gh5334]\n* Fix/remove undefined template var \"schema\" [#5346][gh5346]\n\n### 3.6.3\n\n**Date**: [12th May 2017][3.6.3-milestone]\n\n* Raise 404 if a URL lookup results in ValidationError. ([#5126][gh5126])\n* Honor http_method_names on class based view, when generating API schemas. ([#5085][gh5085])\n* Allow overridden `get_limit` in LimitOffsetPagination to return all records. ([#4437][gh4437])\n* Fix partial update for the ListSerializer. ([#4222][gh4222])\n* Render JSONField control correctly in browsable API. ([#4999][gh4999], [#5042][gh5042])\n* Raise validation errors for invalid datetime in given timezone. ([#4987][gh4987])\n* Support restricting doc & schema shortcuts to a subset of urls. ([#4979][gh4979])\n* Resolve SchemaGenerator error with paginators that have no `page_size` attribute. ([#5086][gh5086], [#3692][gh3692])\n* Resolve HyperlinkedRelatedField exception on string with %20 instead of space. ([#4748][gh4748], [#5078][gh5078])\n* Customizable schema generator classes. ([#5082][gh5082])\n* Update existing vary headers in response instead of overwriting them. ([#5047][gh5047])\n* Support passing `.as_view()` to view instance. ([#5053][gh5053])\n* Use correct exception handler when settings overridden on a view. ([#5055][gh5055], [#5054][gh5054])\n* Update Boolean field to support 'yes' and 'no' values. ([#5038][gh5038])\n* Fix unique validator for ChoiceField. ([#5004][gh5004], [#5026][gh5026], [#5028][gh5028])\n* JavaScript cleanups in API Docs. ([#5001][gh5001])\n* Include URL path regexs in API schemas where valid. ([#5014][gh5014])\n* Correctly set scheme in coreapi TokenAuthentication. ([#5000][gh5000], [#4994][gh4994])\n* HEAD requests on ViewSets should not return 405. ([#4705][gh4705], [#4973][gh4973], [#4864][gh4864])\n* Support usage of 'source' in `extra_kwargs`. ([#4688][gh4688])\n* Fix invalid content type for schema.js ([#4968][gh4968])\n* Fix DjangoFilterBackend inheritance issues. ([#5089][gh5089], [#5117][gh5117])\n\n### 3.6.2\n\n**Date**: [10th March 2017][3.6.2-milestone]\n\n* Support for Safari & IE in API docs. ([#4959][gh4959], [#4961][gh4961])\n* Add missing `mark_safe` in API docs template tags. ([#4952][gh4952], [#4953][gh4953])\n* Add missing glyphicon fonts. ([#4950][gh4950], [#4951][gh4951])\n* Fix One-to-one fields in API docs. ([#4955][gh4955], [#4956][gh4956])\n* Test clean ups. ([#4949][gh4949])\n\n### 3.6.1\n\n**Date**: [9th March 2017][3.6.1-milestone]\n\n* Ensure `markdown` dependency is optional. ([#4947][gh4947])\n\n### 3.6.0\n\n**Date**: [9th March 2017][3.6.0-milestone]\n\nSee the [release announcement][3.6-release].\n\n---\n\n## 3.5.x series\n\n### 3.5.4\n\n**Date**: [10th February 2017][3.5.4-milestone]\n\n* Add max_length and min_length arguments for ListField. ([#4877][gh4877])\n* Add per-view custom exception handler support. ([#4753][gh4753])\n* Support disabling of declared fields on serializer subclasses. ([#4764][gh4764])\n* Support custom view names on `@list_route` and `@detail_route` endpoints. ([#4821][gh4821])\n* Correct labels for fields in login template when custom user model is used. ([#4841][gh4841])\n* Whitespace fixes for descriptions generated from docstrings. ([#4759][gh4759], [#4869][gh4869], [#4870][gh4870])\n* Better error reporting when schemas are returned by views without a schema renderer. ([#4790][gh4790])\n* Fix for returned response of `PUT` requests when `prefetch_related` is used. ([#4661][gh4661], [#4668][gh4668])\n* Fix for breadcrumb view names. ([#4750][gh4750])\n* Fix for RequestsClient ensuring fully qualified URLs. ([#4678][gh4678])\n* Fix for incorrect behavior of writable-nested fields check in some cases. ([#4634][gh4634], [#4669][gh4669])\n* Resolve Django deprecation warnings. ([#4712][gh4712])\n* Various cleanup of test cases.\n\n### 3.5.3\n\n**Date**: [7th November 2016][3.5.3-milestone]\n\n* Don't raise incorrect FilterSet deprecation warnings. ([#4660][gh4660], [#4643][gh4643], [#4644][gh4644])\n* Schema generation should not raise 404 when a view permission class does. ([#4645][gh4645], [#4646][gh4646])\n* Add `autofocus` support for input controls. ([#4650][gh4650])\n\n### 3.5.2\n\n**Date**: [1st November 2016][3.5.2-milestone]\n\n* Restore exception tracebacks in Python 2.7. ([#4631][gh4631], [#4638][gh4638])\n* Properly display dicts in the admin console. ([#4532][gh4532], [#4636][gh4636])\n* Fix is_simple_callable with variable args, kwargs. ([#4622][gh4622], [#4602][gh4602])\n* Support 'on'/'off' literals with BooleanField. ([#4640][gh4640], [#4624][gh4624])\n* Enable cursor pagination of value querysets. ([#4569][gh4569])\n* Fix support of get_full_details() for Throttled exceptions. ([#4627][gh4627])\n* Fix FilterSet proxy. ([#4620][gh4620])\n* Make serializer fields import explicit. ([#4628][gh4628])\n* Drop redundant requests adapter. ([#4639][gh4639])\n\n### 3.5.1\n\n**Date**: [21st October 2016][3.5.1-milestone]\n\n* Make `rest_framework/compat.py` imports. ([#4612][gh4612], [#4608][gh4608], [#4601][gh4601])\n* Fix bug in schema base path generation. ([#4611][gh4611], [#4605][gh4605])\n* Fix broken case of ListSerializer with single item. ([#4609][gh4609], [#4606][gh4606])\n* Remove bare `raise` for Python 3.5 compat. ([#4600][gh4600])\n\n### 3.5.0\n\n**Date**: [20th October 2016][3.5.0-milestone]\n\n---\n\n## 3.4.x series\n\n### 3.4.7\n\n**Date**: [21st September 2016][3.4.7-milestone]\n\n* Fallback behavior for request parsing when request.POST already accessed. ([#3951][gh3951], [#4500][gh4500])\n* Fix regression of `RegexField`. ([#4489][gh4489], [#4490][gh4490], [#2617][gh2617])\n* Missing comma in `admin.html` causing CSRF error. ([#4472][gh4472], [#4473][gh4473])\n* Fix response rendering with empty context. ([#4495][gh4495])\n* Fix indentation regression in API listing. ([#4493][gh4493])\n* Fixed an issue where the incorrect value is set to `ResolverMatch.func_name` of api_view decorated view. ([#4465][gh4465], [#4462][gh4462])\n* Fix `APIClient.get()` when path contains unicode arguments ([#4458][gh4458])\n\n### 3.4.6\n\n**Date**: [23rd August 2016][3.4.6-milestone]\n\n* Fix malformed Javascript in browsable API. ([#4435][gh4435])\n* Skip HiddenField from Schema fields. ([#4425][gh4425], [#4429][gh4429])\n* Improve Create to show the original exception traceback. ([#3508][gh3508])\n* Fix `AdminRenderer` display of PK only related fields. ([#4419][gh4419], [#4423][gh4423])\n\n### 3.4.5\n\n**Date**: [19th August 2016][3.4.5-milestone]\n\n* Improve debug error handling. ([#4416][gh4416], [#4409][gh4409])\n* Allow custom CSRF_HEADER_NAME setting. ([#4415][gh4415], [#4410][gh4410])\n* Include .action attribute on viewsets when generating schemas. ([#4408][gh4408], [#4398][gh4398])\n* Do not include request.FILES items in request.POST. ([#4407][gh4407])\n* Fix rendering of checkbox multiple. ([#4403][gh4403])\n* Fix docstring of Field.get_default. ([#4404][gh4404])\n* Replace utf8 character with its ascii counterpart in README. ([#4412][gh4412])\n\n### 3.4.4\n\n**Date**: [12th August 2016][3.4.4-milestone]\n\n* Ensure views are fully initialized when generating schemas. ([#4373][gh4373], [#4382][gh4382], [#4383][gh4383], [#4279][gh4279], [#4278][gh4278])\n* Add form field descriptions to schemas. ([#4387][gh4387])\n* Fix category generation for schema endpoints. ([#4391][gh4391], [#4394][gh4394], [#4390][gh4390], [#4386][gh4386], [#4376][gh4376], [#4329][gh4329])\n* Don't strip empty query params when paginating. ([#4392][gh4392], [#4393][gh4393], [#4260][gh4260])\n* Do not re-run query for empty results with LimitOffsetPagination. ([#4201][gh4201], [#4388][gh4388])\n* Stricter type validation for CharField. ([#4380][gh4380], [#3394][gh3394])\n* RelatedField.choices should preserve non-string values. ([#4111][gh4111], [#4379][gh4379], [#3365][gh3365])\n* Test case for rendering checkboxes in vertical form style. ([#4378][gh4378], [#3868][gh3868], [#3868][gh3868])\n* Show error traceback HTML in browsable API ([#4042][gh4042], [#4172][gh4172])\n* Fix handling of ALLOWED_VERSIONS and no DEFAULT_VERSION. [#4370][gh4370]\n* Allow `max_digits=None` on DecimalField. ([#4377][gh4377], [#4372][gh4372])\n* Limit queryset when rendering relational choices. ([#4375][gh4375], [#4122][gh4122], [#3329][gh3329], [#3330][gh3330], [#3877][gh3877])\n* Resolve form display with ChoiceField, MultipleChoiceField and non-string choices. ([#4374][gh4374], [#4119][gh4119], [#4121][gh4121], [#4137][gh4137], [#4120][gh4120])\n* Fix call to TemplateHTMLRenderer.resolve_context() fallback method. ([#4371][gh4371])\n\n### 3.4.3\n\n**Date**: [5th August 2016][3.4.3-milestone]\n\n* Include fallback for users of older TemplateHTMLRenderer internal API. ([#4361][gh4361])\n\n### 3.4.2\n\n**Date**: [5th August 2016][3.4.2-milestone]\n\n* Include kwargs passed to 'as_view' when generating schemas. ([#4359][gh4359], [#4330][gh4330], [#4331][gh4331])\n* Access `request.user.is_authenticated` as property not method, under Django 1.10+ ([#4358][gh4358], [#4354][gh4354])\n* Filter HEAD out from schemas. ([#4357][gh4357])\n* extra_kwargs takes precedence over uniqueness kwargs. ([#4198][gh4198], [#4199][gh4199], [#4349][gh4349])\n* Correct descriptions when tabs are used in code indentation. ([#4345][gh4345], [#4347][gh4347])*\n* Change template context generation in TemplateHTMLRenderer. ([#4236][gh4236])\n* Serializer defaults should not be included in partial updates. ([#4346][gh4346], [#3565][gh3565])\n* Consistent behavior & descriptive error from FileUploadParser when filename not included. ([#4340][gh4340], [#3610][gh3610], [#4292][gh4292], [#4296][gh4296])\n* DecimalField quantizes incoming digitals. ([#4339][gh4339], [#4318][gh4318])\n* Handle non-string input for IP fields. ([#4335][gh4335], [#4336][gh4336], [#4338][gh4338])\n* Fix leading slash handling when Schema generation includes a root URL. ([#4332][gh4332])\n* Test cases for DictField with allow_null options. ([#4348][gh4348])\n* Update tests from Django 1.10 beta to Django 1.10. ([#4344][gh4344])\n\n### 3.4.1\n\n**Date**: [28th July 2016][3.4.1-milestone]\n\n* Added `root_renderers` argument to `DefaultRouter`. ([#4323][gh4323], [#4268][gh4268])\n* Added `url` and `schema_url` arguments. ([#4321][gh4321], [#4308][gh4308], [#4305][gh4305])\n* Unique together checks should apply to read-only fields which have a default. ([#4316][gh4316], [#4294][gh4294])\n* Set view.format_kwarg in schema generator. ([#4293][gh4293], [#4315][gh4315])\n* Fix schema generator for views with `pagination_class = None`. ([#4314][gh4314], [#4289][gh4289])\n* Fix schema generator for views with no `get_serializer_class`. ([#4265][gh4265], [#4285][gh4285])\n* Fixes for media type parameters in `Accept` and `Content-Type` headers. ([#4287][gh4287], [#4313][gh4313], [#4281][gh4281])\n* Use verbose_name instead of object_name in error messages. ([#4299][gh4299])\n* Minor version update to Twitter Bootstrap. ([#4307][gh4307])\n* SearchFilter raises error when using with related field. ([#4302][gh4302], [#4303][gh4303], [#4298][gh4298])\n* Adding support for RFC 4918 status codes. ([#4291][gh4291])\n* Add LICENSE.md to the built wheel. ([#4270][gh4270])\n* Serializing \"complex\" field returns None instead of the value since 3.4 ([#4272][gh4272], [#4273][gh4273], [#4288][gh4288])\n\n### 3.4.0\n\n**Date**: [14th July 2016][3.4.0-milestone]\n\n* Don't strip microseconds in JSON output. ([#4256][gh4256])\n* Two slightly different iso 8601 datetime serialization. ([#4255][gh4255])\n* Resolve incorrect inclusion of media type parameters. ([#4254][gh4254])\n* Response Content-Type potentially malformed. ([#4253][gh4253])\n* Fix setup.py error on some platforms. ([#4246][gh4246])\n* Move alternate formats in coreapi into separate packages. ([#4244][gh4244])\n* Add localize keyword argument to `DecimalField`. ([#4233][gh4233])\n* Fix issues with routers for custom list-route and detail-routes. ([#4229][gh4229])\n* Namespace versioning with nested namespaces. ([#4219][gh4219])\n* Robust uniqueness checks. ([#4217][gh4217])\n* Minor refactoring of `must_call_distinct`. ([#4215][gh4215])\n* Overridable offset cutoff in CursorPagination. ([#4212][gh4212])\n* Pass through strings as-in with date/time fields. ([#4196][gh4196])\n* Add test confirming that required=False is valid on a relational field. ([#4195][gh4195])\n* In LimitOffsetPagination `limit=0` should revert to default limit. ([#4194][gh4194])\n* Exclude read_only=True fields from unique_together validation & add docs. ([#4192][gh4192])\n* Handle bytestrings in JSON. ([#4191][gh4191])\n* JSONField(binary=True) represents using binary strings, which JSONRenderer does not support. ([#4187][gh4187])\n* JSONField(binary=True) represents using binary strings, which JSONRenderer does not support. ([#4185][gh4185])\n* More robust form rendering in the browsable API. ([#4181][gh4181])\n* Empty cases of `.validated_data` and `.errors` as lists not dicts for ListSerializer. ([#4180][gh4180])\n* Schemas & client libraries. ([#4179][gh4179])\n* Removed `AUTH_USER_MODEL` compat property. ([#4176][gh4176])\n* Clean up existing deprecation warnings. ([#4166][gh4166])\n* Django 1.10 support. ([#4158][gh4158])\n* Updated jQuery version to 1.12.4. ([#4157][gh4157])\n* More robust default behavior on OrderingFilter. ([#4156][gh4156])\n* description.py codes and tests removal. ([#4153][gh4153])\n* Wrap guardian.VERSION in tuple. ([#4149][gh4149])\n* Refine validator for fields with <source=> kwargs. ([#4146][gh4146])\n* Fix None values representation in children of ListField, DictField. ([#4118][gh4118])\n* Resolve TimeField representation for midnight value. ([#4107][gh4107])\n* Set proper status code in AdminRenderer for the redirection after POST/DELETE requests. ([#4106][gh4106])\n* TimeField render returns None instead of 00:00:00. ([#4105][gh4105])\n* Fix incorrectly named zh-hans and zh-hant locale path. ([#4103][gh4103])\n* Prevent raising exception when limit is 0. ([#4098][gh4098])\n* TokenAuthentication: Allow custom keyword in the header. ([#4097][gh4097])\n* Handle incorrectly padded HTTP basic auth header. ([#4090][gh4090])\n* LimitOffset pagination crashes Browsable API when limit=0. ([#4079][gh4079])\n* Fixed DecimalField arbitrary precision support. ([#4075][gh4075])\n* Added support for custom CSRF cookie names. ([#4049][gh4049])\n* Fix regression introduced by #4035. ([#4041][gh4041])\n* No auth view failing permission should raise 403. ([#4040][gh4040])\n* Fix string_types / text_types confusion. ([#4025][gh4025])\n* Do not list related field choices in OPTIONS requests. ([#4021][gh4021])\n* Fix typo. ([#4008][gh4008])\n* Reorder initializing the view. ([#4006][gh4006])\n* Type error in DjangoObjectPermissionsFilter on Python 3.4. ([#4005][gh4005])\n* Fixed use of deprecated Query.aggregates. ([#4003][gh4003])\n* Fix blank lines around docstrings. ([#4002][gh4002])\n* Fixed admin pagination when limit is 0. ([#3990][gh3990])\n* OrderingFilter adjustments. ([#3983][gh3983])\n* Non-required serializer related fields. ([#3976][gh3976])\n* Using safer calling way of \"@api_view\" in tutorial. ([#3971][gh3971])\n* ListSerializer doesn't handle unique_together constraints. ([#3970][gh3970])\n* Add missing migration file. ([#3968][gh3968])\n* `OrderingFilter` should call `get_serializer_class()` to determine default fields. ([#3964][gh3964])\n* Remove old Django checks from tests and compat. ([#3953][gh3953])\n* Support callable as the value of `initial` for any `serializer.Field`. ([#3943][gh3943])\n* Prevented unnecessary distinct() call in SearchFilter. ([#3938][gh3938])\n* Fix None UUID ForeignKey serialization. ([#3936][gh3936])\n* Drop EOL Django 1.7. ([#3933][gh3933])\n* Add missing space in serializer error message. ([#3926][gh3926])\n* Fixed _force_text_recursive typo. ([#3908][gh3908])\n* Attempt to address Django 2.0 deprecate warnings related to `field.rel`. ([#3906][gh3906])\n* Fix parsing multipart data using a nested serializer with list. ([#3820][gh3820])\n* Resolving APIs URL to different namespaces. ([#3816][gh3816])\n* Do not HTML-escape `help_text` in Browsable API forms. ([#3812][gh3812])\n* OPTIONS fetches and shows all possible foreign keys in choices field. ([#3751][gh3751])\n* Django 1.9 deprecation warnings ([#3729][gh3729])\n* Test case for #3598 ([#3710][gh3710])\n* Adding support for multiple values for search filter. ([#3541][gh3541])\n* Use get_serializer_class in ordering filter. ([#3487][gh3487])\n* Serializers with many=True should return empty list rather than empty dict. ([#3476][gh3476])\n* LimitOffsetPagination limit=0 fix. ([#3444][gh3444])\n* Enable Validators to defer string evaluation and handle new string format. ([#3438][gh3438])\n* Unique validator is executed and breaks if field is invalid. ([#3381][gh3381])\n* Do not ignore overridden View.get_view_name() in breadcrumbs. ([#3273][gh3273])\n* Retry form rendering when rendering with serializer fails. ([#3164][gh3164])\n* Unique constraint prevents nested serializers from updating. ([#2996][gh2996])\n* Uniqueness validators should not be run for excluded (read_only) fields. ([#2848][gh2848])\n* UniqueValidator raises exception for nested objects. ([#2403][gh2403])\n* `lookup_type` is deprecated in favor of `lookup_expr`. ([#4259][gh4259])\n---\n\n## 3.3.x series\n\n### 3.3.3\n\n**Date**: [14th March 2016][3.3.3-milestone].\n\n* Remove version string from templates. Thanks to @blag for the report and fixes. ([#3878][gh3878], [#3913][gh3913], [#3912][gh3912])\n* Fixes vertical html layout for `BooleanField`. Thanks to Mikalai Radchuk for the fix. ([#3910][gh3910])\n* Silenced deprecation warnings on Django 1.8. Thanks to Simon Charette for the fix. ([#3903][gh3903])\n* Internationalization for authtoken. Thanks to Michael Nacharov for the fix. ([#3887][gh3887], [#3968][gh3968])\n* Fix `Token` model as `abstract` when the authtoken application isn't declared. Thanks to Adam Thomas for the report. ([#3860][gh3860], [#3858][gh3858])\n* Improve Markdown version compatibility. Thanks to Michael J. Schultz for the fix. ([#3604][gh3604], [#3842][gh3842])\n* `QueryParameterVersioning` does not use `DEFAULT_VERSION` setting. Thanks to Brad Montgomery for the fix. ([#3833][gh3833])\n* Add an explicit `on_delete` on the models. Thanks to Mads Jensen for the fix. ([#3832][gh3832])\n* Fix `DateField.to_representation` to work with Python 2 unicode. Thanks to Mikalai Radchuk for the fix. ([#3819][gh3819])\n* Fixed `TimeField` not handling string times. Thanks to Areski Belaid for the fix. ([#3809][gh3809])\n* Avoid updates of `Meta.extra_kwargs`. Thanks to Kevin Massey for the report and fix. ([#3805][gh3805], [#3804][gh3804])\n* Fix nested validation error being rendered incorrectly. Thanks to Craig de Stigter for the fix. ([#3801][gh3801])\n* Document how to avoid CSRF and missing button issues with `django-crispy-forms`. Thanks to Emmanuelle Delescolle, José Padilla and Luis San Pablo for the report, analysis and fix. ([#3787][gh3787], [#3636][gh3636], [#3637][gh3637])\n* Improve Rest Framework Settings file setup time. Thanks to Miles Hutson for the report and Mads Jensen for the fix. ([#3786][gh3786], [#3815][gh3815])\n* Improve authtoken compatibility with Django 1.9. Thanks to S. Andrew Sheppard for the fix. ([#3785][gh3785])\n* Fix `Min/MaxValueValidator` transfer from a model's `DecimalField`. Thanks to Kevin Brown for the fix. ([#3774][gh3774])\n* Improve HTML title in the Browsable API. Thanks to Mike Lissner for the report and fix. ([#3769][gh3769])\n* Fix `AutoFilterSet` to inherit from `default_filter_set`. Thanks to Tom Linford for the fix. ([#3753][gh3753])\n* Fix transifex config to handle the new Chinese language codes. Thanks to @nypisces for the report and fix. ([#3739][gh3739])\n* `DateTimeField` does not handle empty values correctly. Thanks to Mick Parker for the report and fix. ([#3731][gh3731], [#3726][gh3728])\n* Raise error when setting a removed rest_framework setting. Thanks to Luis San Pablo for the fix. ([#3715][gh3715])\n* Add missing csrf_token in AdminRenderer post form. Thanks to Piotr Śniegowski for the fix. ([#3703][gh3703])\n* Refactored `_get_reverse_relationships()` to use correct `to_field`. Thanks to Benjamin Phillips for the fix. ([#3696][gh3696])\n* Document the use of `get_queryset` for `RelatedField`. Thanks to Ryan Hiebert for the fix. ([#3605][gh3605])\n* Fix empty pk detection in HyperlinkRelatedField.get_url. Thanks to @jslang for the fix ([#3962][gh3962])\n\n### 3.3.2\n\n**Date**: [14th December 2015][3.3.2-milestone].\n\n* `ListField` enforces input is a list. ([#3513][gh3513])\n* Fix regression hiding raw data form. ([#3600][gh3600], [#3578][gh3578])\n* Fix Python 3.5 compatibility. ([#3534][gh3534], [#3626][gh3626])\n* Allow setting a custom Django Paginator in `pagination.PageNumberPagination`. ([#3631][gh3631], [#3684][gh3684])\n* Fix relational fields without `to_fields` attribute. ([#3635][gh3635], [#3634][gh3634])\n* Fix `template.render` deprecation warnings for Django 1.9. ([#3654][gh3654])\n* Sort response headers in browsable API renderer. ([#3655][gh3655])\n* Use related_objects api for Django 1.9+. ([#3656][gh3656], [#3252][gh3252])\n* Add confirm modal when deleting. ([#3228][gh3228], [#3662][gh3662])\n* Reveal previously hidden AttributeErrors and TypeErrors while calling has_[object_]permissions. ([#3668][gh3668])\n* Make DRF compatible with multi template engine in Django 1.8. ([#3672][gh3672])\n* Update `NestedBoundField` to also handle empty string when rendering its form. ([#3677][gh3677])\n* Fix UUID validation to properly catch invalid input types. ([#3687][gh3687], [#3679][gh3679])\n* Fix caching issues. ([#3628][gh3628], [#3701][gh3701])\n* Fix Admin and API browser for views without a filter_class. ([#3705][gh3705], [#3596][gh3596], [#3597][gh3597])\n* Add app_name to rest_framework.urls. ([#3714][gh3714])\n* Improve authtoken's views to support url versioning. ([#3718][gh3718], [#3723][gh3723])\n\n### 3.3.1\n\n**Date**: [4th November 2015][3.3.1-milestone].\n\n* Resolve parsing bug when accessing `request.POST` ([#3592][gh3592])\n* Correctly deal with `to_field` referring to primary key. ([#3593][gh3593])\n* Allow filter HTML to render when no `filter_class` is defined. ([#3560][gh3560])\n* Fix admin rendering issues. ([#3564][gh3564], [#3556][gh3556])\n* Fix issue with DecimalValidator. ([#3568][gh3568])\n\n### 3.3.0\n\n**Date**: [28th October 2015][3.3.0-milestone].\n\n* HTML controls for filters. ([#3315][gh3315])\n* Forms API. ([#3475][gh3475])\n* AJAX browsable API. ([#3410][gh3410])\n* Added JSONField. ([#3454][gh3454])\n* Correctly map `to_field` when creating `ModelSerializer` relational fields. ([#3526][gh3526])\n* Include keyword arguments when mapping `FilePathField` to a serializer field. ([#3536][gh3536])\n* Map appropriate model `error_messages` on `ModelSerializer` uniqueness constraints. ([#3435][gh3435])\n* Include `max_length` constraint for `ModelSerializer` fields mapped from TextField. ([#3509][gh3509])\n* Added support for Django 1.9. ([#3450][gh3450], [#3525][gh3525])\n* Removed support for Django 1.5 & 1.6. ([#3421][gh3421], [#3429][gh3429])\n* Removed 'south' migrations. ([#3495][gh3495])\n\n---\n\n## 3.2.x series\n\n### 3.2.5\n\n**Date**: [27th October 2015][3.2.5-milestone].\n\n* Escape `username` in optional logout tag. ([#3550][gh3550])\n\n### 3.2.4\n\n**Date**: [21th September 2015][3.2.4-milestone].\n\n* Don't error on missing `ViewSet.search_fields` attribute. ([#3324][gh3324], [#3323][gh3323])\n* Fix `allow_empty` not working on serializers with `many=True`. ([#3361][gh3361], [#3364][gh3364])\n* Let `DurationField` accepts integers. ([#3359][gh3359])\n* Multi-level dictionaries not supported in multipart requests. ([#3314][gh3314])\n* Fix `ListField` truncation on HTTP PATCH ([#3415][gh3415], [#2761][gh2761])\n\n### 3.2.3\n\n**Date**: [24th August 2015][3.2.3-milestone].\n\n* Added `html_cutoff` and `html_cutoff_text` for limiting select dropdowns. ([#3313][gh3313])\n* Added regex style to `SearchFilter`. ([#3316][gh3316])\n* Resolve issues with setting blank HTML fields. ([#3318][gh3318]) ([#3321][gh3321])\n* Correctly display existing 'select multiple' values in browsable API forms. ([#3290][gh3290])\n* Resolve duplicated validation message for `IPAddressField`. ([#3249[gh3249]) ([#3250][gh3250])\n* Fix to ensure admin renderer continues to work when pagination is disabled. ([#3275][gh3275])\n* Resolve error with `LimitOffsetPagination` when count=0, offset=0. ([#3303][gh3303])\n\n### 3.2.2\n\n**Date**: [13th August 2015][3.2.2-milestone].\n\n* Add `display_value()` method for use when displaying relational field select inputs. ([#3254][gh3254])\n* Fix issue with `BooleanField` checkboxes incorrectly displaying as checked. ([#3258][gh3258])\n* Ensure empty checkboxes properly set `BooleanField` to `False` in all cases. ([#2776][gh2776])\n* Allow `WSGIRequest.FILES` property without raising incorrect deprecated error. ([#3261][gh3261])\n* Resolve issue with rendering nested serializers in forms. ([#3260][gh3260])\n* Raise an error if user accidentally pass a serializer instance to a response, rather than data. ([#3241][gh3241])\n\n### 3.2.1\n\n**Date**: [7th August 2015][3.2.1-milestone].\n\n* Fix for relational select widgets rendering without any choices. ([#3237][gh3237])\n* Fix for `1`, `0` rendering as `true`, `false` in the admin interface. [#3227][gh3227])\n* Fix for ListFields with single value in HTML form input. ([#3238][gh3238])\n* Allow `request.FILES` for compat with Django's `HTTPRequest` class. ([#3239][gh3239])\n\n### 3.2.0\n\n**Date**: [6th August 2015][3.2.0-milestone].\n\n* Add `AdminRenderer`. ([#2926][gh2926])\n* Add `FilePathField`. ([#1854][gh1854])\n* Add `allow_empty` to `ListField`. ([#2250][gh2250])\n* Support django-guardian 1.3. ([#3165][gh3165])\n* Support grouped choices. ([#3225][gh3225])\n* Support error forms in browsable API. ([#3024][gh3024])\n* Allow permission classes to customize the error message. ([#2539][gh2539])\n* Support `source=<method>` on hyperlinked fields. ([#2690][gh2690])\n* `ListField(allow_null=True)` now allows null as the list value, not null items in the list. ([#2766][gh2766])\n* `ManyToMany()` maps to `allow_empty=False`, `ManyToMany(blank=True)` maps to `allow_empty=True`. ([#2804][gh2804])\n* Support custom serialization styles for primary key fields. ([#2789][gh2789])\n* `OPTIONS` requests support nested representations. ([#2915][gh2915])\n* Set `view.action == \"metadata\"` for viewsets with `OPTIONS` requests. ([#3115][gh3115])\n* Support `allow_blank` on `UUIDField`. ([#3130][gh#3130])\n* Do not display view docstrings with 401 or 403 response codes. ([#3216][gh3216])\n* Resolve Django 1.8 deprecation warnings. ([#2886][gh2886])\n* Fix for `DecimalField` validation. ([#3139][gh3139])\n* Fix behavior of `allow_blank=False` when used with `trim_whitespace=True`. ([#2712][gh2712])\n* Fix issue with some field combinations incorrectly mapping to an invalid `allow_blank` argument. ([#3011][gh3011])\n* Fix for output representations with prefetches and modified querysets. ([#2704][gh2704], [#2727][gh2727])\n* Fix assertion error when CursorPagination is provided with certain invalid query parameters. (#2920)[gh2920].\n* Fix `UnicodeDecodeError` when invalid characters included in header with `TokenAuthentication`. ([#2928][gh2928])\n* Fix transaction rollbacks with `@non_atomic_requests` decorator. ([#3016][gh3016])\n* Fix duplicate results issue with Oracle databases using `SearchFilter`. ([#2935][gh2935])\n* Fix checkbox alignment and rendering in browsable API forms. ([#2783][gh2783])\n* Fix for unsaved file objects which should use `\"url\": null` in the representation. ([#2759][gh2759])\n* Fix field value rendering in browsable API. ([#2416][gh2416])\n* Fix `HStoreField` to include `allow_blank=True` in `DictField` mapping. ([#2659][gh2659])\n* Numerous other cleanups, improvements to error messaging, private API & minor fixes.\n\n---\n\n## 3.1.x series\n\n### 3.1.3\n\n**Date**: [4th June 2015][3.1.3-milestone].\n\n* Add `DurationField`. ([#2481][gh2481], [#2989][gh2989])\n* Add `format` argument to `UUIDField`. ([#2788][gh2788], [#3000][gh3000])\n* `MultipleChoiceField` empties incorrectly on a partial update using multipart/form-data ([#2993][gh2993], [#2894][gh2894])\n* Fix a bug in options related to read-only `RelatedField`. ([#2981][gh2981], [#2811][gh2811])\n* Fix nested serializers with `unique_together` relations. ([#2975][gh2975])\n* Allow unexpected values for `ChoiceField`/`MultipleChoiceField` representations. ([#2839][gh2839], [#2940][gh2940])\n* Rollback the transaction on error if `ATOMIC_REQUESTS` is set. ([#2887][gh2887], [#2034][gh2034])\n* Set the action on a view when override_method regardless of its None-ness. ([#2933][gh2933])\n* `DecimalField` accepts `2E+2` as 200 and validates decimal place correctly. ([#2948][gh2948], [#2947][gh2947])\n* Support basic authentication with custom `UserModel` that change `username`. ([#2952][gh2952])\n* `IPAddressField` improvements. ([#2747][gh2747], [#2618][gh2618], [#3008][gh3008])\n* Improve `DecimalField` for easier subclassing. ([#2695][gh2695])\n\n\n### 3.1.2\n\n**Date**: [13rd May 2015][3.1.2-milestone].\n\n* `DateField.to_representation` can handle str and empty values. ([#2656][gh2656], [#2687][gh2687], [#2869][gh2869])\n* Use default reason phrases from HTTP standard. ([#2764][gh2764], [#2763][gh2763])\n* Raise error when `ModelSerializer` used with abstract model. ([#2757][gh2757], [#2630][gh2630])\n* Handle reversal of non-API view_name in `HyperLinkedRelatedField` ([#2724][gh2724], [#2711][gh2711])\n* Don't require pk strictly for related fields. ([#2745][gh2745], [#2754][gh2754])\n* Metadata detects null boolean field type. ([#2762][gh2762])\n* Proper handling of depth in nested serializers. ([#2798][gh2798])\n* Display viewset without paginator. ([#2807][gh2807])\n* Don't check for deprecated `.model` attribute in permissions ([#2818][gh2818])\n* Restrict integer field to integers and strings. ([#2835][gh2835], [#2836][gh2836])\n* Improve `IntegerField` to use compiled decimal regex. ([#2853][gh2853])\n* Prevent empty `queryset` to raise AssertionError. ([#2862][gh2862])\n* `DjangoModelPermissions` rely on `get_queryset`. ([#2863][gh2863])\n* Check `AcceptHeaderVersioning` with content negotiation in place. ([#2868][gh2868])\n* Allow `DjangoObjectPermissions` to use views that define `get_queryset`. ([#2905][gh2905])\n\n\n### 3.1.1\n\n**Date**: [23rd March 2015][3.1.1-milestone].\n\n* **Security fix**: Escape tab switching cookie name in browsable API.\n* Display input forms in browsable API if `serializer_class` is used, even when `get_serializer` method does not exist on the view. ([#2743][gh2743])\n* Use a password input for the AuthTokenSerializer. ([#2741][gh2741])\n* Fix missing anchor closing tag after next button. ([#2691][gh2691])\n* Fix `lookup_url_kwarg` handling in viewsets. ([#2685][gh2685], [#2591][gh2591])\n* Fix problem with importing `rest_framework.views` in `apps.py` ([#2678][gh2678])\n* LimitOffsetPagination raises `TypeError` if PAGE_SIZE not set ([#2667][gh2667], [#2700][gh2700])\n* German translation for `min_value` field error message references `max_value`. ([#2645][gh2645])\n* Remove `MergeDict`. ([#2640][gh2640])\n* Support serializing unsaved models with related fields. ([#2637][gh2637], [#2641][gh2641])\n* Allow blank/null on radio.html choices. ([#2631][gh2631])\n\n\n### 3.1.0\n\n**Date**: [5th March 2015][3.1.0-milestone].\n\nFor full details see the [3.1 release announcement](3.1-announcement.md).\n\n---\n\n## 3.0.x series\n\n### 3.0.5\n\n**Date**: [10th February 2015][3.0.5-milestone].\n\n* Fix a bug where `_closable_objects` breaks pickling. ([#1850][gh1850], [#2492][gh2492])\n* Allow non-standard `User` models with `Throttling`. ([#2524][gh2524])\n* Support custom `User.db_table` in TokenAuthentication migration. ([#2479][gh2479])\n* Fix misleading `AttributeError` tracebacks on `Request` objects. ([#2530][gh2530], [#2108][gh2108])\n* `ManyRelatedField.get_value` clearing field on partial update. ([#2475][gh2475])\n* Removed '.model' shortcut from code. ([#2486][gh2486])\n* Fix `detail_route` and `list_route` mutable argument. ([#2518][gh2518])\n* Prefetching the user object when getting the token in `TokenAuthentication`. ([#2519][gh2519])\n\n### 3.0.4\n\n**Date**: [28th January 2015][3.0.4-milestone].\n\n* Django 1.8a1 support. ([#2425][gh2425], [#2446][gh2446], [#2441][gh2441])\n* Add `DictField` and support Django 1.8 `HStoreField`. ([#2451][gh2451], [#2106][gh2106])\n* Add `UUIDField` and support Django 1.8 `UUIDField`. ([#2448][gh2448], [#2433][gh2433], [#2432][gh2432])\n* `BaseRenderer.render` now raises `NotImplementedError`. ([#2434][gh2434])\n* Fix timedelta JSON serialization on Python 2.6. ([#2430][gh2430])\n* `ResultDict` and `ResultList` now appear as standard dict/list. ([#2421][gh2421])\n* Fix visible `HiddenField` in the HTML form of the web browsable API page. ([#2410][gh2410])\n* Use `OrderedDict` for `RelatedField.choices`. ([#2408][gh2408])\n* Fix ident format when using `HTTP_X_FORWARDED_FOR`. ([#2401][gh2401])\n* Fix invalid key with memcached while using throttling. ([#2400][gh2400])\n* Fix `FileUploadParser` with version 3.x. ([#2399][gh2399])\n* Fix the serializer inheritance. ([#2388][gh2388])\n* Fix caching issues with `ReturnDict`. ([#2360][gh2360])\n\n### 3.0.3\n\n**Date**: [8th January 2015][3.0.3-milestone].\n\n* Fix `MinValueValidator` on `models.DateField`. ([#2369][gh2369])\n* Fix serializer missing context when pagination is used. ([#2355][gh2355])\n* Namespaced router URLs are now supported by the `DefaultRouter`. ([#2351][gh2351])\n* `required=False` allows omission of value for output. ([#2342][gh2342])\n* Use textarea input for `models.TextField`. ([#2340][gh2340])\n* Use custom `ListSerializer` for pagination if required. ([#2331][gh2331], [#2327][gh2327])\n* Better behavior with null and '' for blank HTML fields. ([#2330][gh2330])\n* Ensure fields in `exclude` are model fields. ([#2319][gh2319])\n* Fix `IntegerField` and `max_length` argument incompatibility. ([#2317][gh2317])\n* Fix the YAML encoder for 3.0 serializers. ([#2315][gh2315], [#2283][gh2283])\n* Fix the behavior of empty HTML fields. ([#2311][gh2311], [#1101][gh1101])\n* Fix Metaclass attribute depth ignoring fields attribute. ([#2287][gh2287])\n* Fix `format_suffix_patterns` to work with Django's `i18n_patterns`. ([#2278][gh2278])\n* Ability to customize router URLs for custom actions, using `url_path`. ([#2010][gh2010])\n* Don't install Django REST Framework as egg. ([#2386][gh2386])\n\n### 3.0.2\n\n**Date**: [17th December 2014][3.0.2-milestone].\n\n* Ensure `request.user` is made available to response middleware. ([#2155][gh2155])\n* `Client.logout()` also cancels any existing `force_authenticate`. ([#2218][gh2218], [#2259][gh2259])\n* Extra assertions and better checks to preventing incorrect serializer API use. ([#2228][gh2228], [#2234][gh2234], [#2262][gh2262], [#2263][gh2263], [#2266][gh2266], [#2267][gh2267], [#2289][gh2289], [#2291][gh2291])\n* Fixed `min_length` message for `CharField`. ([#2255][gh2255])\n* Fix `UnicodeDecodeError`, which can occur on serializer `repr`.  ([#2270][gh2270], [#2279][gh2279])\n* Fix empty HTML values when a default is provided. ([#2280][gh2280], [#2294][gh2294])\n* Fix `SlugRelatedField` raising `UnicodeEncodeError` when used as a multiple choice input. ([#2290][gh2290])\n\n### 3.0.1\n\n**Date**: [11th December 2014][3.0.1-milestone].\n\n* More helpful error message when the default Serializer `create()` fails. ([#2013][gh2013])\n* Raise error when attempting to save serializer if data is not valid. ([#2098][gh2098])\n* Fix `FileUploadParser` breaks with empty file names and multiple upload handlers. ([#2109][gh2109])\n* Improve `BindingDict` to support standard dict-functions. ([#2135][gh2135], [#2163][gh2163])\n* Add `validate()` to `ListSerializer`. ([#2168][gh2168], [#2225][gh2225], [#2232][gh2232])\n* Fix JSONP renderer failing to escape some characters. ([#2169][gh2169], [#2195][gh2195])\n* Add missing default style for `FileField`. ([#2172][gh2172])\n* Actions are required when calling `ViewSet.as_view()`. ([#2175][gh2175])\n* Add `allow_blank` to `ChoiceField`. ([#2184][gh2184], [#2239][gh2239])\n* Cosmetic fixes in the HTML renderer. ([#2187][gh2187])\n* Raise error if `fields` on serializer is not a list of strings. ([#2193][gh2193], [#2213][gh2213])\n* Improve checks for nested creates and updates. ([#2194][gh2194], [#2196][gh2196])\n* `validated_attrs` argument renamed to `validated_data` in `Serializer` `create()`/`update()`. ([#2197][gh2197])\n* Remove deprecated code to reflect the dropped Django versions. ([#2200][gh2200])\n* Better serializer errors for nested writes. ([#2202][gh2202], [#2215][gh2215])\n* Fix pagination and custom permissions incompatibility. ([#2205][gh2205])\n* Raise error if `fields` on serializer is not a list of strings. ([#2213][gh2213])\n* Add missing translation markers for relational fields. ([#2231][gh2231])\n* Improve field lookup behavior for dicts/mappings. ([#2244][gh2244], [#2243][gh2243])\n* Optimized hyperlinked PK. ([#2242][gh2242])\n\n### 3.0.0\n\n**Date**: 1st December 2014\n\nFor full details see the [3.0 release announcement](3.0-announcement.md).\n\n---\n\nFor older release notes, [please see the version 2.x documentation][old-release-notes].\n\n[cite]: http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ar01s04.html\n[deprecation-policy]: #deprecation-policy\n[django-deprecation-policy]: https://docs.djangoproject.com/en/stable/internals/release-process/#internal-release-deprecation-policy\n[old-release-notes]: https://github.com/encode/django-rest-framework/blob/version-2.4.x/docs/topics/release-notes.md\n[3.6-release]: 3.6-announcement.md\n\n[3.0.1-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.0.1+Release%22\n[3.0.2-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.0.2+Release%22\n[3.0.3-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.0.3+Release%22\n[3.0.4-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.0.4+Release%22\n[3.0.5-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.0.5+Release%22\n[3.1.0-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.1.0+Release%22\n[3.1.1-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.1.1+Release%22\n[3.1.2-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.1.2+Release%22\n[3.1.3-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.1.3+Release%22\n[3.2.0-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.2.0+Release%22\n[3.2.1-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.2.1+Release%22\n[3.2.2-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.2.2+Release%22\n[3.2.3-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.2.3+Release%22\n[3.2.4-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.2.4+Release%22\n[3.2.5-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.2.5+Release%22\n[3.3.0-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.3.0+Release%22\n[3.3.1-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.3.1+Release%22\n[3.3.2-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.3.2+Release%22\n[3.3.3-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.3.3+Release%22\n[3.4.0-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.4.0+Release%22\n[3.4.1-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.4.1+Release%22\n[3.4.2-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.4.2+Release%22\n[3.4.3-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.4.3+Release%22\n[3.4.4-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.4.4+Release%22\n[3.4.5-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.4.5+Release%22\n[3.4.6-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.4.6+Release%22\n[3.4.7-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.4.7+Release%22\n[3.5.0-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.5.0+Release%22\n[3.5.1-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.5.1+Release%22\n[3.5.2-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.5.2+Release%22\n[3.5.3-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.5.3+Release%22\n[3.5.4-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.5.4+Release%22\n[3.6.0-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.6.0+Release%22\n[3.6.1-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.6.1+Release%22\n[3.6.2-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.6.2+Release%22\n[3.6.3-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.6.3+Release%22\n[3.6.4-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.6.4+Release%22\n[3.7.0-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.7.0+Release%22\n[3.7.1-milestone]: https://github.com/encode/django-rest-framework/milestone/58?closed=1\n[3.7.2-milestone]: https://github.com/encode/django-rest-framework/milestone/59?closed=1\n[3.7.3-milestone]: https://github.com/encode/django-rest-framework/milestone/60?closed=1\n[3.7.4-milestone]: https://github.com/encode/django-rest-framework/milestone/62?closed=1\n[3.7.5-milestone]: https://github.com/encode/django-rest-framework/milestone/63?closed=1\n[3.7.6-milestone]: https://github.com/encode/django-rest-framework/milestone/64?closed=1\n[3.7.7-milestone]: https://github.com/encode/django-rest-framework/milestone/65?closed=1\n[3.8.0-milestone]: https://github.com/encode/django-rest-framework/milestone/61?closed=1\n[3.8.1-milestone]: https://github.com/encode/django-rest-framework/milestone/67?closed=1\n[3.8.2-milestone]: https://github.com/encode/django-rest-framework/milestone/68?closed=1\n[3.9.0-milestone]: https://github.com/encode/django-rest-framework/milestone/66?closed=1\n[3.9.1-milestone]: https://github.com/encode/django-rest-framework/milestone/70?closed=1\n[3.9.2-milestone]: https://github.com/encode/django-rest-framework/milestone/71?closed=1\n[3.10.0-milestone]: https://github.com/encode/django-rest-framework/milestone/69?closed=1\n\n<!-- 3.0.1 -->\n[gh2013]: https://github.com/encode/django-rest-framework/issues/2013\n[gh2098]: https://github.com/encode/django-rest-framework/issues/2098\n[gh2109]: https://github.com/encode/django-rest-framework/issues/2109\n[gh2135]: https://github.com/encode/django-rest-framework/issues/2135\n[gh2163]: https://github.com/encode/django-rest-framework/issues/2163\n[gh2168]: https://github.com/encode/django-rest-framework/issues/2168\n[gh2169]: https://github.com/encode/django-rest-framework/issues/2169\n[gh2172]: https://github.com/encode/django-rest-framework/issues/2172\n[gh2175]: https://github.com/encode/django-rest-framework/issues/2175\n[gh2184]: https://github.com/encode/django-rest-framework/issues/2184\n[gh2187]: https://github.com/encode/django-rest-framework/issues/2187\n[gh2193]: https://github.com/encode/django-rest-framework/issues/2193\n[gh2194]: https://github.com/encode/django-rest-framework/issues/2194\n[gh2195]: https://github.com/encode/django-rest-framework/issues/2195\n[gh2196]: https://github.com/encode/django-rest-framework/issues/2196\n[gh2197]: https://github.com/encode/django-rest-framework/issues/2197\n[gh2200]: https://github.com/encode/django-rest-framework/issues/2200\n[gh2202]: https://github.com/encode/django-rest-framework/issues/2202\n[gh2205]: https://github.com/encode/django-rest-framework/issues/2205\n[gh2213]: https://github.com/encode/django-rest-framework/issues/2213\n[gh2213]: https://github.com/encode/django-rest-framework/issues/2213\n[gh2215]: https://github.com/encode/django-rest-framework/issues/2215\n[gh2225]: https://github.com/encode/django-rest-framework/issues/2225\n[gh2231]: https://github.com/encode/django-rest-framework/issues/2231\n[gh2232]: https://github.com/encode/django-rest-framework/issues/2232\n[gh2239]: https://github.com/encode/django-rest-framework/issues/2239\n[gh2242]: https://github.com/encode/django-rest-framework/issues/2242\n[gh2243]: https://github.com/encode/django-rest-framework/issues/2243\n[gh2244]: https://github.com/encode/django-rest-framework/issues/2244\n<!-- 3.0.2 -->\n[gh2155]: https://github.com/encode/django-rest-framework/issues/2155\n[gh2218]: https://github.com/encode/django-rest-framework/issues/2218\n[gh2228]: https://github.com/encode/django-rest-framework/issues/2228\n[gh2234]: https://github.com/encode/django-rest-framework/issues/2234\n[gh2255]: https://github.com/encode/django-rest-framework/issues/2255\n[gh2259]: https://github.com/encode/django-rest-framework/issues/2259\n[gh2262]: https://github.com/encode/django-rest-framework/issues/2262\n[gh2263]: https://github.com/encode/django-rest-framework/issues/2263\n[gh2266]: https://github.com/encode/django-rest-framework/issues/2266\n[gh2267]: https://github.com/encode/django-rest-framework/issues/2267\n[gh2270]: https://github.com/encode/django-rest-framework/issues/2270\n[gh2279]: https://github.com/encode/django-rest-framework/issues/2279\n[gh2280]: https://github.com/encode/django-rest-framework/issues/2280\n[gh2289]: https://github.com/encode/django-rest-framework/issues/2289\n[gh2290]: https://github.com/encode/django-rest-framework/issues/2290\n[gh2291]: https://github.com/encode/django-rest-framework/issues/2291\n[gh2294]: https://github.com/encode/django-rest-framework/issues/2294\n<!-- 3.0.3 -->\n[gh1101]: https://github.com/encode/django-rest-framework/issues/1101\n[gh2010]: https://github.com/encode/django-rest-framework/issues/2010\n[gh2278]: https://github.com/encode/django-rest-framework/issues/2278\n[gh2283]: https://github.com/encode/django-rest-framework/issues/2283\n[gh2287]: https://github.com/encode/django-rest-framework/issues/2287\n[gh2311]: https://github.com/encode/django-rest-framework/issues/2311\n[gh2315]: https://github.com/encode/django-rest-framework/issues/2315\n[gh2317]: https://github.com/encode/django-rest-framework/issues/2317\n[gh2319]: https://github.com/encode/django-rest-framework/issues/2319\n[gh2327]: https://github.com/encode/django-rest-framework/issues/2327\n[gh2330]: https://github.com/encode/django-rest-framework/issues/2330\n[gh2331]: https://github.com/encode/django-rest-framework/issues/2331\n[gh2340]: https://github.com/encode/django-rest-framework/issues/2340\n[gh2342]: https://github.com/encode/django-rest-framework/issues/2342\n[gh2351]: https://github.com/encode/django-rest-framework/issues/2351\n[gh2355]: https://github.com/encode/django-rest-framework/issues/2355\n[gh2369]: https://github.com/encode/django-rest-framework/issues/2369\n[gh2386]: https://github.com/encode/django-rest-framework/issues/2386\n<!-- 3.0.4 -->\n[gh2425]: https://github.com/encode/django-rest-framework/issues/2425\n[gh2446]: https://github.com/encode/django-rest-framework/issues/2446\n[gh2441]: https://github.com/encode/django-rest-framework/issues/2441\n[gh2451]: https://github.com/encode/django-rest-framework/issues/2451\n[gh2106]: https://github.com/encode/django-rest-framework/issues/2106\n[gh2448]: https://github.com/encode/django-rest-framework/issues/2448\n[gh2433]: https://github.com/encode/django-rest-framework/issues/2433\n[gh2432]: https://github.com/encode/django-rest-framework/issues/2432\n[gh2434]: https://github.com/encode/django-rest-framework/issues/2434\n[gh2430]: https://github.com/encode/django-rest-framework/issues/2430\n[gh2421]: https://github.com/encode/django-rest-framework/issues/2421\n[gh2410]: https://github.com/encode/django-rest-framework/issues/2410\n[gh2408]: https://github.com/encode/django-rest-framework/issues/2408\n[gh2401]: https://github.com/encode/django-rest-framework/issues/2401\n[gh2400]: https://github.com/encode/django-rest-framework/issues/2400\n[gh2399]: https://github.com/encode/django-rest-framework/issues/2399\n[gh2388]: https://github.com/encode/django-rest-framework/issues/2388\n[gh2360]: https://github.com/encode/django-rest-framework/issues/2360\n<!-- 3.0.5 -->\n[gh1850]: https://github.com/encode/django-rest-framework/issues/1850\n[gh2108]: https://github.com/encode/django-rest-framework/issues/2108\n[gh2475]: https://github.com/encode/django-rest-framework/issues/2475\n[gh2479]: https://github.com/encode/django-rest-framework/issues/2479\n[gh2486]: https://github.com/encode/django-rest-framework/issues/2486\n[gh2492]: https://github.com/encode/django-rest-framework/issues/2492\n[gh2518]: https://github.com/encode/django-rest-framework/issues/2518\n[gh2519]: https://github.com/encode/django-rest-framework/issues/2519\n[gh2524]: https://github.com/encode/django-rest-framework/issues/2524\n[gh2530]: https://github.com/encode/django-rest-framework/issues/2530\n<!-- 3.1.1 -->\n[gh2691]: https://github.com/encode/django-rest-framework/issues/2691\n[gh2685]: https://github.com/encode/django-rest-framework/issues/2685\n[gh2591]: https://github.com/encode/django-rest-framework/issues/2591\n[gh2678]: https://github.com/encode/django-rest-framework/issues/2678\n[gh2667]: https://github.com/encode/django-rest-framework/issues/2667\n[gh2700]: https://github.com/encode/django-rest-framework/issues/2700\n[gh2645]: https://github.com/encode/django-rest-framework/issues/2645\n[gh2640]: https://github.com/encode/django-rest-framework/issues/2640\n[gh2637]: https://github.com/encode/django-rest-framework/issues/2637\n[gh2641]: https://github.com/encode/django-rest-framework/issues/2641\n[gh2631]: https://github.com/encode/django-rest-framework/issues/2631\n[gh2741]: https://github.com/encode/django-rest-framework/issues/2641\n[gh2743]: https://github.com/encode/django-rest-framework/issues/2643\n<!-- 3.1.2 -->\n[gh2656]: https://github.com/encode/django-rest-framework/issues/2656\n[gh2687]: https://github.com/encode/django-rest-framework/issues/2687\n[gh2869]: https://github.com/encode/django-rest-framework/issues/2869\n[gh2764]: https://github.com/encode/django-rest-framework/issues/2764\n[gh2763]: https://github.com/encode/django-rest-framework/issues/2763\n[gh2757]: https://github.com/encode/django-rest-framework/issues/2757\n[gh2630]: https://github.com/encode/django-rest-framework/issues/2630\n[gh2724]: https://github.com/encode/django-rest-framework/issues/2724\n[gh2711]: https://github.com/encode/django-rest-framework/issues/2711\n[gh2745]: https://github.com/encode/django-rest-framework/issues/2745\n[gh2754]: https://github.com/encode/django-rest-framework/issues/2754\n[gh2762]: https://github.com/encode/django-rest-framework/issues/2762\n[gh2798]: https://github.com/encode/django-rest-framework/issues/2798\n[gh2807]: https://github.com/encode/django-rest-framework/issues/2807\n[gh2818]: https://github.com/encode/django-rest-framework/issues/2818\n[gh2835]: https://github.com/encode/django-rest-framework/issues/2835\n[gh2836]: https://github.com/encode/django-rest-framework/issues/2836\n[gh2853]: https://github.com/encode/django-rest-framework/issues/2853\n[gh2862]: https://github.com/encode/django-rest-framework/issues/2862\n[gh2863]: https://github.com/encode/django-rest-framework/issues/2863\n[gh2868]: https://github.com/encode/django-rest-framework/issues/2868\n[gh2905]: https://github.com/encode/django-rest-framework/issues/2905\n<!-- 3.1.3 -->\n[gh2481]: https://github.com/encode/django-rest-framework/issues/2481\n[gh2989]: https://github.com/encode/django-rest-framework/issues/2989\n[gh2788]: https://github.com/encode/django-rest-framework/issues/2788\n[gh3000]: https://github.com/encode/django-rest-framework/issues/3000\n[gh2993]: https://github.com/encode/django-rest-framework/issues/2993\n[gh2894]: https://github.com/encode/django-rest-framework/issues/2894\n[gh2981]: https://github.com/encode/django-rest-framework/issues/2981\n[gh2811]: https://github.com/encode/django-rest-framework/issues/2811\n[gh2975]: https://github.com/encode/django-rest-framework/issues/2975\n[gh2839]: https://github.com/encode/django-rest-framework/issues/2839\n[gh2940]: https://github.com/encode/django-rest-framework/issues/2940\n[gh2887]: https://github.com/encode/django-rest-framework/issues/2887\n[gh2034]: https://github.com/encode/django-rest-framework/issues/2034\n[gh2933]: https://github.com/encode/django-rest-framework/issues/2933\n[gh2948]: https://github.com/encode/django-rest-framework/issues/2948\n[gh2947]: https://github.com/encode/django-rest-framework/issues/2947\n[gh2952]: https://github.com/encode/django-rest-framework/issues/2952\n[gh2747]: https://github.com/encode/django-rest-framework/issues/2747\n[gh2618]: https://github.com/encode/django-rest-framework/issues/2618\n[gh3008]: https://github.com/encode/django-rest-framework/issues/3008\n[gh2695]: https://github.com/encode/django-rest-framework/issues/2695\n\n<!-- 3.2.0 -->\n[gh1854]: https://github.com/encode/django-rest-framework/issues/1854\n[gh2250]: https://github.com/encode/django-rest-framework/issues/2250\n[gh2416]: https://github.com/encode/django-rest-framework/issues/2416\n[gh2539]: https://github.com/encode/django-rest-framework/issues/2539\n[gh2659]: https://github.com/encode/django-rest-framework/issues/2659\n[gh2690]: https://github.com/encode/django-rest-framework/issues/2690\n[gh2704]: https://github.com/encode/django-rest-framework/issues/2704\n[gh2712]: https://github.com/encode/django-rest-framework/issues/2712\n[gh2727]: https://github.com/encode/django-rest-framework/issues/2727\n[gh2759]: https://github.com/encode/django-rest-framework/issues/2759\n[gh2766]: https://github.com/encode/django-rest-framework/issues/2766\n[gh2783]: https://github.com/encode/django-rest-framework/issues/2783\n[gh2789]: https://github.com/encode/django-rest-framework/issues/2789\n[gh2804]: https://github.com/encode/django-rest-framework/issues/2804\n[gh2886]: https://github.com/encode/django-rest-framework/issues/2886\n[gh2915]: https://github.com/encode/django-rest-framework/issues/2915\n[gh2920]: https://github.com/encode/django-rest-framework/issues/2920\n[gh2926]: https://github.com/encode/django-rest-framework/issues/2926\n[gh2928]: https://github.com/encode/django-rest-framework/issues/2928\n[gh2935]: https://github.com/encode/django-rest-framework/issues/2935\n[gh3011]: https://github.com/encode/django-rest-framework/issues/3011\n[gh3016]: https://github.com/encode/django-rest-framework/issues/3016\n[gh3024]: https://github.com/encode/django-rest-framework/issues/3024\n[gh3115]: https://github.com/encode/django-rest-framework/issues/3115\n[gh3139]: https://github.com/encode/django-rest-framework/issues/3139\n[gh3165]: https://github.com/encode/django-rest-framework/issues/3165\n[gh3216]: https://github.com/encode/django-rest-framework/issues/3216\n[gh3225]: https://github.com/encode/django-rest-framework/issues/3225\n\n<!-- 3.2.1 -->\n[gh3237]: https://github.com/encode/django-rest-framework/issues/3237\n[gh3227]: https://github.com/encode/django-rest-framework/issues/3227\n[gh3238]: https://github.com/encode/django-rest-framework/issues/3238\n[gh3239]: https://github.com/encode/django-rest-framework/issues/3239\n\n<!-- 3.2.2 -->\n[gh3254]: https://github.com/encode/django-rest-framework/issues/3254\n[gh3258]: https://github.com/encode/django-rest-framework/issues/3258\n[gh2776]: https://github.com/encode/django-rest-framework/issues/2776\n[gh3261]: https://github.com/encode/django-rest-framework/issues/3261\n[gh3260]: https://github.com/encode/django-rest-framework/issues/3260\n[gh3241]: https://github.com/encode/django-rest-framework/issues/3241\n\n<!-- 3.2.3 -->\n[gh3249]: https://github.com/encode/django-rest-framework/issues/3249\n[gh3250]: https://github.com/encode/django-rest-framework/issues/3250\n[gh3275]: https://github.com/encode/django-rest-framework/issues/3275\n[gh3290]: https://github.com/encode/django-rest-framework/issues/3290\n[gh3303]: https://github.com/encode/django-rest-framework/issues/3303\n[gh3313]: https://github.com/encode/django-rest-framework/issues/3313\n[gh3316]: https://github.com/encode/django-rest-framework/issues/3316\n[gh3318]: https://github.com/encode/django-rest-framework/issues/3318\n[gh3321]: https://github.com/encode/django-rest-framework/issues/3321\n\n<!-- 3.2.4 -->\n[gh2761]: https://github.com/encode/django-rest-framework/issues/2761\n[gh3314]: https://github.com/encode/django-rest-framework/issues/3314\n[gh3323]: https://github.com/encode/django-rest-framework/issues/3323\n[gh3324]: https://github.com/encode/django-rest-framework/issues/3324\n[gh3359]: https://github.com/encode/django-rest-framework/issues/3359\n[gh3361]: https://github.com/encode/django-rest-framework/issues/3361\n[gh3364]: https://github.com/encode/django-rest-framework/issues/3364\n[gh3415]: https://github.com/encode/django-rest-framework/issues/3415\n\n<!-- 3.2.5 -->\n[gh3550]:https://github.com/encode/django-rest-framework/issues/3550\n\n<!-- 3.3.0 -->\n[gh3315]: https://github.com/encode/django-rest-framework/issues/3315\n[gh3410]: https://github.com/encode/django-rest-framework/issues/3410\n[gh3435]: https://github.com/encode/django-rest-framework/issues/3435\n[gh3450]: https://github.com/encode/django-rest-framework/issues/3450\n[gh3454]: https://github.com/encode/django-rest-framework/issues/3454\n[gh3475]: https://github.com/encode/django-rest-framework/issues/3475\n[gh3495]: https://github.com/encode/django-rest-framework/issues/3495\n[gh3509]: https://github.com/encode/django-rest-framework/issues/3509\n[gh3421]: https://github.com/encode/django-rest-framework/issues/3421\n[gh3525]: https://github.com/encode/django-rest-framework/issues/3525\n[gh3526]: https://github.com/encode/django-rest-framework/issues/3526\n[gh3429]: https://github.com/encode/django-rest-framework/issues/3429\n[gh3536]: https://github.com/encode/django-rest-framework/issues/3536\n\n<!-- 3.3.1 -->\n[gh3556]: https://github.com/encode/django-rest-framework/issues/3556\n[gh3560]: https://github.com/encode/django-rest-framework/issues/3560\n[gh3564]: https://github.com/encode/django-rest-framework/issues/3564\n[gh3568]: https://github.com/encode/django-rest-framework/issues/3568\n[gh3592]: https://github.com/encode/django-rest-framework/issues/3592\n[gh3593]: https://github.com/encode/django-rest-framework/issues/3593\n\n<!-- 3.3.2 -->\n[gh3228]: https://github.com/encode/django-rest-framework/issues/3228\n[gh3252]: https://github.com/encode/django-rest-framework/issues/3252\n[gh3513]: https://github.com/encode/django-rest-framework/issues/3513\n[gh3534]: https://github.com/encode/django-rest-framework/issues/3534\n[gh3578]: https://github.com/encode/django-rest-framework/issues/3578\n[gh3596]: https://github.com/encode/django-rest-framework/issues/3596\n[gh3597]: https://github.com/encode/django-rest-framework/issues/3597\n[gh3600]: https://github.com/encode/django-rest-framework/issues/3600\n[gh3626]: https://github.com/encode/django-rest-framework/issues/3626\n[gh3628]: https://github.com/encode/django-rest-framework/issues/3628\n[gh3631]: https://github.com/encode/django-rest-framework/issues/3631\n[gh3634]: https://github.com/encode/django-rest-framework/issues/3634\n[gh3635]: https://github.com/encode/django-rest-framework/issues/3635\n[gh3654]: https://github.com/encode/django-rest-framework/issues/3654\n[gh3655]: https://github.com/encode/django-rest-framework/issues/3655\n[gh3656]: https://github.com/encode/django-rest-framework/issues/3656\n[gh3662]: https://github.com/encode/django-rest-framework/issues/3662\n[gh3668]: https://github.com/encode/django-rest-framework/issues/3668\n[gh3672]: https://github.com/encode/django-rest-framework/issues/3672\n[gh3677]: https://github.com/encode/django-rest-framework/issues/3677\n[gh3679]: https://github.com/encode/django-rest-framework/issues/3679\n[gh3684]: https://github.com/encode/django-rest-framework/issues/3684\n[gh3687]: https://github.com/encode/django-rest-framework/issues/3687\n[gh3701]: https://github.com/encode/django-rest-framework/issues/3701\n[gh3705]: https://github.com/encode/django-rest-framework/issues/3705\n[gh3714]: https://github.com/encode/django-rest-framework/issues/3714\n[gh3718]: https://github.com/encode/django-rest-framework/issues/3718\n[gh3723]: https://github.com/encode/django-rest-framework/issues/3723\n\n<!-- 3.3.3 -->\n[gh3968]: https://github.com/encode/django-rest-framework/issues/3968\n[gh3962]: https://github.com/encode/django-rest-framework/issues/3962\n[gh3913]: https://github.com/encode/django-rest-framework/issues/3913\n[gh3912]: https://github.com/encode/django-rest-framework/issues/3912\n[gh3910]: https://github.com/encode/django-rest-framework/issues/3910\n[gh3903]: https://github.com/encode/django-rest-framework/issues/3903\n[gh3887]: https://github.com/encode/django-rest-framework/issues/3887\n[gh3878]: https://github.com/encode/django-rest-framework/issues/3878\n[gh3860]: https://github.com/encode/django-rest-framework/issues/3860\n[gh3858]: https://github.com/encode/django-rest-framework/issues/3858\n[gh3842]: https://github.com/encode/django-rest-framework/issues/3842\n[gh3833]: https://github.com/encode/django-rest-framework/issues/3833\n[gh3832]: https://github.com/encode/django-rest-framework/issues/3832\n[gh3819]: https://github.com/encode/django-rest-framework/issues/3819\n[gh3815]: https://github.com/encode/django-rest-framework/issues/3815\n[gh3809]: https://github.com/encode/django-rest-framework/issues/3809\n[gh3805]: https://github.com/encode/django-rest-framework/issues/3805\n[gh3804]: https://github.com/encode/django-rest-framework/issues/3804\n[gh3801]: https://github.com/encode/django-rest-framework/issues/3801\n[gh3787]: https://github.com/encode/django-rest-framework/issues/3787\n[gh3786]: https://github.com/encode/django-rest-framework/issues/3786\n[gh3785]: https://github.com/encode/django-rest-framework/issues/3785\n[gh3774]: https://github.com/encode/django-rest-framework/issues/3774\n[gh3769]: https://github.com/encode/django-rest-framework/issues/3769\n[gh3753]: https://github.com/encode/django-rest-framework/issues/3753\n[gh3739]: https://github.com/encode/django-rest-framework/issues/3739\n[gh3731]: https://github.com/encode/django-rest-framework/issues/3731\n[gh3728]: https://github.com/encode/django-rest-framework/issues/3726\n[gh3715]: https://github.com/encode/django-rest-framework/issues/3715\n[gh3703]: https://github.com/encode/django-rest-framework/issues/3703\n[gh3696]: https://github.com/encode/django-rest-framework/issues/3696\n[gh3637]: https://github.com/encode/django-rest-framework/issues/3637\n[gh3636]: https://github.com/encode/django-rest-framework/issues/3636\n[gh3605]: https://github.com/encode/django-rest-framework/issues/3605\n[gh3604]: https://github.com/encode/django-rest-framework/issues/3604\n\n<!-- 3.4.0 -->\n[gh2403]: https://github.com/encode/django-rest-framework/issues/2403\n[gh2848]: https://github.com/encode/django-rest-framework/issues/2848\n[gh2996]: https://github.com/encode/django-rest-framework/issues/2996\n[gh3164]: https://github.com/encode/django-rest-framework/issues/3164\n[gh3273]: https://github.com/encode/django-rest-framework/issues/3273\n[gh3381]: https://github.com/encode/django-rest-framework/issues/3381\n[gh3438]: https://github.com/encode/django-rest-framework/issues/3438\n[gh3444]: https://github.com/encode/django-rest-framework/issues/3444\n[gh3476]: https://github.com/encode/django-rest-framework/issues/3476\n[gh3487]: https://github.com/encode/django-rest-framework/issues/3487\n[gh3541]: https://github.com/encode/django-rest-framework/issues/3541\n[gh3710]: https://github.com/encode/django-rest-framework/issues/3710\n[gh3729]: https://github.com/encode/django-rest-framework/issues/3729\n[gh3751]: https://github.com/encode/django-rest-framework/issues/3751\n[gh3812]: https://github.com/encode/django-rest-framework/issues/3812\n[gh3816]: https://github.com/encode/django-rest-framework/issues/3816\n[gh3820]: https://github.com/encode/django-rest-framework/issues/3820\n[gh3906]: https://github.com/encode/django-rest-framework/issues/3906\n[gh3908]: https://github.com/encode/django-rest-framework/issues/3908\n[gh3926]: https://github.com/encode/django-rest-framework/issues/3926\n[gh3933]: https://github.com/encode/django-rest-framework/issues/3933\n[gh3936]: https://github.com/encode/django-rest-framework/issues/3936\n[gh3938]: https://github.com/encode/django-rest-framework/issues/3938\n[gh3943]: https://github.com/encode/django-rest-framework/issues/3943\n[gh3953]: https://github.com/encode/django-rest-framework/issues/3953\n[gh3964]: https://github.com/encode/django-rest-framework/issues/3964\n[gh3968]: https://github.com/encode/django-rest-framework/issues/3968\n[gh3970]: https://github.com/encode/django-rest-framework/issues/3970\n[gh3971]: https://github.com/encode/django-rest-framework/issues/3971\n[gh3976]: https://github.com/encode/django-rest-framework/issues/3976\n[gh3983]: https://github.com/encode/django-rest-framework/issues/3983\n[gh3990]: https://github.com/encode/django-rest-framework/issues/3990\n[gh4002]: https://github.com/encode/django-rest-framework/issues/4002\n[gh4003]: https://github.com/encode/django-rest-framework/issues/4003\n[gh4005]: https://github.com/encode/django-rest-framework/issues/4005\n[gh4006]: https://github.com/encode/django-rest-framework/issues/4006\n[gh4008]: https://github.com/encode/django-rest-framework/issues/4008\n[gh4021]: https://github.com/encode/django-rest-framework/issues/4021\n[gh4025]: https://github.com/encode/django-rest-framework/issues/4025\n[gh4040]: https://github.com/encode/django-rest-framework/issues/4040\n[gh4041]: https://github.com/encode/django-rest-framework/issues/4041\n[gh4049]: https://github.com/encode/django-rest-framework/issues/4049\n[gh4075]: https://github.com/encode/django-rest-framework/issues/4075\n[gh4079]: https://github.com/encode/django-rest-framework/issues/4079\n[gh4090]: https://github.com/encode/django-rest-framework/issues/4090\n[gh4097]: https://github.com/encode/django-rest-framework/issues/4097\n[gh4098]: https://github.com/encode/django-rest-framework/issues/4098\n[gh4103]: https://github.com/encode/django-rest-framework/issues/4103\n[gh4105]: https://github.com/encode/django-rest-framework/issues/4105\n[gh4106]: https://github.com/encode/django-rest-framework/issues/4106\n[gh4107]: https://github.com/encode/django-rest-framework/issues/4107\n[gh4118]: https://github.com/encode/django-rest-framework/issues/4118\n[gh4146]: https://github.com/encode/django-rest-framework/issues/4146\n[gh4149]: https://github.com/encode/django-rest-framework/issues/4149\n[gh4153]: https://github.com/encode/django-rest-framework/issues/4153\n[gh4156]: https://github.com/encode/django-rest-framework/issues/4156\n[gh4157]: https://github.com/encode/django-rest-framework/issues/4157\n[gh4158]: https://github.com/encode/django-rest-framework/issues/4158\n[gh4166]: https://github.com/encode/django-rest-framework/issues/4166\n[gh4176]: https://github.com/encode/django-rest-framework/issues/4176\n[gh4179]: https://github.com/encode/django-rest-framework/issues/4179\n[gh4180]: https://github.com/encode/django-rest-framework/issues/4180\n[gh4181]: https://github.com/encode/django-rest-framework/issues/4181\n[gh4185]: https://github.com/encode/django-rest-framework/issues/4185\n[gh4187]: https://github.com/encode/django-rest-framework/issues/4187\n[gh4191]: https://github.com/encode/django-rest-framework/issues/4191\n[gh4192]: https://github.com/encode/django-rest-framework/issues/4192\n[gh4194]: https://github.com/encode/django-rest-framework/issues/4194\n[gh4195]: https://github.com/encode/django-rest-framework/issues/4195\n[gh4196]: https://github.com/encode/django-rest-framework/issues/4196\n[gh4212]: https://github.com/encode/django-rest-framework/issues/4212\n[gh4215]: https://github.com/encode/django-rest-framework/issues/4215\n[gh4217]: https://github.com/encode/django-rest-framework/issues/4217\n[gh4219]: https://github.com/encode/django-rest-framework/issues/4219\n[gh4229]: https://github.com/encode/django-rest-framework/issues/4229\n[gh4233]: https://github.com/encode/django-rest-framework/issues/4233\n[gh4244]: https://github.com/encode/django-rest-framework/issues/4244\n[gh4246]: https://github.com/encode/django-rest-framework/issues/4246\n[gh4253]: https://github.com/encode/django-rest-framework/issues/4253\n[gh4254]: https://github.com/encode/django-rest-framework/issues/4254\n[gh4255]: https://github.com/encode/django-rest-framework/issues/4255\n[gh4256]: https://github.com/encode/django-rest-framework/issues/4256\n[gh4259]: https://github.com/encode/django-rest-framework/issues/4259\n\n<!-- 3.4.1 -->\n[gh4323]: https://github.com/encode/django-rest-framework/issues/4323\n[gh4268]: https://github.com/encode/django-rest-framework/issues/4268\n[gh4321]: https://github.com/encode/django-rest-framework/issues/4321\n[gh4308]: https://github.com/encode/django-rest-framework/issues/4308\n[gh4305]: https://github.com/encode/django-rest-framework/issues/4305\n[gh4316]: https://github.com/encode/django-rest-framework/issues/4316\n[gh4294]: https://github.com/encode/django-rest-framework/issues/4294\n[gh4293]: https://github.com/encode/django-rest-framework/issues/4293\n[gh4315]: https://github.com/encode/django-rest-framework/issues/4315\n[gh4314]: https://github.com/encode/django-rest-framework/issues/4314\n[gh4289]: https://github.com/encode/django-rest-framework/issues/4289\n[gh4265]: https://github.com/encode/django-rest-framework/issues/4265\n[gh4285]: https://github.com/encode/django-rest-framework/issues/4285\n[gh4287]: https://github.com/encode/django-rest-framework/issues/4287\n[gh4313]: https://github.com/encode/django-rest-framework/issues/4313\n[gh4281]: https://github.com/encode/django-rest-framework/issues/4281\n[gh4299]: https://github.com/encode/django-rest-framework/issues/4299\n[gh4307]: https://github.com/encode/django-rest-framework/issues/4307\n[gh4302]: https://github.com/encode/django-rest-framework/issues/4302\n[gh4303]: https://github.com/encode/django-rest-framework/issues/4303\n[gh4298]: https://github.com/encode/django-rest-framework/issues/4298\n[gh4291]: https://github.com/encode/django-rest-framework/issues/4291\n[gh4270]: https://github.com/encode/django-rest-framework/issues/4270\n[gh4272]: https://github.com/encode/django-rest-framework/issues/4272\n[gh4273]: https://github.com/encode/django-rest-framework/issues/4273\n[gh4288]: https://github.com/encode/django-rest-framework/issues/4288\n\n<!-- 3.4.2 -->\n[gh3565]: https://github.com/encode/django-rest-framework/issues/3565\n[gh3610]: https://github.com/encode/django-rest-framework/issues/3610\n[gh4198]: https://github.com/encode/django-rest-framework/issues/4198\n[gh4199]: https://github.com/encode/django-rest-framework/issues/4199\n[gh4236]: https://github.com/encode/django-rest-framework/issues/4236\n[gh4292]: https://github.com/encode/django-rest-framework/issues/4292\n[gh4296]: https://github.com/encode/django-rest-framework/issues/4296\n[gh4318]: https://github.com/encode/django-rest-framework/issues/4318\n[gh4330]: https://github.com/encode/django-rest-framework/issues/4330\n[gh4331]: https://github.com/encode/django-rest-framework/issues/4331\n[gh4332]: https://github.com/encode/django-rest-framework/issues/4332\n[gh4335]: https://github.com/encode/django-rest-framework/issues/4335\n[gh4336]: https://github.com/encode/django-rest-framework/issues/4336\n[gh4338]: https://github.com/encode/django-rest-framework/issues/4338\n[gh4339]: https://github.com/encode/django-rest-framework/issues/4339\n[gh4340]: https://github.com/encode/django-rest-framework/issues/4340\n[gh4344]: https://github.com/encode/django-rest-framework/issues/4344\n[gh4345]: https://github.com/encode/django-rest-framework/issues/4345\n[gh4346]: https://github.com/encode/django-rest-framework/issues/4346\n[gh4347]: https://github.com/encode/django-rest-framework/issues/4347\n[gh4348]: https://github.com/encode/django-rest-framework/issues/4348\n[gh4349]: https://github.com/encode/django-rest-framework/issues/4349\n[gh4354]: https://github.com/encode/django-rest-framework/issues/4354\n[gh4357]: https://github.com/encode/django-rest-framework/issues/4357\n[gh4358]: https://github.com/encode/django-rest-framework/issues/4358\n[gh4359]: https://github.com/encode/django-rest-framework/issues/4359\n\n<!-- 3.4.3 -->\n[gh4361]: https://github.com/encode/django-rest-framework/issues/4361\n\n<!-- 3.4.4 -->\n\n[gh3329]: https://github.com/encode/django-rest-framework/issues/3329\n[gh3330]: https://github.com/encode/django-rest-framework/issues/3330\n[gh3365]: https://github.com/encode/django-rest-framework/issues/3365\n[gh3394]: https://github.com/encode/django-rest-framework/issues/3394\n[gh3868]: https://github.com/encode/django-rest-framework/issues/3868\n[gh3868]: https://github.com/encode/django-rest-framework/issues/3868\n[gh3877]: https://github.com/encode/django-rest-framework/issues/3877\n[gh4042]: https://github.com/encode/django-rest-framework/issues/4042\n[gh4111]: https://github.com/encode/django-rest-framework/issues/4111\n[gh4119]: https://github.com/encode/django-rest-framework/issues/4119\n[gh4120]: https://github.com/encode/django-rest-framework/issues/4120\n[gh4121]: https://github.com/encode/django-rest-framework/issues/4121\n[gh4122]: https://github.com/encode/django-rest-framework/issues/4122\n[gh4137]: https://github.com/encode/django-rest-framework/issues/4137\n[gh4172]: https://github.com/encode/django-rest-framework/issues/4172\n[gh4201]: https://github.com/encode/django-rest-framework/issues/4201\n[gh4260]: https://github.com/encode/django-rest-framework/issues/4260\n[gh4278]: https://github.com/encode/django-rest-framework/issues/4278\n[gh4279]: https://github.com/encode/django-rest-framework/issues/4279\n[gh4329]: https://github.com/encode/django-rest-framework/issues/4329\n[gh4370]: https://github.com/encode/django-rest-framework/issues/4370\n[gh4371]: https://github.com/encode/django-rest-framework/issues/4371\n[gh4372]: https://github.com/encode/django-rest-framework/issues/4372\n[gh4373]: https://github.com/encode/django-rest-framework/issues/4373\n[gh4374]: https://github.com/encode/django-rest-framework/issues/4374\n[gh4375]: https://github.com/encode/django-rest-framework/issues/4375\n[gh4376]: https://github.com/encode/django-rest-framework/issues/4376\n[gh4377]: https://github.com/encode/django-rest-framework/issues/4377\n[gh4378]: https://github.com/encode/django-rest-framework/issues/4378\n[gh4379]: https://github.com/encode/django-rest-framework/issues/4379\n[gh4380]: https://github.com/encode/django-rest-framework/issues/4380\n[gh4382]: https://github.com/encode/django-rest-framework/issues/4382\n[gh4383]: https://github.com/encode/django-rest-framework/issues/4383\n[gh4386]: https://github.com/encode/django-rest-framework/issues/4386\n[gh4387]: https://github.com/encode/django-rest-framework/issues/4387\n[gh4388]: https://github.com/encode/django-rest-framework/issues/4388\n[gh4390]: https://github.com/encode/django-rest-framework/issues/4390\n[gh4391]: https://github.com/encode/django-rest-framework/issues/4391\n[gh4392]: https://github.com/encode/django-rest-framework/issues/4392\n[gh4393]: https://github.com/encode/django-rest-framework/issues/4393\n[gh4394]: https://github.com/encode/django-rest-framework/issues/4394\n\n<!-- 3.4.5 -->\n[gh4416]: https://github.com/encode/django-rest-framework/issues/4416\n[gh4409]: https://github.com/encode/django-rest-framework/issues/4409\n[gh4415]: https://github.com/encode/django-rest-framework/issues/4415\n[gh4410]: https://github.com/encode/django-rest-framework/issues/4410\n[gh4408]: https://github.com/encode/django-rest-framework/issues/4408\n[gh4398]: https://github.com/encode/django-rest-framework/issues/4398\n[gh4407]: https://github.com/encode/django-rest-framework/issues/4407\n[gh4403]: https://github.com/encode/django-rest-framework/issues/4403\n[gh4404]: https://github.com/encode/django-rest-framework/issues/4404\n[gh4412]: https://github.com/encode/django-rest-framework/issues/4412\n\n<!-- 3.4.6 -->\n\n[gh4435]: https://github.com/encode/django-rest-framework/issues/4435\n[gh4425]: https://github.com/encode/django-rest-framework/issues/4425\n[gh4429]: https://github.com/encode/django-rest-framework/issues/4429\n[gh3508]: https://github.com/encode/django-rest-framework/issues/3508\n[gh4419]: https://github.com/encode/django-rest-framework/issues/4419\n[gh4423]: https://github.com/encode/django-rest-framework/issues/4423\n\n<!-- 3.4.7 -->\n\n[gh3951]: https://github.com/encode/django-rest-framework/issues/3951\n[gh4500]: https://github.com/encode/django-rest-framework/issues/4500\n[gh4489]: https://github.com/encode/django-rest-framework/issues/4489\n[gh4490]: https://github.com/encode/django-rest-framework/issues/4490\n[gh2617]: https://github.com/encode/django-rest-framework/issues/2617\n[gh4472]: https://github.com/encode/django-rest-framework/issues/4472\n[gh4473]: https://github.com/encode/django-rest-framework/issues/4473\n[gh4495]: https://github.com/encode/django-rest-framework/issues/4495\n[gh4493]: https://github.com/encode/django-rest-framework/issues/4493\n[gh4465]: https://github.com/encode/django-rest-framework/issues/4465\n[gh4462]: https://github.com/encode/django-rest-framework/issues/4462\n[gh4458]: https://github.com/encode/django-rest-framework/issues/4458\n\n<!-- 3.5.1 -->\n\n[gh4612]: https://github.com/encode/django-rest-framework/issues/4612\n[gh4608]: https://github.com/encode/django-rest-framework/issues/4608\n[gh4601]: https://github.com/encode/django-rest-framework/issues/4601\n[gh4611]: https://github.com/encode/django-rest-framework/issues/4611\n[gh4605]: https://github.com/encode/django-rest-framework/issues/4605\n[gh4609]: https://github.com/encode/django-rest-framework/issues/4609\n[gh4606]: https://github.com/encode/django-rest-framework/issues/4606\n[gh4600]: https://github.com/encode/django-rest-framework/issues/4600\n\n<!-- 3.5.2 -->\n\n[gh4631]: https://github.com/encode/django-rest-framework/issues/4631\n[gh4638]: https://github.com/encode/django-rest-framework/issues/4638\n[gh4532]: https://github.com/encode/django-rest-framework/issues/4532\n[gh4636]: https://github.com/encode/django-rest-framework/issues/4636\n[gh4622]: https://github.com/encode/django-rest-framework/issues/4622\n[gh4602]: https://github.com/encode/django-rest-framework/issues/4602\n[gh4640]: https://github.com/encode/django-rest-framework/issues/4640\n[gh4624]: https://github.com/encode/django-rest-framework/issues/4624\n[gh4569]: https://github.com/encode/django-rest-framework/issues/4569\n[gh4627]: https://github.com/encode/django-rest-framework/issues/4627\n[gh4620]: https://github.com/encode/django-rest-framework/issues/4620\n[gh4628]: https://github.com/encode/django-rest-framework/issues/4628\n[gh4639]: https://github.com/encode/django-rest-framework/issues/4639\n\n<!-- 3.5.3 -->\n\n[gh4660]: https://github.com/encode/django-rest-framework/issues/4660\n[gh4643]: https://github.com/encode/django-rest-framework/issues/4643\n[gh4644]: https://github.com/encode/django-rest-framework/issues/4644\n[gh4645]: https://github.com/encode/django-rest-framework/issues/4645\n[gh4646]: https://github.com/encode/django-rest-framework/issues/4646\n[gh4650]: https://github.com/encode/django-rest-framework/issues/4650\n\n<!-- 3.5.4 -->\n\n[gh4877]: https://github.com/encode/django-rest-framework/issues/4877\n[gh4753]: https://github.com/encode/django-rest-framework/issues/4753\n[gh4764]: https://github.com/encode/django-rest-framework/issues/4764\n[gh4821]: https://github.com/encode/django-rest-framework/issues/4821\n[gh4841]: https://github.com/encode/django-rest-framework/issues/4841\n[gh4759]: https://github.com/encode/django-rest-framework/issues/4759\n[gh4869]: https://github.com/encode/django-rest-framework/issues/4869\n[gh4870]: https://github.com/encode/django-rest-framework/issues/4870\n[gh4790]: https://github.com/encode/django-rest-framework/issues/4790\n[gh4661]: https://github.com/encode/django-rest-framework/issues/4661\n[gh4668]: https://github.com/encode/django-rest-framework/issues/4668\n[gh4750]: https://github.com/encode/django-rest-framework/issues/4750\n[gh4678]: https://github.com/encode/django-rest-framework/issues/4678\n[gh4634]: https://github.com/encode/django-rest-framework/issues/4634\n[gh4669]: https://github.com/encode/django-rest-framework/issues/4669\n[gh4712]: https://github.com/encode/django-rest-framework/issues/4712\n\n<!-- 3.6.1 -->\n[gh4947]: https://github.com/encode/django-rest-framework/issues/4947\n\n<!-- 3.6.2 -->\n[gh4959]: https://github.com/encode/django-rest-framework/issues/4959\n[gh4961]: https://github.com/encode/django-rest-framework/issues/4961\n[gh4952]: https://github.com/encode/django-rest-framework/issues/4952\n[gh4953]: https://github.com/encode/django-rest-framework/issues/4953\n[gh4950]: https://github.com/encode/django-rest-framework/issues/4950\n[gh4951]: https://github.com/encode/django-rest-framework/issues/4951\n[gh4955]: https://github.com/encode/django-rest-framework/issues/4955\n[gh4956]: https://github.com/encode/django-rest-framework/issues/4956\n[gh4949]: https://github.com/encode/django-rest-framework/issues/4949\n\n<!-- 3.6.3 -->\n[gh5126]: https://github.com/encode/django-rest-framework/issues/5126\n[gh5085]: https://github.com/encode/django-rest-framework/issues/5085\n[gh4437]: https://github.com/encode/django-rest-framework/issues/4437\n[gh4222]: https://github.com/encode/django-rest-framework/issues/4222\n[gh4999]: https://github.com/encode/django-rest-framework/issues/4999\n[gh5042]: https://github.com/encode/django-rest-framework/issues/5042\n[gh4987]: https://github.com/encode/django-rest-framework/issues/4987\n[gh4979]: https://github.com/encode/django-rest-framework/issues/4979\n[gh5086]: https://github.com/encode/django-rest-framework/issues/5086\n[gh3692]: https://github.com/encode/django-rest-framework/issues/3692\n[gh4748]: https://github.com/encode/django-rest-framework/issues/4748\n[gh5078]: https://github.com/encode/django-rest-framework/issues/5078\n[gh5082]: https://github.com/encode/django-rest-framework/issues/5082\n[gh5047]: https://github.com/encode/django-rest-framework/issues/5047\n[gh5053]: https://github.com/encode/django-rest-framework/issues/5053\n[gh5055]: https://github.com/encode/django-rest-framework/issues/5055\n[gh5054]: https://github.com/encode/django-rest-framework/issues/5054\n[gh5038]: https://github.com/encode/django-rest-framework/issues/5038\n[gh5004]: https://github.com/encode/django-rest-framework/issues/5004\n[gh5026]: https://github.com/encode/django-rest-framework/issues/5026\n[gh5028]: https://github.com/encode/django-rest-framework/issues/5028\n[gh5001]: https://github.com/encode/django-rest-framework/issues/5001\n[gh5014]: https://github.com/encode/django-rest-framework/issues/5014\n[gh5000]: https://github.com/encode/django-rest-framework/issues/5000\n[gh4994]: https://github.com/encode/django-rest-framework/issues/4994\n[gh4705]: https://github.com/encode/django-rest-framework/issues/4705\n[gh4973]: https://github.com/encode/django-rest-framework/issues/4973\n[gh4864]: https://github.com/encode/django-rest-framework/issues/4864\n[gh4688]: https://github.com/encode/django-rest-framework/issues/4688\n[gh4968]: https://github.com/encode/django-rest-framework/issues/4968\n[gh5089]: https://github.com/encode/django-rest-framework/issues/5089\n[gh5117]: https://github.com/encode/django-rest-framework/issues/5117\n\n<!-- 3.6.4 -->\n[gh5346]: https://github.com/encode/django-rest-framework/issues/5346\n[gh5334]: https://github.com/encode/django-rest-framework/issues/5334\n[gh5326]: https://github.com/encode/django-rest-framework/issues/5326\n[gh5313]: https://github.com/encode/django-rest-framework/issues/5313\n[gh5306]: https://github.com/encode/django-rest-framework/issues/5306\n[gh5276]: https://github.com/encode/django-rest-framework/issues/5276\n[gh5264]: https://github.com/encode/django-rest-framework/issues/5264\n[gh5261]: https://github.com/encode/django-rest-framework/issues/5261\n[gh5259]: https://github.com/encode/django-rest-framework/issues/5259\n[gh5231]: https://github.com/encode/django-rest-framework/issues/5231\n[gh5229]: https://github.com/encode/django-rest-framework/issues/5229\n[gh5214]: https://github.com/encode/django-rest-framework/issues/5214\n[gh5196]: https://github.com/encode/django-rest-framework/issues/5196\n[gh5192]: https://github.com/encode/django-rest-framework/issues/5192\n[gh5162]: https://github.com/encode/django-rest-framework/issues/5162\n[gh5188]: https://github.com/encode/django-rest-framework/issues/5188\n[gh5187]: https://github.com/encode/django-rest-framework/issues/5187\n[gh5186]: https://github.com/encode/django-rest-framework/issues/5186\n[gh5179]: https://github.com/encode/django-rest-framework/issues/5179\n[gh5176]: https://github.com/encode/django-rest-framework/issues/5176\n[gh5174]: https://github.com/encode/django-rest-framework/issues/5174\n[gh5161]: https://github.com/encode/django-rest-framework/issues/5161\n[gh5147]: https://github.com/encode/django-rest-framework/issues/5147\n[gh5131]: https://github.com/encode/django-rest-framework/issues/5131\n\n<!-- 3.7.0 -->\n[gh5481]: https://github.com/encode/django-rest-framework/issues/5481\n[gh5480]: https://github.com/encode/django-rest-framework/issues/5480\n[gh5479]: https://github.com/encode/django-rest-framework/issues/5479\n[gh5295]: https://github.com/encode/django-rest-framework/issues/5295\n[gh5464]: https://github.com/encode/django-rest-framework/issues/5464\n[gh5478]: https://github.com/encode/django-rest-framework/issues/5478\n[gh5476]: https://github.com/encode/django-rest-framework/issues/5476\n[gh5466]: https://github.com/encode/django-rest-framework/issues/5466\n[gh5472]: https://github.com/encode/django-rest-framework/issues/5472\n[gh5462]: https://github.com/encode/django-rest-framework/issues/5462\n[gh5470]: https://github.com/encode/django-rest-framework/issues/5470\n[gh5469]: https://github.com/encode/django-rest-framework/issues/5469\n[gh5435]: https://github.com/encode/django-rest-framework/issues/5435\n[gh5434]: https://github.com/encode/django-rest-framework/issues/5434\n[gh5426]: https://github.com/encode/django-rest-framework/issues/5426\n[gh5421]: https://github.com/encode/django-rest-framework/issues/5421\n[gh5415]: https://github.com/encode/django-rest-framework/issues/5415\n[gh5401]: https://github.com/encode/django-rest-framework/issues/5401\n[gh5398]: https://github.com/encode/django-rest-framework/issues/5398\n[gh5388]: https://github.com/encode/django-rest-framework/issues/5388\n[gh5387]: https://github.com/encode/django-rest-framework/issues/5387\n[gh5372]: https://github.com/encode/django-rest-framework/issues/5372\n[gh5380]: https://github.com/encode/django-rest-framework/issues/5380\n[gh5351]: https://github.com/encode/django-rest-framework/issues/5351\n[gh5375]: https://github.com/encode/django-rest-framework/issues/5375\n[gh5373]: https://github.com/encode/django-rest-framework/issues/5373\n[gh5361]: https://github.com/encode/django-rest-framework/issues/5361\n[gh5348]: https://github.com/encode/django-rest-framework/issues/5348\n[gh5058]: https://github.com/encode/django-rest-framework/issues/5058\n[gh5457]: https://github.com/encode/django-rest-framework/issues/5457\n[gh5376]: https://github.com/encode/django-rest-framework/issues/5376\n[gh5422]: https://github.com/encode/django-rest-framework/issues/5422\n[gh3732]: https://github.com/encode/django-rest-framework/issues/3732\n[djangodocs-set-timezone]: https://docs.djangoproject.com/en/1.11/topics/i18n/timezones/#default-time-zone-and-current-time-zone\n[gh5273]: https://github.com/encode/django-rest-framework/issues/5273\n[gh5440]: https://github.com/encode/django-rest-framework/issues/5440\n[gh5265]: https://github.com/encode/django-rest-framework/issues/5265\n[gh5250]: https://github.com/encode/django-rest-framework/issues/5250\n[gh5170]: https://github.com/encode/django-rest-framework/issues/5170\n[gh5443]: https://github.com/encode/django-rest-framework/issues/5443\n[gh5448]: https://github.com/encode/django-rest-framework/issues/5448\n[gh5452]: https://github.com/encode/django-rest-framework/issues/5452\n[gh5342]: https://github.com/encode/django-rest-framework/issues/5342\n[gh5454]: https://github.com/encode/django-rest-framework/issues/5454\n[gh5482]: https://github.com/encode/django-rest-framework/issues/5482\n\n<!-- 3.7.1 -->\n[gh5489]: https://github.com/encode/django-rest-framework/issues/5489\n[gh5486]: https://github.com/encode/django-rest-framework/issues/5486\n[gh5503]: https://github.com/encode/django-rest-framework/issues/5503\n[gh5500]: https://github.com/encode/django-rest-framework/issues/5500\n[gh5492]: https://github.com/encode/django-rest-framework/issues/5492\n\n<!-- 3.7.2 -->\n[gh5552]: https://github.com/encode/django-rest-framework/issues/5552\n[gh5539]: https://github.com/encode/django-rest-framework/issues/5539\n[gh5559]: https://github.com/encode/django-rest-framework/issues/5559\n[gh5561]: https://github.com/encode/django-rest-framework/issues/5561\n[gh5562]: https://github.com/encode/django-rest-framework/issues/5562\n[gh5548]: https://github.com/encode/django-rest-framework/issues/5548\n[gh5560]: https://github.com/encode/django-rest-framework/issues/5560\n[gh5557]: https://github.com/encode/django-rest-framework/issues/5557\n[gh5556]: https://github.com/encode/django-rest-framework/issues/5556\n[gh5555]: https://github.com/encode/django-rest-framework/issues/5555\n[gh5550]: https://github.com/encode/django-rest-framework/issues/5550\n[gh5549]: https://github.com/encode/django-rest-framework/issues/5549\n[gh5546]: https://github.com/encode/django-rest-framework/issues/5546\n[gh5547]: https://github.com/encode/django-rest-framework/issues/5547\n[gh5544]: https://github.com/encode/django-rest-framework/issues/5544\n[gh5518]: https://github.com/encode/django-rest-framework/issues/5518\n[gh5533]: https://github.com/encode/django-rest-framework/issues/5533\n[gh5532]: https://github.com/encode/django-rest-framework/issues/5532\n[gh5530]: https://github.com/encode/django-rest-framework/issues/5530\n[gh5527]: https://github.com/encode/django-rest-framework/issues/5527\n[gh5524]: https://github.com/encode/django-rest-framework/issues/5524\n[gh5516]: https://github.com/encode/django-rest-framework/issues/5516\n[gh5513]: https://github.com/encode/django-rest-framework/issues/5513\n[gh5511]: https://github.com/encode/django-rest-framework/issues/5511\n[gh5514]: https://github.com/encode/django-rest-framework/issues/5514\n[gh5512]: https://github.com/encode/django-rest-framework/issues/5512\n[gh5510]: https://github.com/encode/django-rest-framework/issues/5510\n\n<!-- 3.7.3 -->\n[gh5567]: https://github.com/encode/django-rest-framework/issues/5567\n\n<!-- 3.7.4 -->\n[gh5691]: https://github.com/encode/django-rest-framework/issues/5691\n[gh5688]: https://github.com/encode/django-rest-framework/issues/5688\n[gh5689]: https://github.com/encode/django-rest-framework/issues/5689\n[gh5687]: https://github.com/encode/django-rest-framework/issues/5687\n[gh5685]: https://github.com/encode/django-rest-framework/issues/5685\n[gh5683]: https://github.com/encode/django-rest-framework/issues/5683\n[gh5682]: https://github.com/encode/django-rest-framework/issues/5682\n[gh5681]: https://github.com/encode/django-rest-framework/issues/5681\n[gh5680]: https://github.com/encode/django-rest-framework/issues/5680\n[gh5679]: https://github.com/encode/django-rest-framework/issues/5679\n[gh5678]: https://github.com/encode/django-rest-framework/issues/5678\n[gh5656]: https://github.com/encode/django-rest-framework/issues/5656\n[gh5665]: https://github.com/encode/django-rest-framework/issues/5665\n[gh5658]: https://github.com/encode/django-rest-framework/issues/5658\n[gh5668]: https://github.com/encode/django-rest-framework/issues/5668\n[gh5652]: https://github.com/encode/django-rest-framework/issues/5652\n[gh5648]: https://github.com/encode/django-rest-framework/issues/5648\n[gh5649]: https://github.com/encode/django-rest-framework/issues/5649\n[gh5646]: https://github.com/encode/django-rest-framework/issues/5646\n[gh5645]: https://github.com/encode/django-rest-framework/issues/5645\n[gh5641]: https://github.com/encode/django-rest-framework/issues/5641\n[gh5639]: https://github.com/encode/django-rest-framework/issues/5639\n[gh5622]: https://github.com/encode/django-rest-framework/issues/5622\n[gh5625]: https://github.com/encode/django-rest-framework/issues/5625\n[gh5624]: https://github.com/encode/django-rest-framework/issues/5624\n[gh5629]: https://github.com/encode/django-rest-framework/issues/5629\n[gh5626]: https://github.com/encode/django-rest-framework/issues/5626\n[gh5600]: https://github.com/encode/django-rest-framework/issues/5600\n[gh5618]: https://github.com/encode/django-rest-framework/issues/5618\n[gh5619]: https://github.com/encode/django-rest-framework/issues/5619\n[gh5607]: https://github.com/encode/django-rest-framework/issues/5607\n[gh5617]: https://github.com/encode/django-rest-framework/issues/5617\n[gh5598]: https://github.com/encode/django-rest-framework/issues/5598\n[gh5613]: https://github.com/encode/django-rest-framework/issues/5613\n[gh5599]: https://github.com/encode/django-rest-framework/issues/5599\n[gh5602]: https://github.com/encode/django-rest-framework/issues/5602\n[gh5612]: https://github.com/encode/django-rest-framework/issues/5612\n[gh5611]: https://github.com/encode/django-rest-framework/issues/5611\n[gh5610]: https://github.com/encode/django-rest-framework/issues/5610\n[gh5590]: https://github.com/encode/django-rest-framework/issues/5590\n[gh5591]: https://github.com/encode/django-rest-framework/issues/5591\n[gh5587]: https://github.com/encode/django-rest-framework/issues/5587\n[gh5584]: https://github.com/encode/django-rest-framework/issues/5584\n[gh5581]: https://github.com/encode/django-rest-framework/issues/5581\n[gh5578]: https://github.com/encode/django-rest-framework/issues/5578\n[gh5577]: https://github.com/encode/django-rest-framework/issues/5577\n[gh5579]: https://github.com/encode/django-rest-framework/issues/5579\n[gh5633]: https://github.com/encode/django-rest-framework/issues/5633\n\n<!-- 3.7.5 -->\n[gh5692]: https://github.com/encode/django-rest-framework/issues/5692\n[gh5695]: https://github.com/encode/django-rest-framework/issues/5695\n[gh5696]: https://github.com/encode/django-rest-framework/issues/5696\n[gh5697]: https://github.com/encode/django-rest-framework/issues/5697\n\n<!-- 3.8.0 -->\n[gh5886]: https://github.com/encode/django-rest-framework/issues/5886\n[gh5888]: https://github.com/encode/django-rest-framework/issues/5888\n[gh5705]: https://github.com/encode/django-rest-framework/issues/5705\n[gh5796]: https://github.com/encode/django-rest-framework/issues/5796\n[gh5763]: https://github.com/encode/django-rest-framework/issues/5763\n[gh5777]: https://github.com/encode/django-rest-framework/issues/5777\n[gh5787]: https://github.com/encode/django-rest-framework/issues/5787\n[gh5754]: https://github.com/encode/django-rest-framework/issues/5754\n[gh5783]: https://github.com/encode/django-rest-framework/issues/5783\n[gh5773]: https://github.com/encode/django-rest-framework/issues/5773\n[gh5757]: https://github.com/encode/django-rest-framework/issues/5757\n[gh5752]: https://github.com/encode/django-rest-framework/issues/5752\n[gh5766]: https://github.com/encode/django-rest-framework/issues/5766\n[gh5751]: https://github.com/encode/django-rest-framework/issues/5751\n[gh5654]: https://github.com/encode/django-rest-framework/issues/5654\n[gh5729]: https://github.com/encode/django-rest-framework/issues/5729\n[gh5735]: https://github.com/encode/django-rest-framework/issues/5735\n[gh5739]: https://github.com/encode/django-rest-framework/issues/5739\n[gh5736]: https://github.com/encode/django-rest-framework/issues/5736\n[gh5734]: https://github.com/encode/django-rest-framework/issues/5734\n[gh5733]: https://github.com/encode/django-rest-framework/issues/5733\n[gh5720]: https://github.com/encode/django-rest-framework/issues/5720\n[gh5701]: https://github.com/encode/django-rest-framework/issues/5701\n[gh5700]: https://github.com/encode/django-rest-framework/issues/5700\n[gh5703]: https://github.com/encode/django-rest-framework/issues/5703\n[gh5712]: https://github.com/encode/django-rest-framework/issues/5712\n[gh5709]: https://github.com/encode/django-rest-framework/issues/5709\n[gh5702]: https://github.com/encode/django-rest-framework/issues/5702\n[gh5655]: https://github.com/encode/django-rest-framework/issues/5655\n[gh5713]: https://github.com/encode/django-rest-framework/issues/5713\n[gh5711]: https://github.com/encode/django-rest-framework/issues/5711\n[gh5704]: https://github.com/encode/django-rest-framework/issues/5704\n[gh5854]: https://github.com/encode/django-rest-framework/issues/5854\n[gh5846]: https://github.com/encode/django-rest-framework/issues/5846\n[gh5891]: https://github.com/encode/django-rest-framework/issues/5891\n[gh5849]: https://github.com/encode/django-rest-framework/issues/5849\n[gh5880]: https://github.com/encode/django-rest-framework/issues/5880\n[gh5843]: https://github.com/encode/django-rest-framework/issues/5843\n[gh5872]: https://github.com/encode/django-rest-framework/issues/5872\n[gh5870]: https://github.com/encode/django-rest-framework/issues/5870\n[gh5844]: https://github.com/encode/django-rest-framework/issues/5844\n[gh5837]: https://github.com/encode/django-rest-framework/issues/5837\n[gh5827]: https://github.com/encode/django-rest-framework/issues/5827\n[gh5823]: https://github.com/encode/django-rest-framework/issues/5823\n[gh5809]: https://github.com/encode/django-rest-framework/issues/5809\n[gh5835]: https://github.com/encode/django-rest-framework/issues/5835\n[gh5834]: https://github.com/encode/django-rest-framework/issues/5834\n[gh5833]: https://github.com/encode/django-rest-framework/issues/5833\n[gh5894]: https://github.com/encode/django-rest-framework/issues/5894\n[gh5817]: https://github.com/encode/django-rest-framework/issues/5817\n[gh5815]: https://github.com/encode/django-rest-framework/issues/5815\n[gh5818]: https://github.com/encode/django-rest-framework/issues/5818\n[gh5800]: https://github.com/encode/django-rest-framework/issues/5800\n[gh5676]: https://github.com/encode/django-rest-framework/issues/5676\n[gh5802]: https://github.com/encode/django-rest-framework/issues/5802\n[gh5765]: https://github.com/encode/django-rest-framework/issues/5765\n[gh5764]: https://github.com/encode/django-rest-framework/issues/5764\n[gh5904]: https://github.com/encode/django-rest-framework/issues/5904\n[gh5899]: https://github.com/encode/django-rest-framework/issues/5899\n\n<!-- 3.8.1 -->\n[gh5915]: https://github.com/encode/django-rest-framework/issues/5915\n\n<!-- 3.8.2 -->\n[gh5922]: https://github.com/encode/django-rest-framework/issues/5922\n[gh5921]: https://github.com/encode/django-rest-framework/issues/5921\n[gh5920]: https://github.com/encode/django-rest-framework/issues/5920\n\n<!-- 3.9.0 -->\n[gh6109]: https://github.com/encode/django-rest-framework/issues/6109\n[gh6141]: https://github.com/encode/django-rest-framework/issues/6141\n[gh6113]: https://github.com/encode/django-rest-framework/issues/6113\n[gh6112]: https://github.com/encode/django-rest-framework/issues/6112\n[gh6111]: https://github.com/encode/django-rest-framework/issues/6111\n[gh6028]: https://github.com/encode/django-rest-framework/issues/6028\n[gh5657]: https://github.com/encode/django-rest-framework/issues/5657\n[gh6054]: https://github.com/encode/django-rest-framework/issues/6054\n[gh5993]: https://github.com/encode/django-rest-framework/issues/5993\n[gh5990]: https://github.com/encode/django-rest-framework/issues/5990\n[gh5988]: https://github.com/encode/django-rest-framework/issues/5988\n[gh5785]: https://github.com/encode/django-rest-framework/issues/5785\n[gh5992]: https://github.com/encode/django-rest-framework/issues/5992\n[gh5605]: https://github.com/encode/django-rest-framework/issues/5605\n[gh5982]: https://github.com/encode/django-rest-framework/issues/5982\n[gh5981]: https://github.com/encode/django-rest-framework/issues/5981\n[gh5747]: https://github.com/encode/django-rest-framework/issues/5747\n[gh5643]: https://github.com/encode/django-rest-framework/issues/5643\n[gh5881]: https://github.com/encode/django-rest-framework/issues/5881\n[gh5869]: https://github.com/encode/django-rest-framework/issues/5869\n[gh5878]: https://github.com/encode/django-rest-framework/issues/5878\n[gh5932]: https://github.com/encode/django-rest-framework/issues/5932\n[gh5927]: https://github.com/encode/django-rest-framework/issues/5927\n[gh5942]: https://github.com/encode/django-rest-framework/issues/5942\n[gh5936]: https://github.com/encode/django-rest-framework/issues/5936\n[gh5931]: https://github.com/encode/django-rest-framework/issues/5931\n[gh6183]: https://github.com/encode/django-rest-framework/issues/6183\n[gh6075]: https://github.com/encode/django-rest-framework/issues/6075\n[gh6138]: https://github.com/encode/django-rest-framework/issues/6138\n[gh6081]: https://github.com/encode/django-rest-framework/issues/6081\n[gh6073]: https://github.com/encode/django-rest-framework/issues/6073\n[gh6191]: https://github.com/encode/django-rest-framework/issues/6191\n[gh6060]: https://github.com/encode/django-rest-framework/issues/6060\n[gh6233]: https://github.com/encode/django-rest-framework/issues/6233\n[gh5753]: https://github.com/encode/django-rest-framework/issues/5753\n[gh6229]: https://github.com/encode/django-rest-framework/issues/6229\n\n<!-- 3.9.1 -->\n[gh6330]: https://github.com/encode/django-rest-framework/issues/6330\n[gh6299]: https://github.com/encode/django-rest-framework/issues/6299\n[gh6371]: https://github.com/encode/django-rest-framework/issues/6371\n\n<!-- 3.9.2 -->\n[gh6480]: https://github.com/encode/django-rest-framework/issues/6480\n[gh6240]: https://github.com/encode/django-rest-framework/issues/6240\n[gh6361]: https://github.com/encode/django-rest-framework/issues/6361\n[gh6463]: https://github.com/encode/django-rest-framework/issues/6463\n[gh6472]: https://github.com/encode/django-rest-framework/issues/6472\n[gh6268]: https://github.com/encode/django-rest-framework/issues/6268\n[gh6279]: https://github.com/encode/django-rest-framework/issues/6279\n[gh6282]: https://github.com/encode/django-rest-framework/issues/6282\n[gh6207]: https://github.com/encode/django-rest-framework/issues/6207\n[gh6455]: https://github.com/encode/django-rest-framework/issues/6455\n[gh6422]: https://github.com/encode/django-rest-framework/issues/6422\n[gh6430]: https://github.com/encode/django-rest-framework/issues/6430\n[gh6429]: https://github.com/encode/django-rest-framework/issues/6429\n[gh6340]: https://github.com/encode/django-rest-framework/issues/6340\n[gh6416]: https://github.com/encode/django-rest-framework/issues/6416\n[gh6407]: https://github.com/encode/django-rest-framework/issues/6407\n\n<!-- 3.9.3 -->\n[gh6613]: https://github.com/encode/django-rest-framework/issues/6613\n\n<!-- 3.10.0 -->\n[gh6680]: https://github.com/encode/django-rest-framework/issues/6680\n[gh6317]: https://github.com/encode/django-rest-framework/issues/6317\n[gh6687]: https://github.com/encode/django-rest-framework/issues/6687\n\n<!-- 3.11.0 -->\n[gh6892]: https://github.com/encode/django-rest-framework/issues/6892\n[gh6916]: https://github.com/encode/django-rest-framework/issues/6916\n[gh6865]: https://github.com/encode/django-rest-framework/issues/6865\n[gh6898]: https://github.com/encode/django-rest-framework/issues/6898\n[gh6941]: https://github.com/encode/django-rest-framework/issues/6941\n[gh6944]: https://github.com/encode/django-rest-framework/issues/6944\n[gh6914]: https://github.com/encode/django-rest-framework/issues/6914\n[gh6912]: https://github.com/encode/django-rest-framework/issues/6912\n[gh7018]: https://github.com/encode/django-rest-framework/issues/7018\n[gh6996]: https://github.com/encode/django-rest-framework/issues/6996\n[gh6980]: https://github.com/encode/django-rest-framework/issues/6980\n[gh7059]: https://github.com/encode/django-rest-framework/issues/7059\n[gh6923]: https://github.com/encode/django-rest-framework/issues/6923\n"
  },
  {
    "path": "docs/community/third-party-packages.md",
    "content": "# Third Party Packages\n\n> Software ecosystems […] establish a community that further accelerates the sharing of knowledge, content, issues, expertise and skills.\n>\n> &mdash; [Jan Bosch][cite].\n\n## About Third Party Packages\n\nThird Party Packages allow developers to share code that extends the functionality of Django REST framework, in order to support additional use-cases.\n\nWe **support**, **encourage** and **strongly favor** the creation of Third Party Packages to encapsulate new behavior rather than adding additional functionality directly to Django REST Framework.\n\nWe aim to make creating third party packages as easy as possible, whilst keeping a **simple** and **well maintained** core API. By promoting third party packages we ensure that the responsibility for a package remains with its author. If a package proves suitably popular it can always be considered for inclusion into the core REST framework.\n\nIf you have an idea for a new feature please consider how it may be packaged as a Third Party Package. We're always happy to discuss ideas on the [Mailing List][discussion-group].\n\n## Creating a Third Party Package\n\n### Version compatibility\n\nSometimes, in order to ensure your code works on various different versions of Django, Python or third party libraries, you'll need to run slightly different code depending on the environment. Any code that branches in this way should be isolated into a `compat.py` module, and should provide a single common interface that the rest of the codebase can use.\n\nCheck out Django REST framework's [compat.py][drf-compat] for an example.\n\n### Once your package is available\n\nOnce your package is decently documented and available on PyPI, you might want share it with others that might find it useful.\n\n#### Adding to the Django REST framework grid\n\nWe suggest adding your package to the [REST Framework][rest-framework-grid] grid on Django Packages.\n\n#### Adding to the Django REST framework docs\n\nCreate a [Pull Request][drf-create-pr] on GitHub, and we'll add a link to it from the main REST framework documentation. You can add your package under **Third party packages** of the API Guide section that best applies, like [Authentication][authentication] or [Permissions][permissions]. You can also link your package under the [Third Party Packages][third-party-packages] section.\n\n#### Announce on the discussion group.\n\nYou can also let others know about your package through the [discussion group][discussion-group].\n\n## Existing Third Party Packages\n\nDjango REST Framework has a growing community of developers, packages, and resources.\n\nCheck out a grid detailing all the packages and ecosystem around Django REST Framework at [Django Packages][rest-framework-grid].\n\nTo submit new content, [create a pull request][drf-create-pr].\n\n### Async Support\n\n*  [adrf](https://github.com/em1208/adrf) - Async support, provides async Views, ViewSets, and Serializers.\n\n### Authentication\n\n* [djangorestframework-digestauth][djangorestframework-digestauth] - Provides Digest Access Authentication support.\n* [django-oauth-toolkit][django-oauth-toolkit] - Provides OAuth 2.0 support.\n* [djangorestframework-simplejwt][djangorestframework-simplejwt] - Provides JSON Web Token Authentication support.\n* [hawkrest][hawkrest] - Provides Hawk HTTP Authorization.\n* [djangorestframework-httpsignature][djangorestframework-httpsignature] - Provides an easy to use HTTP Signature Authentication mechanism.\n* [djoser][djoser] - Provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation.\n* [DRF Auth Kit][drf-auth-kit] - Provides complete REST authentication with JWT cookies, social login, MFA, and user management. Features full type safety and automatic OpenAPI schema generation.\n* [dj-rest-auth][dj-rest-auth] - Provides a set of REST API endpoints for registration, authentication (including social media authentication), password reset, retrieve and update user details, etc.\n* [drf-oidc-auth][drf-oidc-auth] - Implements OpenID Connect token authentication for DRF.\n* [drfpasswordless][drfpasswordless] - Adds (Medium, Square Cash inspired) passwordless logins and signups via email and mobile numbers.\n* [django-rest-authemail][django-rest-authemail] - Provides a RESTful API for user signup and authentication using email addresses.\n* [dango-pyoidc][django-pyoidc] adds support for OpenID Connect (OIDC) authentication.\n\n### Permissions\n\n* [drf-any-permissions][drf-any-permissions] - Provides alternative permission handling.\n* [djangorestframework-composed-permissions][djangorestframework-composed-permissions] - Provides a simple way to define complex permissions.\n* [rest_condition][rest-condition] - Another extension for building complex permissions in a simple and convenient way.\n* [dry-rest-permissions][dry-rest-permissions] - Provides a simple way to define permissions for individual api actions.\n* [drf-access-policy][drf-access-policy] - Declarative and flexible permissions inspired by AWS' IAM policies.\n* [drf-psq][drf-psq] - An extension that gives support for having action-based **permission_classes**, **serializer_class**, and **queryset** dependent on permission-based rules.\n* [axioms-drf-py][axioms-drf-py] - Supports authentication and claim-based fine-grained authorization (**scopes**, **roles**, **groups**, **permissions**, etc. including object-level checks) using JWT tokens issued by an OAuth2/OIDC Authorization Server. \n\n### Serializers\n\n* [django-rest-framework-mongoengine][django-rest-framework-mongoengine] - Serializer class that supports using MongoDB as the storage layer for Django REST framework.\n* [djangorestframework-gis][djangorestframework-gis] - Geographic add-ons\n* [django-pydantic-field][django-pydantic-field] - Provides a way to use Pydantic models as schemas for Django's JSONField with full support for Pydantic v1 and v2, type safety and integration with Django REST Framework.\n* [drf-pydantic][drf-pydantic] - Use Pydantic with Django REST framework for data validation and (de)serialization.\n* [djangorestframework-hstore][djangorestframework-hstore] - Serializer class to support django-hstore DictionaryField model field and its schema-mode feature.\n* [djangorestframework-jsonapi][djangorestframework-jsonapi] - Provides a parser, renderer, serializers, and other tools to help build an API that is compliant with the jsonapi.org spec.\n* [html-json-forms][html-json-forms] - Provides an algorithm and serializer to process HTML JSON Form submissions per the (inactive) spec.\n* [django-rest-framework-serializer-extensions][drf-serializer-extensions] -\n  Enables black/whitelisting fields, and conditionally expanding child serializers on a per-view/request basis.\n* [djangorestframework-queryfields][djangorestframework-queryfields] - Serializer mixin allowing clients to control which fields will be sent in the API response.\n* [drf-flex-fields][drf-flex-fields] - Serializer providing dynamic field expansion and sparse field sets via URL parameters.\n* [drf-action-serializer][drf-action-serializer] - Serializer providing per-action fields config for use with ViewSets to prevent having to write multiple serializers.\n* [djangorestframework-dataclasses][djangorestframework-dataclasses] - Serializer providing automatic field generation for Python dataclasses, like the built-in ModelSerializer does for models.\n* [django-restql][django-restql] - Turn your REST API into a GraphQL like API(It allows clients to control which fields will be sent in a response, uses GraphQL like syntax, supports read and write on both flat and nested fields).\n* [graphwrap][graphwrap] - Transform your REST API into a fully compliant GraphQL API with just two lines of code. Leverages [Graphene-Django](https://docs.graphene-python.org/projects/django/en/latest/) to dynamically build, at runtime, a GraphQL ObjectType for each view in your API.\n* [drf-shapeless-serializers][drf-shapeless-serializers] - Dynamically assemble, configure, and shape your Django Rest Framework serializers at runtime, much like connecting Lego bricks.\n\n### Serializer fields\n\n* [drf-compound-fields][drf-compound-fields] - Provides \"compound\" serializer fields, such as lists of simple values.\n* [drf-extra-fields][drf-extra-fields] - Provides extra serializer fields.\n* [django-versatileimagefield][django-versatileimagefield] - Provides a drop-in replacement for Django's stock `ImageField` that makes it easy to serve images in multiple sizes/renditions from a single field. For DRF-specific implementation docs, [click here][django-versatileimagefield-drf-docs].\n\n### Views\n\n* [django-rest-multiple-models][django-rest-multiple-models] - Provides a generic view (and mixin) for sending multiple serialized models and/or querysets via a single API request.\n* [drf-typed-views][drf-typed-views] - Use Python type annotations to validate/deserialize request parameters. Inspired by API Star, Hug and FastAPI.\n* [rest-framework-actions][rest-framework-actions] - Provides control over each action in ViewSets. Serializers per action, method.\n\n### Routers\n\n* [drf-nested-routers][drf-nested-routers] - Provides routers and relationship fields for working with nested resources.\n* [wq.db.rest][wq.db.rest] - Provides an admin-style model registration API with reasonable default URLs and viewsets.\n\n### Parsers\n\n* [djangorestframework-msgpack][djangorestframework-msgpack] - Provides MessagePack renderer and parser support.\n* [djangorestframework-jsonapi][djangorestframework-jsonapi] - Provides a parser, renderer, serializers, and other tools to help build an API that is compliant with the jsonapi.org spec.\n* [djangorestframework-camel-case][djangorestframework-camel-case] - Provides camel case JSON renderers and parsers.\n* [nested-multipart-parser][nested-multipart-parser] - Provides nested parser for http multipart request\n\n### Renderers\n\n* [djangorestframework-csv][djangorestframework-csv] - Provides CSV renderer support.\n* [djangorestframework-jsonapi][djangorestframework-jsonapi] - Provides a parser, renderer, serializers, and other tools to help build an API that is compliant with the jsonapi.org spec.\n* [drf_ujson2][drf_ujson2] - Implements JSON rendering using the UJSON package.\n* [rest-pandas][rest-pandas] - Pandas DataFrame-powered renderers including Excel, CSV, and SVG formats.\n* [djangorestframework-rapidjson][djangorestframework-rapidjson] - Provides rapidjson support with parser and renderer.\n\n### Filtering\n\n* [djangorestframework-chain][djangorestframework-chain] - Allows arbitrary chaining of both relations and lookup filters.\n* [django-url-filter][django-url-filter] - Allows a safe way to filter data via human-friendly URLs. It is a generic library which is not tied to DRF but it provides easy integration with DRF.\n* [drf-url-filter][drf-url-filter] is a simple Django app to apply filters on drf `ModelViewSet`'s `Queryset` in a clean, simple and configurable way. It also supports validations on incoming query params and their values.\n* [django-rest-framework-guardian][django-rest-framework-guardian] - Provides integration with django-guardian, including the `DjangoObjectPermissionsFilter` previously found in DRF.\n\n### Misc\n\n* [drf-sendables][drf-sendables] - User messages for Django REST Framework\n* [cookiecutter-django-rest][cookiecutter-django-rest] - A cookiecutter template that takes care of the setup and configuration so you can focus on making your REST apis awesome.\n* [djangorestrelationalhyperlink][djangorestrelationalhyperlink] - A hyperlinked serializer that can can be used to alter relationships via hyperlinks, but otherwise like a hyperlink model serializer.\n* [django-rest-framework-proxy][django-rest-framework-proxy] - Proxy to redirect incoming request to another API server.\n* [gaiarestframework][gaiarestframework] - Utils for django-rest-framework\n* [drf-extensions][drf-extensions] - A collection of custom extensions\n* [ember-django-adapter][ember-django-adapter] - An adapter for working with Ember.js\n* [django-versatileimagefield][django-versatileimagefield] - Provides a drop-in replacement for Django's stock `ImageField` that makes it easy to serve images in multiple sizes/renditions from a single field. For DRF-specific implementation docs, [click here][django-versatileimagefield-drf-docs].\n* [drf-tracking][drf-tracking] - Utilities to track requests to DRF API views.\n* [drf_tweaks][drf_tweaks] - Serializers with one-step validation (and more), pagination without counts and other tweaks.\n* [django-rest-framework-braces][django-rest-framework-braces] - Collection of utilities for working with Django Rest Framework. The most notable ones are [FormSerializer](https://django-rest-framework-braces.readthedocs.io/en/latest/overview.html#formserializer) and [SerializerForm](https://django-rest-framework-braces.readthedocs.io/en/latest/overview.html#serializerform), which are adapters between DRF serializers and Django forms.\n* [drf-haystack][drf-haystack] - Haystack search for Django Rest Framework\n* [django-rest-framework-version-transforms][django-rest-framework-version-transforms] - Enables the use of delta transformations for versioning of DRF resource representations.\n* [django-rest-messaging][django-rest-messaging], [django-rest-messaging-centrifugo][django-rest-messaging-centrifugo] and [django-rest-messaging-js][django-rest-messaging-js] - A real-time pluggable messaging service using DRM.\n* [djangorest-alchemy][djangorest-alchemy] - SQLAlchemy support for REST framework.\n* [djangorestframework-datatables][djangorestframework-datatables] - Seamless integration between Django REST framework and [Datatables](https://datatables.net).\n* [django-rest-framework-condition][django-rest-framework-condition] - Decorators for managing HTTP cache headers for Django REST framework (ETag and Last-modified).\n* [django-rest-witchcraft][django-rest-witchcraft] - Provides DRF integration with SQLAlchemy with SQLAlchemy model serializers/viewsets and a bunch of other goodies\n* [djangorestframework-mvt][djangorestframework-mvt] - An extension for creating views that serve Postgres data as Map Box Vector Tiles.\n* [drf-viewset-profiler][drf-viewset-profiler] - Lib to profile all methods from a viewset line by line.\n* [djangorestframework-features][djangorestframework-features] - Advanced schema generation and more based on named features.\n* [django-elasticsearch-dsl-drf][django-elasticsearch-dsl-drf] - Integrate Elasticsearch DSL with Django REST framework. Package provides views, serializers, filter backends, pagination and other handy add-ons.\n* [django-lisan][django-lisan] - A lightweight translation and localization framework for Django REST Framework APIs.\n* [django-api-client][django-api-client] - DRF client that groups the Endpoint response, for use in CBVs and FBV as if you were working with Django's Native Models..\n* [fast-drf] - A model based library for making API development faster and easier.\n* [django-requestlogs] - Providing middleware and other helpers for audit logging for REST framework.\n* [drf-standardized-errors][drf-standardized-errors] - DRF exception handler to standardize error responses for all API endpoints.\n* [drf-api-action][drf-api-action] - uses the power of DRF also as a library functions\n* [apitally] - A simple API monitoring, analytics, and request logging tool using middleware. For DRF-specific setup guide, [click here](https://docs.apitally.io/frameworks/django-rest-framework).\n* [wireup][wireup] - Dependency injection container with Django integration support. For integration docs, [click here][wireup-django-docs].\n\n### Customization\n\n* [drf-restwind][drf-restwind] - a modern re-imagining of the Django REST Framework utilizes TailwindCSS and DaisyUI to provide flexible and customizable UI solutions with minimal coding effort.\n* [drf-redesign][drf-redesign] - A project that gives a fresh look to the browse-able API using Bootstrap 5.\n* [drf-material][drf-material] - A project that gives a sleek and elegant look to the browsable API using Material Design.\n\n[drf-sendables]: https://github.com/amikrop/drf-sendables\n[cite]: http://www.software-ecosystems.com/Software_Ecosystems/Ecosystems.html\n[cookiecutter]: https://github.com/jpadilla/cookiecutter-django-rest-framework\n[new-repo]: https://github.com/new\n[create-a-repo]: https://help.github.com/articles/create-a-repo/\n[pypi-register]: https://pypi.org/account/register/\n[semver]: https://semver.org/\n[tox-docs]: https://tox.readthedocs.io/en/latest/\n[drf-compat]: https://github.com/encode/django-rest-framework/blob/main/rest_framework/compat.py\n[rest-framework-grid]: https://www.djangopackages.com/grids/g/django-rest-framework/\n[drf-create-pr]: https://github.com/encode/django-rest-framework/compare\n[authentication]: ../api-guide/authentication.md\n[permissions]: ../api-guide/permissions.md\n[third-party-packages]: #existing-third-party-packages\n[discussion-group]: https://groups.google.com/forum/#!forum/django-rest-framework\n[drf-auth-kit]: https://github.com/huynguyengl99/drf-auth-kit\n[djangorestframework-digestauth]: https://github.com/juanriaza/django-rest-framework-digestauth\n[django-oauth-toolkit]: https://github.com/evonove/django-oauth-toolkit\n[djangorestframework-jwt]: https://github.com/GetBlimp/django-rest-framework-jwt\n[djangorestframework-simplejwt]: https://github.com/davesque/django-rest-framework-simplejwt\n[hawkrest]: https://github.com/kumar303/hawkrest\n[djangorestframework-httpsignature]: https://github.com/etoccalino/django-rest-framework-httpsignature\n[djoser]: https://github.com/sunscrapers/djoser\n[drf-any-permissions]: https://github.com/kevin-brown/drf-any-permissions\n[djangorestframework-composed-permissions]: https://github.com/niwibe/djangorestframework-composed-permissions\n[rest-condition]: https://github.com/caxap/rest_condition\n[django-rest-framework-mongoengine]: https://github.com/umutbozkurt/django-rest-framework-mongoengine\n[djangorestframework-gis]: https://github.com/djangonauts/django-rest-framework-gis\n[djangorestframework-hstore]: https://github.com/djangonauts/django-rest-framework-hstore\n[drf-compound-fields]: https://github.com/estebistec/drf-compound-fields\n[drf-extra-fields]: https://github.com/Hipo/drf-extra-fields\n[django-rest-multiple-models]: https://github.com/MattBroach/DjangoRestMultipleModels\n[drf-nested-routers]: https://github.com/alanjds/drf-nested-routers\n[wq.db.rest]: https://wq.io/docs/about-rest\n[djangorestframework-msgpack]: https://github.com/juanriaza/django-rest-framework-msgpack\n[djangorestframework-camel-case]: https://github.com/vbabiy/djangorestframework-camel-case\n[nested-multipart-parser]: https://github.com/remigermain/nested-multipart-parser\n[djangorestframework-csv]: https://github.com/mjumbewu/django-rest-framework-csv\n[drf_ujson2]: https://github.com/Amertz08/drf_ujson2\n[rest-pandas]: https://github.com/wq/django-rest-pandas\n[djangorestframework-rapidjson]: https://github.com/allisson/django-rest-framework-rapidjson\n[djangorestframework-chain]: https://github.com/philipn/django-rest-framework-chain\n[djangorestrelationalhyperlink]: https://github.com/fredkingham/django_rest_model_hyperlink_serializers_project\n[django-rest-framework-proxy]: https://github.com/eofs/django-rest-framework-proxy\n[gaiarestframework]: https://github.com/AppsFuel/gaiarestframework\n[drf-extensions]: https://github.com/chibisov/drf-extensions\n[ember-django-adapter]: https://github.com/dustinfarris/ember-django-adapter\n[dj-rest-auth]: https://github.com/iMerica/dj-rest-auth\n[django-versatileimagefield]: https://github.com/WGBH/django-versatileimagefield\n[django-versatileimagefield-drf-docs]:https://django-versatileimagefield.readthedocs.io/en/latest/drf_integration.html\n[drf-tracking]: https://github.com/aschn/drf-tracking\n[django-rest-framework-braces]: https://github.com/dealertrack/django-rest-framework-braces\n[dry-rest-permissions]: https://github.com/FJNR-inc/dry-rest-permissions\n[django-url-filter]: https://github.com/miki725/django-url-filter\n[drf-url-filter]: https://github.com/manjitkumar/drf-url-filters\n[cookiecutter-django-rest]: https://github.com/agconti/cookiecutter-django-rest\n[drf-haystack]: https://drf-haystack.readthedocs.io/en/latest/\n[django-rest-framework-version-transforms]: https://github.com/mrhwick/django-rest-framework-version-transforms\n[djangorestframework-jsonapi]: https://github.com/django-json-api/django-rest-framework-json-api\n[html-json-forms]: https://github.com/wq/html-json-forms\n[django-rest-messaging]: https://github.com/raphaelgyory/django-rest-messaging\n[django-rest-messaging-centrifugo]: https://github.com/raphaelgyory/django-rest-messaging-centrifugo\n[django-rest-messaging-js]: https://github.com/raphaelgyory/django-rest-messaging-js\n[drf_tweaks]: https://github.com/ArabellaTech/drf_tweaks\n[drf-oidc-auth]: https://github.com/ByteInternet/drf-oidc-auth\n[drf-serializer-extensions]: https://github.com/evenicoulddoit/django-rest-framework-serializer-extensions\n[djangorestframework-queryfields]: https://github.com/wimglenn/djangorestframework-queryfields\n[drfpasswordless]: https://github.com/aaronn/django-rest-framework-passwordless\n[djangorest-alchemy]: https://github.com/dealertrack/djangorest-alchemy\n[djangorestframework-datatables]: https://github.com/izimobil/django-rest-framework-datatables\n[django-rest-framework-condition]: https://github.com/jozo/django-rest-framework-condition\n[django-rest-witchcraft]: https://github.com/shosca/django-rest-witchcraft\n[drf-access-policy]: https://github.com/rsinger86/drf-access-policy\n[drf-flex-fields]: https://github.com/rsinger86/drf-flex-fields\n[drf-typed-views]: https://github.com/rsinger86/drf-typed-views\n[drf-action-serializer]: https://github.com/gregschmit/drf-action-serializer\n[djangorestframework-dataclasses]: https://github.com/oxan/djangorestframework-dataclasses\n[django-restql]: https://github.com/yezyilomo/django-restql\n[djangorestframework-mvt]: https://github.com/corteva/djangorestframework-mvt\n[django-rest-framework-guardian]: https://github.com/rpkilby/django-rest-framework-guardian\n[drf-viewset-profiler]: https://github.com/fvlima/drf-viewset-profiler\n[djangorestframework-features]: https://github.com/cloudcode-hungary/django-rest-framework-features/\n[django-elasticsearch-dsl-drf]: https://github.com/barseghyanartur/django-elasticsearch-dsl-drf\n[django-api-client]: https://github.com/rhenter/django-api-client\n[drf-psq]: https://github.com/drf-psq/drf-psq\n[django-rest-authemail]: https://github.com/celiao/django-rest-authemail\n[graphwrap]: https://github.com/PaulGilmartin/graph_wrap\n[rest-framework-actions]: https://github.com/AlexisMunera98/rest-framework-actions\n[fast-drf]: https://github.com/iashraful/fast-drf\n[wireup]: https://github.com/maldoinc/wireup\n[wireup-django-docs]: https://maldoinc.github.io/wireup/latest/integrations/django/\n[django-requestlogs]: https://github.com/Raekkeri/django-requestlogs\n[drf-standardized-errors]: https://github.com/ghazi-git/drf-standardized-errors\n[drf-api-action]: https://github.com/Ori-Roza/drf-api-action\n[drf-restwind]: https://github.com/youzarsiph/drf-restwind\n[drf-redesign]: https://github.com/youzarsiph/drf-redesign\n[drf-material]: https://github.com/youzarsiph/drf-material\n[django-pyoidc]: https://github.com/makinacorpus/django_pyoidc\n[apitally]: https://github.com/apitally/apitally-py\n[drf-shapeless-serializers]: https://github.com/khaledsukkar2/drf-shapeless-serializers\n[django-lisan]: https://github.com/Nabute/django-lisan\n[axioms-drf-py]: https://github.com/abhishektiwari/axioms-drf-py\n[django-pydantic-field]: https://github.com/surenkov/django-pydantic-field\n[drf-pydantic]: https://github.com/georgebv/drf-pydantic\n"
  },
  {
    "path": "docs/community/tutorials-and-resources.md",
    "content": "# Tutorials and Resources\n\nThere are a wide range of resources available for learning and using Django REST framework. We try to keep a comprehensive list available here.\n\n## Books\n\n<div class=\"book-covers\">\n  <a class=\"book-cover\" href=\"https://hellowebapp.com/order/\">\n    <img src=\"../../img/books/hwa-cover.png\" style=\"height: 300px\"/>\n  </a>\n  <a class=\"book-cover\" href=\"https://www.twoscoopspress.com/products/two-scoops-of-django-1-11\">\n    <img src=\"../../img/books/tsd-cover.png\" style=\"height: 300px\"/>\n  </a>\n  <a class=\"book-cover\" href=\"https://djangoforapis.com\">\n    <img src=\"../../img/books/dfa-40-cover.jpg\" style=\"height: 300px\"/>\n  </a>\n</div>\n\n## Courses\n\n* [Developing RESTful APIs with Django REST Framework][developing-restful-apis-with-django-rest-framework]\n\n## Tutorials\n\n* [Beginner's Guide to the Django REST Framework][beginners-guide-to-the-django-rest-framework]\n* [Django REST Framework - An Introduction][drf-an-intro]\n* [Django REST Framework Tutorial][drf-tutorial]\n* [Building a RESTful API with Django REST Framework][building-a-restful-api-with-drf]\n* [Getting Started with Django REST Framework and AngularJS][getting-started-with-django-rest-framework-and-angularjs]\n* [End to End Web App with Django REST Framework & AngularJS][end-to-end-web-app-with-django-rest-framework-angularjs]\n* [Start Your API - Django REST Framework Part 1][start-your-api-django-rest-framework-part-1]\n* [Permissions & Authentication - Django REST Framework Part 2][permissions-authentication-django-rest-framework-part-2]\n* [ViewSets and Routers - Django REST Framework Part 3][viewsets-and-routers-django-rest-framework-part-3]\n* [Django REST Framework User Endpoint][django-rest-framework-user-endpoint]\n* [Check Credentials Using Django REST Framework][check-credentials-using-django-rest-framework]\n* [Creating a Production Ready API with Python and Django REST Framework – Part 1][creating-a-production-ready-api-with-python-and-drf-part1]\n* [Creating a Production Ready API with Python and Django REST Framework – Part 2][creating-a-production-ready-api-with-python-and-drf-part2]\n* [Creating a Production Ready API with Python and Django REST Framework – Part 3][creating-a-production-ready-api-with-python-and-drf-part3]\n* [Creating a Production Ready API with Python and Django REST Framework – Part 4][creating-a-production-ready-api-with-python-and-drf-part4]\n* [Django Polls Tutorial API][django-polls-api]\n* [Django REST Framework Tutorial: Todo API][django-rest-framework-todo-api]\n* [Tutorial: Django REST with React (Django 2.0)][django-rest-react-valentinog]\n* [Building APIs with Django and Django REST framework](https://books.agiliq.com/projects/django-api-polls-tutorial/en/latest/)\n\n## Videos\n\n### Talks\n\n* [Level Up! Rethinking the Web API Framework][pycon-us-2017]\n* [How to Make a Full Fledged REST API with Django OAuth Toolkit][full-fledged-rest-api-with-django-oauth-toolkit]\n* [Django REST API - So Easy You Can Learn It in 25 Minutes][django-rest-api-so-easy]\n* [Tom Christie about Django Rest Framework at Django: Under The Hood][django-under-hood-2014]\n* [Django REST Framework: Schemas, Hypermedia & Client Libraries][pycon-uk-2016]\n* [Finally Understand Authentication in Django REST Framework][django-con-2018]\n\n### Tutorials\n\n\n* [Django REST Framework Part 1][django-rest-framework-part-1-video]\n* [Django REST Framework in Your PJ's!][drf-in-your-pjs]\n* [Building a REST API Using Django & Django REST Framework][building-a-rest-api-using-django-and-drf]\n* [Blog API with Django REST Framework][blog-api-with-drf]\n* [Ember and Django Part 1][ember-and-django-part 1-video]\n* [Django REST Framework Image Upload Tutorial (with AngularJS)][drf-image-upload-tutorial-with-angularjs]\n* [Django REST Framework Tutorials][drf-tutorials]\n\n\n## Articles\n\n* [Web API performance: Profiling Django REST Framework][web-api-performance-profiling-django-rest-framework]\n* [API Development with Django and Django REST Framework][api-development-with-django-and-django-rest-framework]\n* [Integrating Pandas, Django REST Framework and Bokeh][integrating-pandas-drf-and-bokeh]\n* [Controlling Uncertainty on Web Applications and APIs][controlling-uncertainty-on-web-apps-and-apis]\n* [Full Text Search in Django REST Framework with Database Backends][full-text-search-in-drf]\n* [OAuth2 Authentication with Django REST Framework and Custom Third-Party OAuth2 Backends][oauth2-authentication-with-drf]\n* [Nested Resources with Django REST Framework][nested-resources-with-drf]\n* [Image Fields with Django REST Framework][image-fields-with-drf]\n* [Chatbot Using Django REST Framework + api.ai + Slack - Part 1/3][chatbot-using-drf-part1]\n* [New Django Admin with DRF and EmberJS... What are the News?][new-django-admin-with-drf-and-emberjs]\n* [Blog posts about Django REST Framework][medium-django-rest-framework]\n* [Implementing Rest APIs With Embedded Privacy][doordash-implementing-rest-apis]\n\n## Documentations\n* [Classy Django REST Framework][cdrf.co]\n* [DRF-schema-adapter][drf-schema]\n\nWant your Django REST Framework talk/tutorial/article to be added to our website? Or know of a resource that's not yet included here? Please [submit a pull request][submit-pr] or [email us][anna-email]!\n\n\n[beginners-guide-to-the-django-rest-framework]: https://code.tutsplus.com/tutorials/beginners-guide-to-the-django-rest-framework--cms-19786\n[getting-started-with-django-rest-framework-and-angularjs]: https://blog.kevinastone.com/django-rest-framework-and-angular-js\n[end-to-end-web-app-with-django-rest-framework-angularjs]: https://mourafiq.com/2013/07/01/end-to-end-web-app-with-django-angular-1.html\n[start-your-api-django-rest-framework-part-1]: https://www.youtube.com/watch?v=hqo2kk91WpE\n[permissions-authentication-django-rest-framework-part-2]: https://www.youtube.com/watch?v=R3xvUDUZxGU\n[viewsets-and-routers-django-rest-framework-part-3]: https://www.youtube.com/watch?v=2d6w4DGQ4OU\n[django-rest-framework-user-endpoint]: https://richardtier.com/2014/02/25/django-rest-framework-user-endpoint/\n[check-credentials-using-django-rest-framework]: https://richardtier.com/2014/03/06/110/\n[ember-and-django-part 1-video]: http://www.neckbeardrepublic.com/screencasts/ember-and-django-part-1\n[django-rest-framework-part-1-video]: http://www.neckbeardrepublic.com/screencasts/django-rest-framework-part-1\n[web-api-performance-profiling-django-rest-framework]: https://www.dabapps.com/blog/api-performance-profiling-django-rest-framework/\n[api-development-with-django-and-django-rest-framework]: https://bnotions.com/news-and-insights/api-development-with-django-and-django-rest-framework/\n[cdrf.co]:http://www.cdrf.co\n[medium-django-rest-framework]: https://medium.com/django-rest-framework\n[pycon-uk-2016]: https://www.youtube.com/watch?v=FjmiGh7OqVg\n[django-under-hood-2014]: https://www.youtube.com/watch?v=3cSsbe-tA0E\n[integrating-pandas-drf-and-bokeh]: https://web.archive.org/web/20180104205117/http://machinalis.com/blog/pandas-django-rest-framework-bokeh/\n[controlling-uncertainty-on-web-apps-and-apis]: https://web.archive.org/web/20180104205043/https://machinalis.com/blog/controlling-uncertainty-on-web-applications-and-apis/\n[full-text-search-in-drf]: https://web.archive.org/web/20180104205059/http://machinalis.com/blog/full-text-search-on-django-rest-framework/\n[oauth2-authentication-with-drf]: https://web.archive.org/web/20180104205054/http://machinalis.com/blog/oauth2-authentication/\n[nested-resources-with-drf]: https://web.archive.org/web/20180104205109/http://machinalis.com/blog/nested-resources-with-django/\n[image-fields-with-drf]: https://web.archive.org/web/20180104205048/http://machinalis.com/blog/image-fields-with-django-rest-framework/\n[chatbot-using-drf-part1]: https://chatbotslife.com/chatbot-using-django-rest-framework-api-ai-slack-part-1-3-69c7e38b7b1e#.g2aceuncf\n[new-django-admin-with-drf-and-emberjs]: https://blog.levit.be/new-django-admin-with-emberjs-what-are-the-news/\n[drf-schema]: https://drf-schema-adapter.readthedocs.io/en/latest/\n[creating-a-production-ready-api-with-python-and-drf-part1]: https://www.andreagrandi.it/posts/creating-production-ready-api-python-django-rest-framework-part-1/\n[creating-a-production-ready-api-with-python-and-drf-part2]: https://www.andreagrandi.it/posts/creating-a-production-ready-api-with-python-and-django-rest-framework-part-2/\n[creating-a-production-ready-api-with-python-and-drf-part3]: https://www.andreagrandi.it/posts/creating-a-production-ready-api-with-python-and-django-rest-framework-part-3/\n[creating-a-production-ready-api-with-python-and-drf-part4]: https://www.andreagrandi.it/posts/creating-a-production-ready-api-with-python-and-django-rest-framework-part-4/\n[django-polls-api]: https://learndjango.com/tutorials/django-polls-tutorial-api\n[django-rest-framework-todo-api]: https://learndjango.com/tutorials/django-rest-framework-tutorial-todo-api\n[django-rest-api-so-easy]: https://www.youtube.com/watch?v=cqP758k1BaQ\n[full-fledged-rest-api-with-django-oauth-toolkit]: https://www.youtube.com/watch?v=M6Ud3qC2tTk\n[drf-in-your-pjs]: https://www.youtube.com/watch?v=xMtHsWa72Ww\n[building-a-rest-api-using-django-and-drf]: https://www.youtube.com/watch?v=PwssEec3IRw\n[drf-tutorials]: https://www.youtube.com/watch?v=axRCBgbOJp8&list=PLJtp8Jm8EDzjgVg9vVyIUMoGyqtegj7FH\n[drf-image-upload-tutorial-with-angularjs]: https://www.youtube.com/watch?v=hMiNTCIY7dw&list=PLUe5s-xycYk_X0vDjYBmKuIya2a2myF8O\n[blog-api-with-drf]: https://www.youtube.com/watch?v=XMu0T6L2KRQ&list=PLEsfXFp6DpzTOcOVdZF-th7BS_GYGguAS\n[drf-an-intro]: https://realpython.com/blog/python/django-rest-framework-quick-start/\n[drf-tutorial]: https://tests4geeks.com/django-rest-framework-tutorial/\n[building-a-restful-api-with-drf]: https://agiliq.com/blog/2014/12/building-a-restful-api-with-django-rest-framework/\n[submit-pr]: https://github.com/encode/django-rest-framework\n[anna-email]: mailto:anna@django-rest-framework.org\n[pycon-us-2017]: https://www.youtube.com/watch?v=Rk6MHZdust4\n[django-rest-react-valentinog]: https://www.valentinog.com/blog/tutorial-api-django-rest-react/\n[doordash-implementing-rest-apis]: https://doordash.engineering/2013/10/07/implementing-rest-apis-with-embedded-privacy/\n[developing-restful-apis-with-django-rest-framework]: https://testdriven.io/courses/django-rest-framework/\n[django-con-2018]: https://youtu.be/pY-oje5b5Qk?si=AOU6tLi0IL1_pVzq\n"
  },
  {
    "path": "docs/index.md",
    "content": "---\nhide:\n  - navigation\n---\n\n<style>\n.promo li a {\n    float: left;\n    width: 130px;\n    height: 20px;\n    text-align: center;\n    margin: 10px 30px;\n    padding: 150px 0 0 0;\n    background-position: 0 50%;\n    background-size: 130px auto;\n    background-repeat: no-repeat;\n    font-size: 120%;\n    color: black;\n}\n.promo li {\n    list-style: none;\n}\n</style>\n\n<div class=\"badges\">\n    <iframe src=\"https://ghbtns.com/github-btn.html?user=encode&amp;repo=django-rest-framework&amp;type=watch&amp;count=true\" class=\"github-star-button\" allowtransparency=\"true\" frameborder=\"0\" scrolling=\"0\" width=\"110px\" height=\"20px\"></iframe>\n\n    <a href=\"https://github.com/encode/django-rest-framework/actions/workflows/main.yml\">\n        <img src=\"https://github.com/encode/django-rest-framework/actions/workflows/main.yml/badge.svg\" class=\"status-badge\">\n    </a>\n\n    <a href=\"https://pypi.org/project/djangorestframework/\">\n        <img src=\"https://img.shields.io/pypi/v/djangorestframework.svg\" class=\"status-badge\">\n    </a>\n</div>\n\n---\n\n<h1 style=\"position: absolute;\n    width: 1px;\n    height: 1px;\n    padding: 0;\n    margin: -1px;\n    overflow: hidden;\n    clip: rect(0,0,0,0);\n    border: 0;\">Django REST Framework</h1>\n\n![Django REST Framework](img/logo-light.png#only-light)\n![Django REST Framework](img/logo-dark.png#only-dark)\n\nDjango REST framework is a powerful and flexible toolkit for building Web APIs.\n\nSome reasons you might want to use REST framework:\n\n* The Web browsable API is a huge usability win for your developers.\n* [Authentication policies][authentication] including packages for [OAuth1a][oauth1-section] and [OAuth2][oauth2-section].\n* [Serialization][serializers] that supports both [ORM][modelserializer-section] and [non-ORM][serializer-section] data sources.\n* Customizable all the way down - just use [regular function-based views][functionview-section] if you don't need the [more][generic-views] [powerful][viewsets] [features][routers].\n* Extensive documentation, and [great community support][group].\n* Used and trusted by internationally recognized companies including [Mozilla][mozilla], [Red Hat][redhat], [Heroku][heroku], and [Eventbrite][eventbrite].\n\n---\n\n## Requirements\n\nREST framework requires the following:\n\n* Django (4.2, 5.0, 5.1, 5.2, 6.0)\n* Python (3.10, 3.11, 3.12, 3.13, 3.14)\n\nWe **highly recommend** and only officially support the latest patch release of\neach Python and Django series.\n\nThe following packages are optional:\n\n* [PyYAML][pyyaml], [uritemplate][uritemplate] (5.1+, 3.0.0+) - Schema generation support.\n* [Markdown][markdown] (3.3.0+) - Markdown support for the browsable API.\n* [Pygments][pygments] (2.7.0+) - Add syntax highlighting to Markdown processing.\n* [django-filter][django-filter] (1.0.1+) - Filtering support.\n* [django-guardian][django-guardian] (1.1.1+) - Object level permissions support.\n\n## Installation\n\nInstall using `pip`, including any optional packages you want...\n\n```bash\npip install djangorestframework\npip install markdown       # Markdown support for the browsable API.\npip install django-filter  # Filtering support\n```\n\n...or clone the project from github.\n\n```bash\ngit clone https://github.com/encode/django-rest-framework\n```\n\nAdd `'rest_framework'` to your `INSTALLED_APPS` setting.\n\n```python\nINSTALLED_APPS = [\n    # ...\n    \"rest_framework\",\n]\n```\n\nIf you're intending to use the browsable API you'll probably also want to add REST framework's login and logout views.  Add the following to your root `urls.py` file.\n\n```python\nurlpatterns = [\n    # ...\n    path(\"api-auth/\", include(\"rest_framework.urls\"))\n]\n```\n\nNote that the URL path can be whatever you want.\n\n## Example\n\nLet's take a look at a quick example of using REST framework to build a simple model-backed API.\n\nWe'll create a read-write API for accessing information on the users of our project.\n\nAny global settings for a REST framework API are kept in a single configuration dictionary named `REST_FRAMEWORK`.  Start off by adding the following to your `settings.py` module:\n\n```python\nREST_FRAMEWORK = {\n    # Use Django's standard `django.contrib.auth` permissions,\n    # or allow read-only access for unauthenticated users.\n    \"DEFAULT_PERMISSION_CLASSES\": [\n        \"rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly\"\n    ]\n}\n```\n\nDon't forget to make sure you've also added `rest_framework` to your `INSTALLED_APPS`.\n\nWe're ready to create our API now.\nHere's our project's root `urls.py` module:\n\n```python\nfrom django.urls import path, include\nfrom django.contrib.auth.models import User\nfrom rest_framework import routers, serializers, viewsets\n\n\n# Serializers define the API representation.\nclass UserSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = User\n        fields = [\"url\", \"username\", \"email\", \"is_staff\"]\n\n\n# ViewSets define the view behavior.\nclass UserViewSet(viewsets.ModelViewSet):\n    queryset = User.objects.all()\n    serializer_class = UserSerializer\n\n\n# Routers provide an easy way of automatically determining the URL conf.\nrouter = routers.DefaultRouter()\nrouter.register(r\"users\", UserViewSet)\n\n# Wire up our API using automatic URL routing.\n# Additionally, we include login URLs for the browsable API.\nurlpatterns = [\n    path(\"\", include(router.urls)),\n    path(\"api-auth/\", include(\"rest_framework.urls\", namespace=\"rest_framework\")),\n]\n```\n\nYou can now open the API in your browser at [http://127.0.0.1:8000/](http://127.0.0.1:8000/), and view your new 'users' API. If you use the login control in the top right corner you'll also be able to add, create and delete users from the system.\n\n## Quickstart\n\nCan't wait to get started? The [quickstart guide][quickstart] is the fastest way to get up and running, and building APIs with REST framework.\n\n## Development\n\nSee the [Contribution guidelines][contributing] for information on how to clone\nthe repository, run the test suite and help maintain the code base of REST\nFramework.\n\n## Support\n\nFor support please see the [REST framework discussion group][group], try the `#restframework` channel on `irc.libera.chat`, or raise a question on [Stack Overflow][stack-overflow], making sure to include the ['django-rest-framework'][django-rest-framework-tag] tag.\n\n## Security\n\n**Please report security issues by emailing security@encode.io**.\n\nThe project maintainers will then work with you to resolve any issues where required, prior to any public disclosure.\n\n## License\n\nCopyright © 2011-present, [Encode OSS Ltd](https://www.encode.io/).\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n  contributors may be used to endorse or promote products derived from\n  this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n[mozilla]: https://www.mozilla.org/en-US/about/\n[redhat]: https://www.redhat.com/\n[heroku]: https://www.heroku.com/\n[eventbrite]: https://www.eventbrite.co.uk/about/\n[pyyaml]: https://pypi.org/project/PyYAML/\n[uritemplate]: https://pypi.org/project/uritemplate/\n[markdown]: https://pypi.org/project/Markdown/\n[pygments]: https://pypi.org/project/Pygments/\n[django-filter]: https://pypi.org/project/django-filter/\n[django-guardian]: https://github.com/django-guardian/django-guardian\n[index]: .\n[oauth1-section]: api-guide/authentication/#django-rest-framework-oauth\n[oauth2-section]: api-guide/authentication/#django-oauth-toolkit\n[serializer-section]: api-guide/serializers#serializers\n[modelserializer-section]: api-guide/serializers#modelserializer\n[functionview-section]: api-guide/views#function-based-views\n\n[quickstart]: tutorial/quickstart.md\n\n[generic-views]: api-guide/generic-views.md\n[viewsets]: api-guide/viewsets.md\n[routers]: api-guide/routers.md\n[serializers]: api-guide/serializers.md\n[authentication]: api-guide/authentication.md\n\n[contributing]: community/contributing.md\n\n[group]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework\n[stack-overflow]: https://stackoverflow.com/\n[django-rest-framework-tag]: https://stackoverflow.com/questions/tagged/django-rest-framework\n[security-mail]: mailto:rest-framework-security@googlegroups.com\n"
  },
  {
    "path": "docs/theme/js/prettify-1.0.js",
    "content": "var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;\n(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:\"0\"<=b&&b<=\"7\"?parseInt(a.substring(1),8):b===\"u\"||b===\"x\"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?\"\\\\x0\":\"\\\\x\")+a.toString(16);a=String.fromCharCode(a);if(a===\"\\\\\"||a===\"-\"||a===\"[\"||a===\"]\")a=\"\\\\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\\\u[\\dA-Fa-f]{4}|\\\\x[\\dA-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\S\\s]|[^\\\\]/g),a=\n[],b=[],o=f[0]===\"^\",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&\"-\"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=[\"[\"];o&&b.push(\"^\");b.push.apply(b,a);for(c=0;c<\nf.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push(\"-\"),b.push(e(i[1])));b.push(\"]\");return b.join(\"\")}function y(a){for(var f=a.source.match(/\\[(?:[^\\\\\\]]|\\\\[\\S\\s])*]|\\\\u[\\dA-Fa-f]{4}|\\\\x[\\dA-Fa-f]{2}|\\\\\\d+|\\\\[^\\dux]|\\(\\?[!:=]|[()^]|[^()[\\\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j===\"(\"?++i:\"\\\\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j===\"(\"?(++i,d[i]===void 0&&(f[c]=\"(?:\")):\"\\\\\"===j.charAt(0)&&\n(j=+j.substring(1))&&j<=i&&(f[c]=\"\\\\\"+d[i]);for(i=c=0;c<b;++c)\"^\"===f[c]&&\"^\"!==f[c+1]&&(f[c]=\"\");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a===\"[\"?f[c]=h(j):a!==\"\\\\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return\"[\"+String.fromCharCode(a&-33,a|32)+\"]\"}));return f.join(\"\")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\\\u[\\da-f]{4}|\\\\x[\\da-f]{2}|\\\\[^UXux]/gi,\"\"))){s=!0;l=!1;break}}for(var r=\n{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(\"\"+g);n.push(\"(?:\"+y(g)+\")\")}return RegExp(n.join(\"|\"),l?\"gi\":\"g\")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if(\"BR\"===g||\"LI\"===g)h[s]=\"\\n\",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\\r\\n?/g,\"\\n\"):g.replace(/[\\t\\n\\r ]+/g,\" \"),h[s]=g,t[s<<1]=y,y+=g.length,\nt[s++<<1|1]=a)}}var e=/(?:^|\\s)nocode(?:\\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue(\"white-space\"));var p=l&&\"pre\"===l.substring(0,3);m(a);return{a:h.join(\"\").replace(/\\n$/,\"\"),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,\"pln\"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===\n\"string\")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b=\"pln\")}if((c=b.length>=5&&\"lang-\"===b.substring(0,5))&&!(o&&typeof o[1]===\"string\"))c=!1,b=\"src\";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),\nl=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=\"\"+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\\S\\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push([\"str\",/^(?:'''(?:[^'\\\\]|\\\\[\\S\\s]|''?(?=[^']))*(?:'''|$)|\"\"\"(?:[^\"\\\\]|\\\\[\\S\\s]|\"\"?(?=[^\"]))*(?:\"\"\"|$)|'(?:[^'\\\\]|\\\\[\\S\\s])*(?:'|$)|\"(?:[^\"\\\\]|\\\\[\\S\\s])*(?:\"|$))/,q,\"'\\\"\"]):a.multiLineStrings?m.push([\"str\",/^(?:'(?:[^'\\\\]|\\\\[\\S\\s])*(?:'|$)|\"(?:[^\"\\\\]|\\\\[\\S\\s])*(?:\"|$)|`(?:[^\\\\`]|\\\\[\\S\\s])*(?:`|$))/,\nq,\"'\\\"`\"]):m.push([\"str\",/^(?:'(?:[^\\n\\r'\\\\]|\\\\.)*(?:'|$)|\"(?:[^\\n\\r\"\\\\]|\\\\.)*(?:\"|$))/,q,\"\\\"'\"]);a.verbatimStrings&&e.push([\"str\",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push([\"com\",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,\"#\"]):m.push([\"com\",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\\b|[^\\n\\r]*)/,q,\"#\"]),e.push([\"str\",/^<(?:(?:(?:\\.\\.\\/)*|\\/?)(?:[\\w-]+(?:\\/[\\w-]+)+)?[\\w-]+\\.h|[a-z]\\w*)>/,q])):m.push([\"com\",/^#[^\\n\\r]*/,\nq,\"#\"]));a.cStyleComments&&(e.push([\"com\",/^\\/\\/[^\\n\\r]*/,q]),e.push([\"com\",/^\\/\\*[\\S\\s]*?(?:\\*\\/|$)/,q]));a.regexLiterals&&e.push([\"lang-regex\",/^(?:^^\\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|,|-=|->|\\/|\\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\\^=|\\^\\^|\\^\\^=|{|\\||\\|=|\\|\\||\\|\\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*(\\/(?=[^*/])(?:[^/[\\\\]|\\\\[\\S\\s]|\\[(?:[^\\\\\\]]|\\\\[\\S\\s])*(?:]|$))+\\/)/]);(h=a.types)&&e.push([\"typ\",h]);a=(\"\"+a.keywords).replace(/^ | $/g,\n\"\");a.length&&e.push([\"kwd\",RegExp(\"^(?:\"+a.replace(/[\\s,]+/g,\"|\")+\")\\\\b\"),q]);m.push([\"pln\",/^\\s+/,q,\" \\r\\n\\t\\xa0\"]);e.push([\"lit\",/^@[$_a-z][\\w$@]*/i,q],[\"typ\",/^(?:[@_]?[A-Z]+[a-z][\\w$@]*|\\w+_t\\b)/,q],[\"pln\",/^[$_a-z][\\w$@]*/i,q],[\"lit\",/^(?:0x[\\da-f]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+-]?\\d+)?)[a-z]*/i,q,\"0123456789\"],[\"pln\",/^\\\\[\\S\\s]?/,q],[\"pun\",/^.[^\\s\\w\"-$'./@\\\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if(\"BR\"===a.nodeName)h(a),\na.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}\nfor(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\\s)nocode(?:\\s|$)/,t=/\\r\\n?|\\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue(\"white-space\"));var p=l&&\"pre\"===l.substring(0,3);for(l=s.createElement(\"LI\");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute(\"value\",\nm);var r=s.createElement(\"OL\");r.className=\"linenums\";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className=\"L\"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode(\"\\xa0\")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn(\"cannot override language handler %s\",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\\s*</.test(m)?\"default-markup\":\"default-code\";return A[a]}function E(a){var m=\na.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\\bMSIE\\b/.test(navigator.userAgent),m=/\\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,\"\\r\"));i.nodeValue=\nj;var u=i.ownerDocument,v=u.createElement(\"SPAN\");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){\"console\"in window&&console.log(w&&w.stack?w.stack:w)}}var v=[\"break,continue,do,else,for,if,return,while\"],w=[[v,\"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile\"],\n\"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof\"],F=[w,\"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where\"],G=[w,\"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient\"],\nH=[G,\"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var\"],w=[w,\"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN\"],I=[v,\"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None\"],\nJ=[v,\"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END\"],v=[v,\"case,done,elif,esac,eval,fi,function,in,local,set,then,until\"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\\d*)/,N=/\\S/,O=u({keywords:[F,H,w,\"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END\"+\nI,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,[\"default-code\"]);k(x([],[[\"pln\",/^[^<?]+/],[\"dec\",/^<!\\w[^>]*(?:>|$)/],[\"com\",/^<\\!--[\\S\\s]*?(?:--\\>|$)/],[\"lang-\",/^<\\?([\\S\\s]+?)(?:\\?>|$)/],[\"lang-\",/^<%([\\S\\s]+?)(?:%>|$)/],[\"pun\",/^(?:<[%?]|[%?]>)/],[\"lang-\",/^<xmp\\b[^>]*>([\\S\\s]+?)<\\/xmp\\b[^>]*>/i],[\"lang-js\",/^<script\\b[^>]*>([\\S\\s]*?)(<\\/script\\b[^>]*>)/i],[\"lang-css\",/^<style\\b[^>]*>([\\S\\s]*?)(<\\/style\\b[^>]*>)/i],[\"lang-in.tag\",/^(<\\/?[a-z][^<>]*>)/i]]),\n[\"default-markup\",\"htm\",\"html\",\"mxml\",\"xhtml\",\"xml\",\"xsl\"]);k(x([[\"pln\",/^\\s+/,q,\" \\t\\r\\n\"],[\"atv\",/^(?:\"[^\"]*\"?|'[^']*'?)/,q,\"\\\"'\"]],[[\"tag\",/^^<\\/?[a-z](?:[\\w-.:]*\\w)?|\\/?>$/i],[\"atn\",/^(?!style[\\s=]|on)[a-z](?:[\\w:-]*\\w)?/i],[\"lang-uq.val\",/^=\\s*([^\\s\"'>]*(?:[^\\s\"'/>]|\\/(?=\\s)))/],[\"pun\",/^[/<->]+/],[\"lang-js\",/^on\\w+\\s*=\\s*\"([^\"]+)\"/i],[\"lang-js\",/^on\\w+\\s*=\\s*'([^']+)'/i],[\"lang-js\",/^on\\w+\\s*=\\s*([^\\s\"'>]+)/i],[\"lang-css\",/^style\\s*=\\s*\"([^\"]+)\"/i],[\"lang-css\",/^style\\s*=\\s*'([^']+)'/i],[\"lang-css\",\n/^style\\s*=\\s*([^\\s\"'>]+)/i]]),[\"in.tag\"]);k(x([],[[\"atv\",/^[\\S\\s]+/]]),[\"uq.val\"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),[\"c\",\"cc\",\"cpp\",\"cxx\",\"cyc\",\"m\"]);k(u({keywords:\"null,true,false\"}),[\"json\"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),[\"cs\"]);k(u({keywords:G,cStyleComments:!0}),[\"java\"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),[\"bsh\",\"csh\",\"sh\"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),\n[\"cv\",\"py\"]);k(u({keywords:\"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END\",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),[\"perl\",\"pl\",\"pm\"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),[\"rb\"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),[\"js\"]);k(u({keywords:\"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes\",\nhashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),[\"coffee\"]);k(x([],[[\"str\",/^[\\S\\s]+/]]),[\"regex\"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement(\"PRE\");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf(\"prettyprint\")>=0){var k=k.match(g),f,b;if(b=\n!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&\"CODE\"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName===\"pre\"||o.tagName===\"code\"||o.tagName===\"xmp\")&&o.className&&o.className.indexOf(\"prettyprint\")>=0){b=!0;break}b||((b=(b=n.className.match(/\\blinenums\\b(?::(\\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,\n250):a&&a()}for(var e=[document.getElementsByTagName(\"pre\"),document.getElementsByTagName(\"code\"),document.getElementsByTagName(\"xmp\")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\\blang(?:uage)?-([\\w.]+)(?!\\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:\"atn\",PR_ATTRIB_VALUE:\"atv\",PR_COMMENT:\"com\",PR_DECLARATION:\"dec\",PR_KEYWORD:\"kwd\",PR_LITERAL:\"lit\",\nPR_NOCODE:\"nocode\",PR_PLAIN:\"pln\",PR_PUNCTUATION:\"pun\",PR_SOURCE:\"src\",PR_STRING:\"str\",PR_TAG:\"tag\",PR_TYPE:\"typ\"}})();\n"
  },
  {
    "path": "docs/theme/main.html",
    "content": "{% extends \"base.html\" %}\n\n{% block scripts %}\n    {{ super() }}\n    <script>\n        document$.subscribe(function() {\n            document.querySelectorAll('pre code').forEach(code => {\n                code.parentElement.classList.add('prettyprint', 'well');\n            });\n            prettyPrint();\n        });\n    </script>\n{% endblock %}"
  },
  {
    "path": "docs/theme/src/README.md",
    "content": "# DRF logos\n\nThis folder contains the source file for the DRF logos as Figma file."
  },
  {
    "path": "docs/theme/src/drf-logos.fig",
    "content": "version https://git-lfs.github.com/spec/v1\noid sha256:762ff0dcedaa80a0ba95b9b8fc656d0c5fd2514a70d08335afe0eb06c9e14658\nsize 1303581\n"
  },
  {
    "path": "docs/theme/stylesheets/extra.css",
    "content": ":root  > * {\n  /* primary */\n  --md-primary-fg-color: #2c2c2c;\n  --md-primary-fg-color--light: #a8a8a8;\n  --md-primary-fg-color--dark: #181818;\n  /* accent */\n  --md-accent-fg-color: #c50d0d;\n  --md-accent-fg-color--light: #ff8f8f;\n  --md-accent-fg-color--dark: #A30000;\n\n  /* Style links */\n  --md-typeset-a-color: var(--md-typeset-color);\n}\n\n/* Dark theme customisation */\n[data-md-color-scheme=\"slate\"]\n{\n  --md-accent-fg-color--dark: #F25757;\n}\n\n.md-header {\n  border-top: 5px solid #A30000;\n}\n\nbody hr {\n  border-top: 1px dotted var(--md-accent-fg-color--dark);\n}\n\n.badges {\n  display: flex;\n  justify-content: end;\n  gap: 8px;\n}\n\n/* Cutesy quote styling */\n[dir=\"ltr\"] .md-typeset blockquote {\n  font-family: Georgia, serif;\n  font-size: 18px;\n  font-style: italic;\n  margin: 0.25em 0;\n  padding: 0.25em 40px;\n  line-height: 1.45;\n  position: relative;\n  color: var(--md-typeset-color);\n  border-left: none;\n}\n\n[dir=\"ltr\"] .md-typeset blockquote:before {\n  display: block;\n  content: \"\\201C\";\n  font-size: 80px;\n  position: absolute;\n  left: -10px;\n  top: -20px;\n  color: #7a7a7a;\n}\n\n[dir=\"ltr\"] .md-typeset blockquote p:last-child {\n  color: #999999;\n  font-size: 14px;\n  display: block;\n  margin-top: 5px;\n}\n\n.md-typeset a {\n  color: var(--md-accent-fg-color--dark);\n}\n\n/* Replacement for `body { background-attachment: fixed; }`, which\n   has performance issues when scrolling on large displays. */\nbody::before {\n    content: ' ';\n    position: fixed;\n    width: 100%;\n    height: 100%;\n    top: 0;\n    left: 0;\n    background-color: #f8f8f8;\n    background: url(../img/grid.png) repeat-x;\n    will-change: transform;\n    z-index: -1;\n}"
  },
  {
    "path": "docs/theme/stylesheets/prettify.css",
    "content": ".com { color: #93a1a1; }\n.lit { color: #195f91; }\n.pun, .opn, .clo { color: #93a1a1; }\n.fun { color: #dc322f; }\n.str, .atv { color: #D14; }\n.kwd, .prettyprint .tag { color: #1e347b; }\n.typ, .atn, .dec, .var { color: teal; }\n.pln { color: #48484c; }\n\n[data-md-color-scheme=\"slate\"]\n{\n  .com { color: #687272; }\n  .lit { color: #2481c7; }\n  .str, .atv { color: #e37e8e;; }\n  .kwd, .prettyprint .tag { color: #6e8ee1; }\n  .typ, .atn, .dec, .var { color: #05abab; }\n  .pln { color: #d3d3dc; }\n}\n\n.prettyprint.linenums {\n  -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;\n     -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;\n          box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;\n}\n\n/* Specify class=linenums on a pre to get line numbering */\nol.linenums {\n  margin: 0 0 0 33px; /* IE indents via margin-left */\n}\nol.linenums li {\n  padding-left: 12px;\n  color: #bebec5;\n  line-height: 20px;\n  text-shadow: 0 1px 0 #fff;\n}"
  },
  {
    "path": "docs/topics/ajax-csrf-cors.md",
    "content": "# Working with AJAX, CSRF & CORS\n\n> \"Take a close look at possible CSRF / XSRF vulnerabilities on your own websites.  They're the worst kind of vulnerability &mdash; very easy to exploit by attackers, yet not so intuitively easy to understand for software developers, at least until you've been bitten by one.\"\n>\n> &mdash; [Jeff Atwood][cite]\n\n## Javascript clients\n\nIf you’re building a JavaScript client to interface with your Web API, you'll need to consider if the client can use the same authentication policy that is used by the rest of the website, and also determine if you need to use CSRF tokens or CORS headers.\n\nAJAX requests that are made within the same context as the API they are interacting with will typically use `SessionAuthentication`.  This ensures that once a user has logged in, any AJAX requests made can be authenticated using the same session-based authentication that is used for the rest of the website.\n\nAJAX requests that are made on a different site from the API they are communicating with will typically need to use a non-session-based authentication scheme, such as `TokenAuthentication`.\n\n## CSRF protection\n\n[Cross Site Request Forgery][csrf] protection is a mechanism of guarding against a particular type of attack, which can occur when a user has not logged out of a web site, and continues to have a valid session.   In this circumstance a malicious site may be able to perform actions against the target site, within the context of the logged-in session.\n\nTo guard against these type of attacks, you need to do two things:\n\n1. Ensure that the 'safe' HTTP operations, such as `GET`, `HEAD` and `OPTIONS` cannot be used to alter any server-side state.\n2. Ensure that any 'unsafe' HTTP operations, such as `POST`, `PUT`, `PATCH` and `DELETE`, always require a valid CSRF token.\n\nIf you're using `SessionAuthentication` you'll need to include valid CSRF tokens for any `POST`, `PUT`, `PATCH` or `DELETE` operations.\n\nIn order to make AJAX requests, you need to include CSRF token in the HTTP header, as [described in the Django documentation][csrf-ajax].\n\n## CORS\n\n[Cross-Origin Resource Sharing][cors] is a mechanism for allowing clients to interact with APIs that are hosted on a different domain.  CORS works by requiring the server to include a specific set of headers that allow a browser to determine if and when cross-domain requests should be allowed.\n\nThe best way to deal with CORS in REST framework is to add the required response headers in middleware.  This ensures that CORS is supported transparently, without having to change any behavior in your views.\n\n[Adam Johnson][adamchainz] maintains the [django-cors-headers] package, which is known to work correctly with REST framework APIs.\n\n[cite]: https://blog.codinghorror.com/preventing-csrf-and-xsrf-attacks/\n[csrf]: https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)\n[csrf-ajax]: https://docs.djangoproject.com/en/stable/howto/csrf/#using-csrf-protection-with-ajax\n[cors]: https://www.w3.org/TR/cors/\n[adamchainz]: https://github.com/adamchainz\n[django-cors-headers]: https://github.com/adamchainz/django-cors-headers\n"
  },
  {
    "path": "docs/topics/browsable-api.md",
    "content": "# The Browsable API\n\n> It is a profoundly erroneous truism... that we should cultivate the habit of thinking of what we are doing.  The precise opposite is the case.  Civilization advances by extending the number of important operations which we can perform without thinking about them.\n>\n> &mdash; [Alfred North Whitehead][cite], An Introduction to Mathematics (1911)\n\n\nAPI may stand for Application *Programming* Interface, but humans have to be able to read the APIs, too; someone has to do the programming.  Django REST Framework supports generating human-friendly HTML output for each resource when the `HTML` format is requested.  These pages allow for easy browsing of resources, as well as forms for submitting data to the resources using `POST`, `PUT`, and `DELETE`.\n\n## URLs\n\nIf you include fully-qualified URLs in your resource output, they will be 'urlized' and made clickable for easy browsing by humans.  The `rest_framework` package includes a [`reverse`][drfreverse] helper for this purpose.\n\n## Formats\n\nBy default, the API will return the format specified by the headers, which in the case of the browser is HTML.  The format can be specified using `?format=` in the request, so you can look at the raw JSON response in a browser by adding `?format=json` to the URL.  There are helpful extensions for viewing JSON in [Firefox][ffjsonview] and [Chrome][chromejsonview].\n\n## Authentication\n\nTo quickly add authentication to the browesable api, add a routes named `\"login\"` and `\"logout\"` under the namespace `\"rest_framework\"`. DRF provides default routes for this which you can add to your urlconf:\n\n```python\nfrom django.urls import include, path\n\nurlpatterns = [\n    # ...\n    path(\"api-auth/\", include(\"rest_framework.urls\", namespace=\"rest_framework\"))\n]\n```\n\n\n## Customizing\n\nThe browsable API is built with [Twitter's Bootstrap][bootstrap] (v 3.4.1), making it easy to customize the look-and-feel.\n\nTo customize the default style, create a template called `rest_framework/api.html` that extends from `rest_framework/base.html`.  For example:\n\n**templates/rest_framework/api.html**\n\n    {% extends \"rest_framework/base.html\" %}\n\n    ...  # Override blocks with required customizations\n\n### Overriding the default theme\n\nTo replace the default theme, add a `bootstrap_theme` block to your `api.html` and insert a `link` to the desired Bootstrap theme css file.  This will completely replace the included theme.\n\n    {% block bootstrap_theme %}\n        <link rel=\"stylesheet\" href=\"/path/to/my/bootstrap.css\" type=\"text/css\">\n    {% endblock %}\n\nSuitable pre-made replacement themes are available at [Bootswatch][bswatch].  To use any of the Bootswatch themes, simply download the theme's `bootstrap.min.css` file, add it to your project, and replace the default one as described above. Make sure that the Bootstrap version of the new theme matches that of the default theme.\n\nYou can also change the navbar variant, which by default is `navbar-inverse`, using the `bootstrap_navbar_variant` block.  The empty `{% block bootstrap_navbar_variant %}{% endblock %}` will use the original Bootstrap navbar style.\n\nFull example:\n\n    {% extends \"rest_framework/base.html\" %}\n\n    {% block bootstrap_theme %}\n        <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bootswatch@3.4.1/flatly/bootstrap.min.css\" type=\"text/css\">\n    {% endblock %}\n\n    {% block bootstrap_navbar_variant %}{% endblock %}\n\nFor more specific CSS tweaks than simply overriding the default bootstrap theme you can override the `style` block.\n\n---\n\n![Cerulean theme][cerulean]\n\n*Screenshot of the bootswatch 'Cerulean' theme*\n\n---\n\n![Slate theme][slate]\n\n*Screenshot of the bootswatch 'Slate' theme*\n\n---\n\n### Third party packages for customization\n\nYou can use a third party package for customization, rather than doing it by yourself. Here is 3 packages for customizing the API:\n\n* [drf-restwind][drf-restwind] - a modern re-imagining of the Django REST Framework utilizes TailwindCSS and DaisyUI to provide flexible and customizable UI solutions with minimal coding effort.\n* [drf-redesign][drf-redesign] - A package for customizing the API using Bootstrap 5. Modern and sleek design, it comes with the support for dark mode.\n* [drf-material][drf-material] - Material design for Django REST Framework.\n\n---\n\n![API Root][drf-rw-api-root]\n\n![List View][drf-rw-list-view]\n\n![Detail View][drf-rw-detail-view]\n\n*Screenshots of the drf-restwind*\n\n---\n\n---\n\n![API Root][drf-r-api-root]\n\n![List View][drf-r-list-view]\n\n![Detail View][drf-r-detail-view]\n\n*Screenshot of the drf-redesign*\n\n---\n\n![API Root][drf-m-api-root]\n\n![List View][drf-m-api-root]\n\n![Detail View][drf-m-api-root]\n\n*Screenshot of the drf-material*\n\n---\n\n### Blocks\n\nAll of the blocks available in the browsable API base template that can be used in your `api.html`.\n\n* `body`                       - The entire html `<body>`.\n* `bodyclass`                  - Class attribute for the `<body>` tag, empty by default.\n* `bootstrap_theme`            - CSS for the Bootstrap theme.\n* `bootstrap_navbar_variant`   - CSS class for the navbar.\n* `branding`                   - Branding section of the navbar, see [Bootstrap components][bcomponentsnav].\n* `breadcrumbs`                - Links showing resource nesting, allowing the user to go back up the resources.  It's recommended to preserve these, but they can be overridden using the breadcrumbs block.\n* `script`                     - JavaScript files for the page.\n* `style`                      - CSS stylesheets for the page.\n* `title`                      - Title of the page.\n* `userlinks`                  - This is a list of links on the right of the header, by default containing login/logout links.  To add links instead of replace, use `{{ block.super }}` to preserve the authentication links.\n\n#### Components\n\nAll of the standard [Bootstrap components][bcomponents] are available.\n\n#### Tooltips\n\nThe browsable API makes use of the Bootstrap tooltips component.  Any element with the `js-tooltip` class and a `title` attribute has that title content will display a tooltip on hover events.\n\n### Login Template\n\nTo add branding and customize the look-and-feel of the login template, create a template called `login.html` and add it to your project, eg: `templates/rest_framework/login.html`.  The template should extend from `rest_framework/login_base.html`.\n\nYou can add your site name or branding by including the branding block:\n\n    {% extends \"rest_framework/login_base.html\" %}\n\n    {% block branding %}\n        <h3 style=\"margin: 0 0 20px;\">My Site Name</h3>\n    {% endblock %}\n\nYou can also customize the style by adding the `bootstrap_theme` or `style` block similar to `api.html`.\n\n### Advanced Customization\n\n#### Context\n\nThe context that's available to the template:\n\n* `allowed_methods`     : A list of methods allowed by the resource\n* `api_settings`        : The API settings\n* `available_formats`   : A list of formats allowed by the resource\n* `breadcrumblist`      : The list of links following the chain of nested resources\n* `content`             : The content of the API response\n* `description`         : The description of the resource, generated from its docstring\n* `name`                : The name of the resource\n* `post_form`           : A form instance for use by the POST form (if allowed)\n* `put_form`            : A form instance for use by the PUT form (if allowed)\n* `display_edit_forms`  : A boolean indicating whether or not POST, PUT and PATCH forms will be displayed\n* `request`             : The request object\n* `response`            : The response object\n* `version`             : The version of Django REST Framework\n* `view`                : The view handling the request\n* `FORMAT_PARAM`        : The view can accept a format override\n* `METHOD_PARAM`        : The view can accept a method override\n\nYou can override the `BrowsableAPIRenderer.get_context()` method to customize the context that gets passed to the template.\n\n#### Not using base.html\n\nFor more advanced customization, such as not having a Bootstrap basis or tighter integration with the rest of your site, you can simply choose not to have `api.html` extend `base.html`.  Then the page content and capabilities are entirely up to you.\n\n#### Handling `ChoiceField` with large numbers of items.\n\nWhen a relationship or `ChoiceField` has too many items, rendering the widget containing all the options can become very slow, and cause the browsable API rendering to perform poorly.\n\nThe simplest option in this case is to replace the select input with a standard text input. For example:\n\n     author = serializers.HyperlinkedRelatedField(\n        queryset=User.objects.all(),\n        style={'base_template': 'input.html'}\n    )\n\n#### Autocomplete\n\nAn alternative, but more complex option would be to replace the input with an autocomplete widget, that only loads and renders a subset of the available options as needed. If you need to do this you'll need to do some work to build a custom autocomplete HTML template yourself.\n\nThere are [a variety of packages for autocomplete widgets][autocomplete-packages], such as [django-autocomplete-light][django-autocomplete-light], that you may want to refer to. Note that you will not be able to simply include these components as standard widgets, but will need to write the HTML template explicitly. This is because REST framework 3.0 no longer supports the `widget` keyword argument since it now uses templated HTML generation.\n\n---\n\n[cite]: https://en.wikiquote.org/wiki/Alfred_North_Whitehead\n[drfreverse]: ../api-guide/reverse.md\n[ffjsonview]: https://addons.mozilla.org/en-US/firefox/addon/jsonview/\n[chromejsonview]: https://chrome.google.com/webstore/detail/chklaanhfefbnpoihckbnefhakgolnmc\n[bootstrap]: https://getbootstrap.com/\n[cerulean]: ../img/cerulean.png\n[slate]: ../img/slate.png\n[bswatch]: https://bootswatch.com/\n[bcomponents]: https://getbootstrap.com/2.3.2/components.html\n[bcomponentsnav]: https://getbootstrap.com/2.3.2/components.html#navbar\n[autocomplete-packages]: https://www.djangopackages.com/grids/g/auto-complete/\n[django-autocomplete-light]: https://github.com/yourlabs/django-autocomplete-light\n[drf-restwind]: https://github.com/youzarsiph/drf-restwind\n[drf-rw-api-root]: ../img/drf-rw-api-root.png\n[drf-rw-list-view]: ../img/drf-rw-list-view.png\n[drf-rw-detail-view]: ../img/drf-rw-detail-view.png\n[drf-redesign]: https://github.com/youzarsiph/drf-redesign\n[drf-r-api-root]: ../img/drf-r-api-root.png\n[drf-r-list-view]: ../img/drf-r-list-view.png\n[drf-r-detail-view]: ../img/drf-r-detail-view.png\n[drf-material]: https://github.com/youzarsiph/drf-material\n[drf-m-api-root]: ../img/drf-m-api-root.png\n[drf-m-list-view]: ../img/drf-m-list-view.png\n[drf-m-detail-view]: ../img/drf-m-detail-view.png\n"
  },
  {
    "path": "docs/topics/browser-enhancements.md",
    "content": "# Browser enhancements\n\n> \"There are two noncontroversial uses for overloaded POST.  The first is to *simulate* HTTP's uniform interface for clients like web browsers that don't support PUT or DELETE\"\n>\n> &mdash; [RESTful Web Services][cite], Leonard Richardson & Sam Ruby.\n\nIn order to allow the browsable API to function, there are a couple of browser enhancements that REST framework needs to provide.\n\nAs of version 3.3.0 onwards these are enabled with javascript, using the [ajax-form][ajax-form] library.\n\n## Browser based PUT, DELETE, etc...\n\nThe [AJAX form library][ajax-form] supports browser-based `PUT`, `DELETE` and other methods on HTML forms.\n\nAfter including the library, use the `data-method` attribute on the form, like so:\n\n    <form action=\"/\" data-method=\"PUT\">\n        <input name='foo'/>\n        ...\n    </form>\n\nNote that prior to 3.3.0, this support was server-side rather than javascript based. The method overloading style (as used in [Ruby on Rails][rails]) is no longer supported due to subtle issues that it introduces in request parsing.\n\n## Browser based submission of non-form content\n\nBrowser-based submission of content types such as JSON are supported by the [AJAX form library][ajax-form], using form fields with `data-override='content-type'` and `data-override='content'` attributes.\n\nFor example:\n\n        <form action=\"/\">\n            <input data-override='content-type' value='application/json' type='hidden'/>\n            <textarea data-override='content'>{}</textarea>\n            <input type=\"submit\"/>\n        </form>\n\nNote that prior to 3.3.0, this support was server-side rather than javascript based.\n\n## URL based format suffixes\n\nREST framework can take `?format=json` style URL parameters, which can be a\nuseful shortcut for determining which content type should be returned from\nthe view.\n\nThis behavior is controlled using the `URL_FORMAT_OVERRIDE` setting.\n\n## HTTP header based method overriding\n\nPrior to version 3.3.0 the semi extension header `X-HTTP-Method-Override` was supported for overriding the request method. This behavior is no longer in core, but can be adding if needed using middleware.\n\nFor example:\n\n    METHOD_OVERRIDE_HEADER = 'HTTP_X_HTTP_METHOD_OVERRIDE'\n\n    class MethodOverrideMiddleware:\n\n        def __init__(self, get_response):\n            self.get_response = get_response\n\n        def __call__(self, request):\n            if request.method == 'POST' and METHOD_OVERRIDE_HEADER in request.META:\n                request.method = request.META[METHOD_OVERRIDE_HEADER]\n            return self.get_response(request)\n\n## URL based accept headers\n\nUntil version 3.3.0 REST framework included built-in support for `?accept=application/json` style URL parameters, which would allow the `Accept` header to be overridden.\n\nSince the introduction of the content negotiation API this behavior is no longer included in core, but may be added using a custom content negotiation class, if needed.\n\nFor example:\n\n    class AcceptQueryParamOverride()\n        def get_accept_list(self, request):\n           header = request.META.get('HTTP_ACCEPT', '*/*')\n           header = request.query_params.get('_accept', header)\n           return [token.strip() for token in header.split(',')]\n\n## Doesn't HTML5 support PUT and DELETE forms?\n\nNope.  It was at one point intended to support `PUT` and `DELETE` forms, but\nwas later [dropped from the spec][html5].  There remains\n[ongoing discussion][put_delete] about adding support for `PUT` and `DELETE`,\nas well as how to support content types other than form-encoded data.\n\n[cite]: https://www.amazon.com/RESTful-Web-Services-Leonard-Richardson/dp/0596529260\n[ajax-form]: https://github.com/tomchristie/ajax-form\n[rails]: https://guides.rubyonrails.org/form_helpers.html#how-do-forms-with-put-or-delete-methods-work\n[html5]: https://www.w3.org/TR/html5-diff/#changes-2010-06-24\n[put_delete]: http://amundsen.com/examples/put-delete-forms/\n"
  },
  {
    "path": "docs/topics/documenting-your-api.md",
    "content": "# Documenting your API\n\n> A REST API should spend almost all of its descriptive effort in defining the media type(s) used for representing resources and driving application state.\n>\n> &mdash; Roy Fielding, [REST APIs must be hypertext driven][cite]\n\nREST framework provides a range of different choices for documenting your API. The following is a non-exhaustive list of some of the most popular options.\n\n## Third-party packages for OpenAPI support\n\nREST framework recommends using third-party packages for generating and presenting OpenAPI schemas, as they provide more features and flexibility than the built-in (deprecated) implementation.\n\n### drf-spectacular\n\n[drf-spectacular][drf-spectacular] is an [OpenAPI 3][open-api] schema generation library with explicit\nfocus on extensibility, customizability and client generation. It is the recommended way for\ngenerating and presenting OpenAPI schemas.\n\nThe library aims to extract as much schema information as possible, while providing decorators and extensions for easy\ncustomization. There is explicit support for [swagger-codegen][swagger], [SwaggerUI][swagger-ui] and [Redoc][redoc],\ni18n, versioning, authentication, polymorphism (dynamic requests and responses), query/path/header parameters,\ndocumentation and more. Several popular plugins for DRF are supported out-of-the-box as well.\n\n### drf-yasg\n\n[drf-yasg][drf-yasg] is a [Swagger / OpenAPI 2][swagger] generation tool implemented without using the schema generation provided\nby Django Rest Framework.\n\nIt aims to implement as much of the [OpenAPI 2][open-api] specification as possible - nested schemas, named models,\nresponse bodies, enum/pattern/min/max validators, form parameters, etc. - and to generate documents usable with code\ngeneration tools like `swagger-codegen`.\n\nThis also translates into a very useful interactive documentation viewer in the form of `swagger-ui`:\n\n![Screenshot - drf-yasg][image-drf-yasg]\n\n---\n\n## Built-in OpenAPI schema generation (deprecated)\n\n!!! warning\n    **Deprecation notice:** REST framework's built-in support for generating OpenAPI schemas is deprecated in favor of third-party packages that provide this functionality instead. As a replacement, we recommend using **drf-spectacular**.\n\n\nThere are a number of packages available that allow you to generate HTML\ndocumentation pages from OpenAPI schemas.\n\nTwo popular options are [Swagger UI][swagger-ui] and [ReDoc][redoc].\n\nBoth require little more than the location of your static schema file or\ndynamic `SchemaView` endpoint.\n\n### A minimal example with Swagger UI\n\nAssuming you've followed the example from the schemas documentation for routing\na dynamic `SchemaView`, a minimal Django template for using Swagger UI might be\nthis:\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <title>Swagger</title>\n    <meta charset=\"utf-8\"/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <link rel=\"stylesheet\" type=\"text/css\" href=\"//unpkg.com/swagger-ui-dist@3/swagger-ui.css\" />\n  </head>\n  <body>\n    <div id=\"swagger-ui\"></div>\n    <script src=\"//unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js\"></script>\n    <script>\n    const ui = SwaggerUIBundle({\n        url: \"{% url schema_url %}\",\n        dom_id: '#swagger-ui',\n        presets: [\n          SwaggerUIBundle.presets.apis,\n          SwaggerUIBundle.SwaggerUIStandalonePreset\n        ],\n        layout: \"BaseLayout\",\n        requestInterceptor: (request) => {\n          request.headers['X-CSRFToken'] = \"{{ csrf_token }}\"\n          return request;\n        }\n      })\n    </script>\n  </body>\n</html>\n```\n\nSave this in your templates folder as `swagger-ui.html`. Then route a\n`TemplateView` in your project's URL conf:\n\n```python\nfrom django.views.generic import TemplateView\n\nurlpatterns = [\n    # ...\n    # Route TemplateView to serve Swagger UI template.\n    #   * Provide `extra_context` with view name of `SchemaView`.\n    path(\n        \"swagger-ui/\",\n        TemplateView.as_view(\n            template_name=\"swagger-ui.html\",\n            extra_context={\"schema_url\": \"openapi-schema\"},\n        ),\n        name=\"swagger-ui\",\n    ),\n]\n```\n\nSee the [Swagger UI documentation][swagger-ui] for advanced usage.\n\n### A minimal example with ReDoc.\n\nAssuming you've followed the example from the schemas documentation for routing\na dynamic `SchemaView`, a minimal Django template for using ReDoc might be\nthis:\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <title>ReDoc</title>\n    <!-- needed for adaptive design -->\n    <meta charset=\"utf-8\"/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <link href=\"https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700\" rel=\"stylesheet\">\n    <!-- ReDoc doesn't change outer page styles -->\n    <style>\n      body {\n        margin: 0;\n        padding: 0;\n      }\n    </style>\n  </head>\n  <body>\n    <redoc spec-url='{% url schema_url %}'></redoc>\n    <script src=\"https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js\"> </script>\n  </body>\n</html>\n```\n\nSave this in your templates folder as `redoc.html`. Then route a `TemplateView`\nin your project's URL conf:\n\n```python\nfrom django.views.generic import TemplateView\n\nurlpatterns = [\n    # ...\n    # Route TemplateView to serve the ReDoc template.\n    #   * Provide `extra_context` with view name of `SchemaView`.\n    path(\n        \"redoc/\",\n        TemplateView.as_view(\n            template_name=\"redoc.html\", extra_context={\"schema_url\": \"openapi-schema\"}\n        ),\n        name=\"redoc\",\n    ),\n]\n```\n\nSee the [ReDoc documentation][redoc] for advanced usage.\n\n\n## Self describing APIs\n\nThe browsable API that REST framework provides makes it possible for your API to be entirely self describing.  The documentation for each API endpoint can be provided simply by visiting the URL in your browser.\n\n![Screenshot - Self describing API][image-self-describing-api]\n\n---\n\n#### Setting the title\n\nThe title that is used in the browsable API is generated from the view class name or function name.  Any trailing `View` or `ViewSet` suffix is stripped, and the string is whitespace separated on uppercase/lowercase boundaries or underscores.\n\nFor example, the view `UserListView`, will be named `User List` when presented in the browsable API.\n\nWhen working with viewsets, an appropriate suffix is appended to each generated view.  For example, the view set `UserViewSet` will generate views named `User List` and `User Instance`.\n\n#### Setting the description\n\nThe description in the browsable API is generated from the docstring of the view or viewset.\n\nIf the python `Markdown` library is installed, then [markdown syntax][markdown] may be used in the docstring, and will be converted to HTML in the browsable API.  For example:\n\n    class AccountListView(views.APIView):\n        \"\"\"\n        Returns a list of all **active** accounts in the system.\n\n        For more details on how accounts are activated please [see here][ref].\n\n        [ref]: http://example.com/activating-accounts\n        \"\"\"\n\nNote that when using viewsets the basic docstring is used for all generated views.  To provide descriptions for each view, such as for the list and retrieve views, use docstring sections as described in [Schemas as documentation: Examples][schemas-examples].\n\n#### The `OPTIONS` method\n\nREST framework APIs also support programmatically accessible descriptions, using the `OPTIONS` HTTP method.  A view will respond to an `OPTIONS` request with metadata including the name, description, and the various media types it accepts and responds with.\n\nWhen using the generic views, any `OPTIONS` requests will additionally respond with metadata regarding any `POST` or `PUT` actions available, describing which fields are on the serializer.\n\nYou can modify the response behavior to `OPTIONS` requests by overriding the `options` view method and/or by providing a custom Metadata class.  For example:\n\n    def options(self, request, *args, **kwargs):\n        \"\"\"\n        Don't include the view description in OPTIONS responses.\n        \"\"\"\n        meta = self.metadata_class()\n        data = meta.determine_metadata(request, self)\n        data.pop('description')\n        return Response(data=data, status=status.HTTP_200_OK)\n\nSee [the Metadata docs][metadata-docs] for more details.\n\n---\n\n## The hypermedia approach\n\nTo be fully RESTful an API should present its available actions as hypermedia controls in the responses that it sends.\n\nIn this approach, rather than documenting the available API endpoints up front, the description instead concentrates on the *media types* that are used.  The available actions that may be taken on any given URL are not strictly fixed, but are instead made available by the presence of link and form controls in the returned document.\n\nTo implement a hypermedia API you'll need to decide on an appropriate media type for the API, and implement a custom renderer and parser for that media type.  The [REST, Hypermedia & HATEOAS][hypermedia-docs] section of the documentation includes pointers to background reading, as well as links to various hypermedia formats.\n\n[cite]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven\n\n[hypermedia-docs]: rest-hypermedia-hateoas.md\n[metadata-docs]: ../api-guide/metadata.md\n[schemas-examples]: ../api-guide/schemas.md#examples\n\n[image-drf-yasg]: ../img/drf-yasg.png\n[image-self-describing-api]: ../img/self-describing.png\n\n[drf-yasg]: https://github.com/axnsan12/drf-yasg/\n[drf-spectacular]: https://github.com/tfranzel/drf-spectacular/\n[markdown]: https://daringfireball.net/projects/markdown/syntax\n[open-api]: https://openapis.org/\n[redoc]: https://github.com/Rebilly/ReDoc\n[swagger]: https://swagger.io/\n[swagger-ui]: https://swagger.io/tools/swagger-ui/\n"
  },
  {
    "path": "docs/topics/html-and-forms.md",
    "content": "# HTML & Forms\n\nREST framework is suitable for returning both API style responses, and regular HTML pages. Additionally, serializers can be used as HTML forms and rendered in templates.\n\n## Rendering HTML\n\nIn order to return HTML responses you'll need to use either `TemplateHTMLRenderer`, or `StaticHTMLRenderer`.\n\nThe `TemplateHTMLRenderer` class expects the response to contain a dictionary of context data, and renders an HTML page based on a template that must be specified either in the view or on the response.\n\nThe `StaticHTMLRender` class expects the response to contain a string of the pre-rendered HTML content.\n\nBecause static HTML pages typically have different behavior from API responses you'll probably need to write any HTML views explicitly, rather than relying on the built-in generic views.\n\nHere's an example of a view that returns a list of \"Profile\" instances, rendered in an HTML template:\n\n**views.py**:\n\n    from my_project.example.models import Profile\n    from rest_framework.renderers import TemplateHTMLRenderer\n    from rest_framework.response import Response\n    from rest_framework.views import APIView\n\n\n    class ProfileList(APIView):\n        renderer_classes = [TemplateHTMLRenderer]\n        template_name = 'profile_list.html'\n\n        def get(self, request):\n            queryset = Profile.objects.all()\n            return Response({'profiles': queryset})\n\n**profile_list.html**:\n\n    <html><body>\n    <h1>Profiles</h1>\n    <ul>\n        {% for profile in profiles %}\n        <li>{{ profile.name }}</li>\n        {% endfor %}\n    </ul>\n    </body></html>\n\n## Rendering Forms\n\nSerializers may be rendered as forms by using the `render_form` template tag, and including the serializer instance as context to the template.\n\nThe following view demonstrates an example of using a serializer in a template for viewing and updating a model instance:\n\n**views.py**:\n\n    from django.shortcuts import get_object_or_404\n    from my_project.example.models import Profile\n    from rest_framework.renderers import TemplateHTMLRenderer\n    from rest_framework.views import APIView\n\n\n    class ProfileDetail(APIView):\n        renderer_classes = [TemplateHTMLRenderer]\n        template_name = 'profile_detail.html'\n\n        def get(self, request, pk):\n            profile = get_object_or_404(Profile, pk=pk)\n            serializer = ProfileSerializer(profile)\n            return Response({'serializer': serializer, 'profile': profile})\n\n        def post(self, request, pk):\n            profile = get_object_or_404(Profile, pk=pk)\n            serializer = ProfileSerializer(profile, data=request.data)\n            if not serializer.is_valid():\n                return Response({'serializer': serializer, 'profile': profile})\n            serializer.save()\n            return redirect('profile-list')\n\n**profile_detail.html**:\n\n    {% load rest_framework %}\n\n    <html><body>\n\n    <h1>Profile - {{ profile.name }}</h1>\n\n    <form action=\"{% url 'profile-detail' pk=profile.pk %}\" method=\"POST\">\n        {% csrf_token %}\n        {% render_form serializer %}\n        <input type=\"submit\" value=\"Save\">\n    </form>\n\n    </body></html>\n\n### Using template packs\n\nThe `render_form` tag takes an optional `template_pack` argument, that specifies which template directory should be used for rendering the form and form fields.\n\nREST framework includes three built-in template packs, all based on Bootstrap 3. The built-in styles are `horizontal`, `vertical`, and `inline`. The default style is `horizontal`. To use any of these template packs you'll want to also include the Bootstrap 3 CSS.\n\nThe following HTML will link to a CDN hosted version of the Bootstrap 3 CSS:\n\n    <head>\n        …\n        <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\">\n    </head>\n\nThird party packages may include alternate template packs, by bundling a template directory containing the necessary form and field templates.\n\nLet's take a look at how to render each of the three available template packs. For these examples we'll use a single serializer class to present a \"Login\" form.\n\n    class LoginSerializer(serializers.Serializer):\n        email = serializers.EmailField(\n            max_length=100,\n            style={'placeholder': 'Email', 'autofocus': True}\n        )\n        password = serializers.CharField(\n            max_length=100,\n            style={'input_type': 'password', 'placeholder': 'Password'}\n        )\n        remember_me = serializers.BooleanField()\n\n---\n\n#### `rest_framework/vertical`\n\nPresents form labels above their corresponding control inputs, using the standard Bootstrap layout.\n\n*This is the default template pack.*\n\n    {% load rest_framework %}\n\n    ...\n\n    <form action=\"{% url 'login' %}\" method=\"post\" novalidate>\n        {% csrf_token %}\n        {% render_form serializer template_pack='rest_framework/vertical' %}\n        <button type=\"submit\" class=\"btn btn-default\">Sign in</button>\n    </form>\n\n![Vertical form example](../img/vertical.png)\n\n---\n\n#### `rest_framework/horizontal`\n\nPresents labels and controls alongside each other, using a 2/10 column split.\n\n*This is the form style used in the browsable API and admin renderers.*\n\n    {% load rest_framework %}\n\n    ...\n\n    <form class=\"form-horizontal\" action=\"{% url 'login' %}\" method=\"post\" novalidate>\n        {% csrf_token %}\n        {% render_form serializer %}\n        <div class=\"form-group\">\n            <div class=\"col-sm-offset-2 col-sm-10\">\n                <button type=\"submit\" class=\"btn btn-default\">Sign in</button>\n            </div>\n        </div>\n    </form>\n\n![Horizontal form example](../img/horizontal.png)\n\n---\n\n#### `rest_framework/inline`\n\nA compact form style that presents all the controls inline.\n\n    {% load rest_framework %}\n\n    ...\n\n    <form class=\"form-inline\" action=\"{% url 'login' %}\" method=\"post\" novalidate>\n        {% csrf_token %}\n        {% render_form serializer template_pack='rest_framework/inline' %}\n        <button type=\"submit\" class=\"btn btn-default\">Sign in</button>\n    </form>\n\n![Inline form example](../img/inline.png)\n\n## Field styles\n\nSerializer fields can have their rendering style customized by using the `style` keyword argument. This argument is a dictionary of options that control the template and layout used.\n\nThe most common way to customize the field style is to use the `base_template` style keyword argument to select which template in the template pack should be use.\n\nFor example, to render a `CharField` as an HTML textarea rather than the default HTML input, you would use something like this:\n\n    details = serializers.CharField(\n        max_length=1000,\n        style={'base_template': 'textarea.html'}\n    )\n\nIf you instead want a field to be rendered using a custom template that is *not part of an included template pack*, you can instead use the `template` style option, to fully specify a template name:\n\n    details = serializers.CharField(\n        max_length=1000,\n        style={'template': 'my-field-templates/custom-input.html'}\n    )\n\nField templates can also use additional style properties, depending on their type. For example, the `textarea.html` template also accepts a `rows` property that can be used to affect the sizing of the control.\n\n    details = serializers.CharField(\n        max_length=1000,\n        style={'base_template': 'textarea.html', 'rows': 10}\n    )\n\nThe complete list of `base_template` options and their associated style options is listed below.\n\nbase_template          | Valid field types                                           | Additional style options\n-----------------------|-------------------------------------------------------------|-----------------------------------------------\ninput.html             | Any string, numeric or date/time field                      | input_type, placeholder, hide_label, autofocus\ntextarea.html          | `CharField`                                                 | rows, placeholder, hide_label\nselect.html            | `ChoiceField` or relational field types                     | hide_label\nradio.html             | `ChoiceField` or relational field types                     | inline, hide_label\nselect_multiple.html   | `MultipleChoiceField` or relational fields with `many=True` | hide_label\ncheckbox_multiple.html | `MultipleChoiceField` or relational fields with `many=True` | inline, hide_label\ncheckbox.html          | `BooleanField`                                              | hide_label\nfieldset.html          | Nested serializer                                           | hide_label\nlist_fieldset.html     | `ListField` or nested serializer with `many=True`           | hide_label\n"
  },
  {
    "path": "docs/topics/internationalization.md",
    "content": "# Internationalization\n\n> Supporting internationalization is not optional. It must be a core feature.\n>\n> &mdash; [Jannis Leidel, speaking at Django Under the Hood, 2015][cite].\n\nREST framework ships with translatable error messages. You can make these appear in your language enabling [Django's standard translation mechanisms][django-translation].\n\nDoing so will allow you to:\n\n* Select a language other than English as the default, using the standard `LANGUAGE_CODE` Django setting.\n* Allow clients to choose a language themselves, using the `LocaleMiddleware` included with Django. A typical usage for API clients would be to include an `Accept-Language` request header.\n\n## Enabling internationalized APIs\n\nYou can change the default language by using the standard Django `LANGUAGE_CODE` setting:\n\n    LANGUAGE_CODE = \"es-es\"\n\nYou can turn on per-request language requests by adding `LocalMiddleware` to your `MIDDLEWARE` setting:\n\n    MIDDLEWARE = [\n        ...\n        'django.middleware.locale.LocaleMiddleware'\n    ]\n\nWhen per-request internationalization is enabled, client requests will respect the `Accept-Language` header where possible. For example, let's make a request for an unsupported media type:\n\n**Request**\n\n    GET /api/users HTTP/1.1\n    Accept: application/xml\n    Accept-Language: es-es\n    Host: example.org\n\n**Response**\n\n    HTTP/1.0 406 NOT ACCEPTABLE\n\n    {\"detail\": \"No se ha podido satisfacer la solicitud de cabecera de Accept.\"}\n\nREST framework includes these built-in translations both for standard exception cases, and for serializer validation errors.\n\nNote that the translations only apply to the error strings themselves. The format of error messages, and the keys of field names will remain the same. An example `400 Bad Request` response body might look like this:\n\n    {\"detail\": {\"username\": [\"Esse campo deve ser único.\"]}}\n\nIf you want to use different string for parts of the response such as `detail` and `non_field_errors` then you can modify this behavior by using a [custom exception handler][custom-exception-handler].\n\n#### Specifying the set of supported languages.\n\nBy default all available languages will be supported.\n\nIf you only wish to support a subset of the available languages, use Django's standard `LANGUAGES` setting:\n\n    LANGUAGES = [\n        ('de', _('German')),\n        ('en', _('English')),\n    ]\n\n## Adding new translations\n\nREST framework translations are managed on GitHub. You can contribute new translation languages or update existing ones\nby following the guidelines in the [Contributing to REST Framework] section and submitting a pull request.\n\nSometimes you may need to add translation strings to your project locally. You may need to do this if:\n\n* You want to use REST Framework in a language which is not supported by the project.\n* Your project includes custom error messages, which are not part of REST framework's default translation strings.\n\n#### Translating a new language locally\n\nThis guide assumes you are already familiar with how to translate a Django app.  If you're not, start by reading [Django's translation docs][django-translation].\n\nIf you're translating a new language you'll need to translate the existing REST framework error messages:\n\n1. Make a new folder where you want to store the internationalization resources. Add this path to your [`LOCALE_PATHS`][django-locale-paths] setting.\n\n2. Now create a subfolder for the language you want to translate. The folder should be named using [locale name][django-locale-name] notation. For example: `de`, `pt_BR`, `es_AR`.\n\n3. Now copy the [base translations file][django-po-source] from the REST framework source code into your translations folder.\n\n4. Edit the `django.po` file you've just copied, translating all the error messages.\n\n5. Run `manage.py compilemessages -l pt_BR` to make the translations\navailable for Django to use. You should see a message like `processing file django.po in <...>/locale/pt_BR/LC_MESSAGES`.\n\n6. Restart your development server to see the changes take effect.\n\nIf you're only translating custom error messages that exist inside your project codebase you don't need to copy the REST framework source `django.po` file into a `LOCALE_PATHS` folder, and can instead simply run Django's standard `makemessages` process.\n\n## How the language is determined\n\nIf you want to allow per-request language preferences you'll need to include `django.middleware.locale.LocaleMiddleware` in your `MIDDLEWARE` setting.\n\nYou can find more information on how the language preference is determined in the [Django documentation][django-language-preference]. For reference, the method is:\n\n1. First, it looks for the language prefix in the requested URL.\n2. Failing that, it looks for the `LANGUAGE_SESSION_KEY` key in the current user’s session.\n3. Failing that, it looks for a cookie.\n4. Failing that, it looks at the `Accept-Language` HTTP header.\n5. Failing that, it uses the global `LANGUAGE_CODE` setting.\n\nFor API clients the most appropriate of these will typically be to use the `Accept-Language` header; Sessions and cookies will not be available unless using session authentication, and generally better practice to prefer an `Accept-Language` header for API clients rather than using language URL prefixes.\n\n[cite]: https://youtu.be/Wa0VfS2q94Y\n[Contributing to REST Framework]: ../community/contributing.md#development\n[django-translation]: https://docs.djangoproject.com/en/stable/topics/i18n/translation\n[custom-exception-handler]: ../api-guide/exceptions.md#custom-exception-handling\n[django-po-source]: https://raw.githubusercontent.com/encode/django-rest-framework/main/rest_framework/locale/en_US/LC_MESSAGES/django.po\n[django-language-preference]: https://docs.djangoproject.com/en/stable/topics/i18n/translation/#how-django-discovers-language-preference\n[django-locale-paths]: https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-LOCALE_PATHS\n[django-locale-name]: https://docs.djangoproject.com/en/stable/topics/i18n/#term-locale-name\n"
  },
  {
    "path": "docs/topics/rest-hypermedia-hateoas.md",
    "content": "# REST, Hypermedia & HATEOAS\n\n> You keep using that word \"REST\". I do not think it means what you think it means.\n>\n> &mdash; Mike Amundsen, [REST fest 2012 keynote][cite].\n\nFirst off, the disclaimer.  The name \"Django REST framework\" was decided back in early 2011 and was chosen simply to ensure the project would be easily found by developers. Throughout the documentation we try to use the more simple and technically correct terminology of \"Web APIs\".\n\nIf you are serious about designing a Hypermedia API, you should look to resources outside of this documentation to help inform your design choices.\n\nThe following fall into the \"required reading\" category.\n\n* Roy Fielding's dissertation - [Architectural Styles and\nthe Design of Network-based Software Architectures][dissertation].\n* Roy Fielding's \"[REST APIs must be hypertext-driven][hypertext-driven]\" blog post.\n* Leonard Richardson & Mike Amundsen's [RESTful Web APIs][restful-web-apis].\n* Mike Amundsen's [Building Hypermedia APIs with HTML5 and Node][building-hypermedia-apis].\n* Steve Klabnik's [Designing Hypermedia APIs][designing-hypermedia-apis].\n* The [Richardson Maturity Model][maturitymodel].\n\nFor a more thorough background, check out Klabnik's [Hypermedia API reading list][readinglist].\n\n## Building Hypermedia APIs with REST framework\n\nREST framework is an agnostic Web API toolkit.  It does help guide you towards building well-connected APIs, and makes it easy to design appropriate media types, but it does not strictly enforce any particular design style.\n\n## What REST framework provides.\n\nIt is self evident that REST framework makes it possible to build Hypermedia APIs.  The browsable API that it offers is built on HTML - the hypermedia language of the web.\n\nREST framework also includes [serialization] and [parser]/[renderer] components that make it easy to build appropriate media types, [hyperlinked relations][fields] for building well-connected systems, and great support for [content negotiation][conneg].\n\n## What REST framework doesn't provide.\n\nWhat REST framework doesn't do is give you machine readable hypermedia formats such as [HAL][hal], [Collection+JSON][collection], [JSON API][json-api] or HTML [microformats] by default, or the ability to auto-magically create fully HATEOAS style APIs that include hypermedia-based form descriptions and semantically labeled hyperlinks. Doing so would involve making opinionated choices about API design that should really remain outside of the framework's scope.\n\n[cite]: https://vimeo.com/channels/restfest/49503453\n[dissertation]: https://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm\n[hypertext-driven]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven\n[restful-web-apis]: http://restfulwebapis.org/\n[building-hypermedia-apis]: https://www.amazon.com/Building-Hypermedia-APIs-HTML5-Node/dp/1449306578\n[designing-hypermedia-apis]: http://designinghypermediaapis.com/\n[readinglist]: http://blog.steveklabnik.com/posts/2012-02-27-hypermedia-api-reading-list\n[maturitymodel]: https://martinfowler.com/articles/richardsonMaturityModel.html\n\n[hal]: http://stateless.co/hal_specification.html\n[collection]: http://www.amundsen.com/media-types/collection/\n[json-api]: http://jsonapi.org/\n[microformats]: http://microformats.org/wiki/Main_Page\n[serialization]: ../api-guide/serializers.md\n[parser]: ../api-guide/parsers.md\n[renderer]: ../api-guide/renderers.md\n[fields]: ../api-guide/fields.md\n[conneg]: ../api-guide/content-negotiation.md\n"
  },
  {
    "path": "docs/topics/writable-nested-serializers.md",
    "content": "> To save HTTP requests, it may be convenient to send related documents along with the request.\n>\n> &mdash; [JSON API specification for Ember Data][cite].\n\n# Writable nested serializers\n\nAlthough flat data structures serve to properly delineate between the individual entities in your service, there are cases where it may be more appropriate or convenient to use nested data structures.\n\nNested data structures are easy enough to work with if they're read-only - simply nest your serializer classes and you're good to go.  However, there are a few more subtleties to using writable nested serializers, due to the dependencies between the various model instances, and the need to save or delete multiple instances in a single action.\n\n## One-to-many data structures\n\n*Example of a **read-only** nested serializer.  Nothing complex to worry about here.*\n\n    class ToDoItemSerializer(serializers.ModelSerializer):\n        class Meta:\n            model = ToDoItem\n            fields = ['text', 'is_completed']\n\n    class ToDoListSerializer(serializers.ModelSerializer):\n        items = ToDoItemSerializer(many=True, read_only=True)\n\n        class Meta:\n            model = ToDoList\n            fields = ['title', 'items']\n\nSome example output from our serializer.\n\n    {\n        'title': 'Leaving party preparations',\n        'items': [\n            {'text': 'Compile playlist', 'is_completed': True},\n            {'text': 'Send invites', 'is_completed': False},\n            {'text': 'Clean house', 'is_completed': False}\n        ]\n    }\n\nLet's take a look at updating our nested one-to-many data structure.\n\n### Validation errors\n\n### Adding and removing items\n\n### Making PATCH requests\n\n\n[cite]: http://jsonapi.org/format/#url-based-json-api\n"
  },
  {
    "path": "docs/tutorial/1-serialization.md",
    "content": "# Tutorial 1: Serialization\n\n## Introduction\n\nThis tutorial will cover creating a simple pastebin code highlighting Web API.  Along the way it will introduce the various components that make up REST framework, and give you a comprehensive understanding of how everything fits together.\n\nThe tutorial is fairly in-depth, so you should probably get a cookie and a cup of your favorite brew before getting started.  If you just want a quick overview, you should head over to the [quickstart] documentation instead.\n\n!!! note\n    The code for this tutorial is available in the [encode/rest-framework-tutorial][repo] repository on GitHub. Feel free to clone the repository and see the code in action.\n\n## Setting up a new environment\n\nBefore we do anything else we'll create a new virtual environment called `.venv`, using [venv]. This will make sure our package configuration is kept nicely isolated from any other projects we're working on.\n\n=== \":fontawesome-brands-linux: Linux, :fontawesome-brands-apple: macOS\"\n\n    ```bash\n    python3 -m venv .venv\n    source .venv/bin/activate\n    ```\n\n=== \":fontawesome-brands-windows: Windows\"\n\n    If you use Bash for Windows\n\n    ```bash\n    python3 -m venv .venv\n    source .venv\\Scripts\\activate\n    ```\n\nNow that we're inside a virtual environment, we can install our package requirements.\n\n```bash\npip install django\npip install djangorestframework\npip install pygments  # We'll be using this for the code highlighting\n```\n\n!!! tip\n    To exit the virtual environment at any time, just type `deactivate`.  For more information see the [venv documentation][venv].\n\n## Getting started\n\nOkay, we're ready to get coding.\nTo get started, let's create a new project to work with.\n\n```bash\ncd ~\ndjango-admin startproject tutorial\ncd tutorial\n```\n\nOnce that's done we can create an app that we'll use to create a simple Web API.\n\n```bash\npython manage.py startapp snippets\n```\n\nWe'll need to add our new `snippets` app and the `rest_framework` app to `INSTALLED_APPS`. Let's edit the `tutorial/settings.py` file:\n\n```text\nINSTALLED_APPS = [\n    ...\n    'rest_framework',\n    'snippets',\n]\n```\n\nOkay, we're ready to roll.\n\n## Creating a model to work with\n\nFor the purposes of this tutorial we're going to start by creating a simple `Snippet` model that is used to store code snippets.  Go ahead and edit the `snippets/models.py` file.  Note: Good programming practices include comments.  Although you will find them in our repository version of this tutorial code, we have omitted them here to focus on the code itself.\n\n```python\nfrom django.db import models\nfrom pygments.lexers import get_all_lexers\nfrom pygments.styles import get_all_styles\n\nLEXERS = [item for item in get_all_lexers() if item[1]]\nLANGUAGE_CHOICES = sorted([(item[1][0], item[0]) for item in LEXERS])\nSTYLE_CHOICES = sorted([(item, item) for item in get_all_styles()])\n\n\nclass Snippet(models.Model):\n    created = models.DateTimeField(auto_now_add=True)\n    title = models.CharField(max_length=100, blank=True, default=\"\")\n    code = models.TextField()\n    linenos = models.BooleanField(default=False)\n    language = models.CharField(\n        choices=LANGUAGE_CHOICES, default=\"python\", max_length=100\n    )\n    style = models.CharField(choices=STYLE_CHOICES, default=\"friendly\", max_length=100)\n\n    class Meta:\n        ordering = [\"created\"]\n```\n\nWe'll also need to create an initial migration for our snippet model, and sync the database for the first time.\n\n```bash\npython manage.py makemigrations snippets\npython manage.py migrate snippets\n```\n\n## Creating a Serializer class\n\nThe first thing we need to get started on our Web API is to provide a way of serializing and deserializing the snippet instances into representations such as `json`.  We can do this by declaring serializers that work very similar to Django's forms.  Create a file in the `snippets` directory named `serializers.py` and add the following.\n\n```python\nfrom rest_framework import serializers\nfrom snippets.models import Snippet, LANGUAGE_CHOICES, STYLE_CHOICES\n\n\nclass SnippetSerializer(serializers.Serializer):\n    id = serializers.IntegerField(read_only=True)\n    title = serializers.CharField(required=False, allow_blank=True, max_length=100)\n    code = serializers.CharField(style={\"base_template\": \"textarea.html\"})\n    linenos = serializers.BooleanField(required=False)\n    language = serializers.ChoiceField(choices=LANGUAGE_CHOICES, default=\"python\")\n    style = serializers.ChoiceField(choices=STYLE_CHOICES, default=\"friendly\")\n\n    def create(self, validated_data):\n        \"\"\"\n        Create and return a new `Snippet` instance, given the validated data.\n        \"\"\"\n        return Snippet.objects.create(**validated_data)\n\n    def update(self, instance, validated_data):\n        \"\"\"\n        Update and return an existing `Snippet` instance, given the validated data.\n        \"\"\"\n        instance.title = validated_data.get(\"title\", instance.title)\n        instance.code = validated_data.get(\"code\", instance.code)\n        instance.linenos = validated_data.get(\"linenos\", instance.linenos)\n        instance.language = validated_data.get(\"language\", instance.language)\n        instance.style = validated_data.get(\"style\", instance.style)\n        instance.save()\n        return instance\n```\n\nThe first part of the serializer class defines the fields that get serialized/deserialized.  The `create()` and `update()` methods define how fully fledged instances are created or modified when calling `serializer.save()`\n\nA serializer class is very similar to a Django `Form` class, and includes similar validation flags on the various fields, such as `required`, `max_length` and `default`.\n\nThe field flags can also control how the serializer should be displayed in certain circumstances, such as when rendering to HTML. The `{'base_template': 'textarea.html'}` flag above is equivalent to using `widget=widgets.Textarea` on a Django `Form` class. This is particularly useful for controlling how the browsable API should be displayed, as we'll see later in the tutorial.\n\nWe can actually also save ourselves some time by using the `ModelSerializer` class, as we'll see later, but for now we'll keep our serializer definition explicit.\n\n## Working with Serializers\n\nBefore we go any further we'll familiarize ourselves with using our new Serializer class.  Let's drop into the Django shell.\n\n```bash\npython manage.py shell\n```\n\nOkay, once we've got a few imports out of the way, let's create a couple of code snippets to work with.\n\n```pycon\n>>> from snippets.models import Snippet\n>>> from snippets.serializers import SnippetSerializer\n>>> from rest_framework.renderers import JSONRenderer\n>>> from rest_framework.parsers import JSONParser\n\n>>> snippet = Snippet(code='foo = \"bar\"\\n')\n>>> snippet.save()\n\n>>> snippet = Snippet(code='print(\"hello, world\")\\n')\n>>> snippet.save()\n```\n\nWe've now got a few snippet instances to play with.  Let's take a look at serializing one of those instances.\n\n```pycon\n>>> serializer = SnippetSerializer(snippet)\n>>> serializer.data\n{'id': 2, 'title': '', 'code': 'print(\"hello, world\")\\n', 'linenos': False, 'language': 'python', 'style': 'friendly'}\n```\n\nAt this point we've translated the model instance into Python native datatypes.  To finalize the serialization process we render the data into `json`.\n\n```pycon\n>>> content = JSONRenderer().render(serializer.data)\n>>> content\nb'{\"id\":2,\"title\":\"\",\"code\":\"print(\\\\\"hello, world\\\\\")\\\\n\",\"linenos\":false,\"language\":\"python\",\"style\":\"friendly\"}'\n```\n\nDeserialization is similar.  First we parse a stream into Python native datatypes...\n\n```pycon\n>>> import io\n\n>>> stream = io.BytesIO(content)\n>>> data = JSONParser().parse(stream)\n```\n\n...then we restore those native datatypes into a fully populated object instance.\n\n```pycon\n>>> serializer = SnippetSerializer(data=data)\n>>> serializer.is_valid()\nTrue\n>>> serializer.validated_data\n{'title': '', 'code': 'print(\"hello, world\")', 'linenos': False, 'language': 'python', 'style': 'friendly'}\n>>> serializer.save()\n<Snippet: Snippet object>\n```\n\nNotice how similar the API is to working with forms.  The similarity should become even more apparent when we start writing views that use our serializer.\n\nWe can also serialize querysets instead of model instances.  To do so we simply add a `many=True` flag to the serializer arguments.\n\n```pycon\n>>> serializer = SnippetSerializer(Snippet.objects.all(), many=True)\n>>> serializer.data\n[{'id': 1, 'title': '', 'code': 'foo = \"bar\"\\n', 'linenos': False, 'language': 'python', 'style': 'friendly'}, {'id': 2, 'title': '', 'code': 'print(\"hello, world\")\\n', 'linenos': False, 'language': 'python', 'style': 'friendly'}, {'id': 3, 'title': '', 'code': 'print(\"hello, world\")', 'linenos': False, 'language': 'python', 'style': 'friendly'}]\n```\n\n## Using ModelSerializers\n\nOur `SnippetSerializer` class is replicating a lot of information that's also contained in the `Snippet` model.  It would be nice if we could keep our code a bit more concise.\n\nIn the same way that Django provides both `Form` classes and `ModelForm` classes, REST framework includes both `Serializer` classes, and `ModelSerializer` classes.\n\nLet's look at refactoring our serializer using the `ModelSerializer` class.\nOpen the file `snippets/serializers.py` again, and replace the `SnippetSerializer` class with the following.\n\n```python\nfrom rest_framework import serializers\nfrom snippets.models import Snippet\n\n\nclass SnippetSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = Snippet\n        fields = [\"id\", \"title\", \"code\", \"linenos\", \"language\", \"style\"]\n```\n\nOne nice property that serializers have is that you can inspect all the fields in a serializer instance, by printing its representation. Open the Django shell with `python manage.py shell`, then try the following:\n\n```pycon\n>>> from snippets.serializers import SnippetSerializer\n\n>>> serializer = SnippetSerializer()\n>>> print(repr(serializer))\nSnippetSerializer():\n    id = IntegerField(label='ID', read_only=True)\n    title = CharField(allow_blank=True, max_length=100, required=False)\n    code = CharField(style={'base_template': 'textarea.html'})\n    linenos = BooleanField(required=False)\n    language = ChoiceField(choices=[('Clipper', 'FoxPro'), ('Cucumber', 'Gherkin'), ('RobotFramework', 'RobotFramework'), ('abap', 'ABAP'), ('ada', 'Ada')...\n    style = ChoiceField(choices=[('autumn', 'autumn'), ('borland', 'borland'), ('bw', 'bw'), ('colorful', 'colorful')...\n```\n\nIt's important to remember that `ModelSerializer` classes don't do anything particularly magical, they are simply a shortcut for creating serializer classes:\n\n* An automatically determined set of fields.\n* Simple default implementations for the `create()` and `update()` methods.\n\n## Writing regular Django views using our Serializer\n\nLet's see how we can write some API views using our new Serializer class.\nFor the moment we won't use any of REST framework's other features, we'll just write the views as regular Django views.\n\nEdit the `snippets/views.py` file, and add the following.\n\n```python\nfrom django.http import HttpResponse, JsonResponse\nfrom django.views.decorators.csrf import csrf_exempt\nfrom rest_framework.parsers import JSONParser\nfrom snippets.models import Snippet\nfrom snippets.serializers import SnippetSerializer\n```\n\nThe root of our API is going to be a view that supports listing all the existing snippets, or creating a new snippet.\n\n```python\n@csrf_exempt\ndef snippet_list(request):\n    \"\"\"\n    List all code snippets, or create a new snippet.\n    \"\"\"\n    if request.method == \"GET\":\n        snippets = Snippet.objects.all()\n        serializer = SnippetSerializer(snippets, many=True)\n        return JsonResponse(serializer.data, safe=False)\n\n    elif request.method == \"POST\":\n        data = JSONParser().parse(request)\n        serializer = SnippetSerializer(data=data)\n        if serializer.is_valid():\n            serializer.save()\n            return JsonResponse(serializer.data, status=201)\n        return JsonResponse(serializer.errors, status=400)\n```\n\nNote that because we want to be able to POST to this view from clients that won't have a CSRF token we need to mark the view as `csrf_exempt`.  This isn't something that you'd normally want to do, and REST framework views actually use more sensible behavior than this, but it'll do for our purposes right now.\n\nWe'll also need a view which corresponds to an individual snippet, and can be used to retrieve, update or delete the snippet.\n\n```python\n@csrf_exempt\ndef snippet_detail(request, pk):\n    \"\"\"\n    Retrieve, update or delete a code snippet.\n    \"\"\"\n    try:\n        snippet = Snippet.objects.get(pk=pk)\n    except Snippet.DoesNotExist:\n        return HttpResponse(status=404)\n\n    if request.method == \"GET\":\n        serializer = SnippetSerializer(snippet)\n        return JsonResponse(serializer.data)\n\n    elif request.method == \"PUT\":\n        data = JSONParser().parse(request)\n        serializer = SnippetSerializer(snippet, data=data)\n        if serializer.is_valid():\n            serializer.save()\n            return JsonResponse(serializer.data)\n        return JsonResponse(serializer.errors, status=400)\n\n    elif request.method == \"DELETE\":\n        snippet.delete()\n        return HttpResponse(status=204)\n```\n\nFinally we need to wire these views up.  Create the `snippets/urls.py` file:\n\n```python\nfrom django.urls import path\nfrom snippets import views\n\nurlpatterns = [\n    path(\"snippets/\", views.snippet_list),\n    path(\"snippets/<int:pk>/\", views.snippet_detail),\n]\n```\n\nWe also need to wire up the root urlconf, in the `tutorial/urls.py` file, to include our snippet app's URLs.\n\n```python\nfrom django.urls import path, include\n\nurlpatterns = [\n    path(\"\", include(\"snippets.urls\")),\n]\n```\n\nIt's worth noting that there are a couple of edge cases we're not dealing with properly at the moment.  If we send malformed `json`, or if a request is made with a method that the view doesn't handle, then we'll end up with a 500 \"server error\" response.  Still, this'll do for now.\n\n## Testing our first attempt at a Web API\n\nNow we can start up a sample server that serves our snippets.\n\nQuit out of the shell...\n\n```pycon\n>>> quit()\n```\n\n...and start up Django's development server.\n\n```bash\npython manage.py runserver\n\nValidating models...\n\n0 errors found\nDjango version 5.0, using settings 'tutorial.settings'\nStarting Development server at http://127.0.0.1:8000/\nQuit the server with CONTROL-C.\n```\n\nIn another terminal window, we can test the server.\n\nWe can test our API using [curl][curl] or [HTTPie][HTTPie]. HTTPie is a user-friendly http client that's written in Python. Let's install that.\n\nYou can install HTTPie using pip:\n\n```bash\npip install httpie\n```\n\nFinally, we can get a list of all of the snippets:\n\n```bash\nhttp GET http://127.0.0.1:8000/snippets/ --unsorted\n\nHTTP/1.1 200 OK\n...\n[\n    {\n        \"id\": 1,\n        \"title\": \"\",\n        \"code\": \"foo = \\\"bar\\\"\\n\",\n        \"linenos\": false,\n        \"language\": \"python\",\n        \"style\": \"friendly\"\n    },\n    {\n        \"id\": 2,\n        \"title\": \"\",\n        \"code\": \"print(\\\"hello, world\\\")\\n\",\n        \"linenos\": false,\n        \"language\": \"python\",\n        \"style\": \"friendly\"\n    },\n    {\n        \"id\": 3,\n        \"title\": \"\",\n        \"code\": \"print(\\\"hello, world\\\")\",\n        \"linenos\": false,\n        \"language\": \"python\",\n        \"style\": \"friendly\"\n    }\n]\n```\n\nOr we can get a particular snippet by referencing its id:\n\n```bash\nhttp GET http://127.0.0.1:8000/snippets/2/ --unsorted\n\nHTTP/1.1 200 OK\n...\n{\n    \"id\": 2,\n    \"title\": \"\",\n    \"code\": \"print(\\\"hello, world\\\")\\n\",\n    \"linenos\": false,\n    \"language\": \"python\",\n    \"style\": \"friendly\"\n}\n```\n\nSimilarly, you can have the same json displayed by visiting these URLs in a web browser.\n\n## Where are we now\n\nWe're doing okay so far, we've got a serialization API that feels pretty similar to Django's Forms API, and some regular Django views.\n\nOur API views don't do anything particularly special at the moment, beyond serving `json` responses, and there are some error handling edge cases we'd still like to clean up, but it's a functioning Web API.\n\nWe'll see how we can start to improve things in [part 2 of the tutorial][tut-2].\n\n[quickstart]: quickstart.md\n[repo]: https://github.com/encode/rest-framework-tutorial\n[venv]: https://docs.python.org/3/library/venv.html\n[tut-2]: 2-requests-and-responses.md\n[HTTPie]: https://github.com/httpie/httpie#installation\n[curl]: https://curl.haxx.se/\n"
  },
  {
    "path": "docs/tutorial/2-requests-and-responses.md",
    "content": "# Tutorial 2: Requests and Responses\n\nFrom this point we're going to really start covering the core of REST framework.\nLet's introduce a couple of essential building blocks.\n\n## Request objects\n\nREST framework introduces a `Request` object that extends the regular `HttpRequest`, and provides more flexible request parsing.  The core functionality of the `Request` object is the `request.data` attribute, which is similar to `request.POST`, but more useful for working with Web APIs.\n\n```python\nrequest.POST  # Only handles form data.  Only works for 'POST' method.\nrequest.data  # Handles arbitrary data.  Works for 'POST', 'PUT' and 'PATCH' methods.\n```\n\n## Response objects\n\nREST framework also introduces a `Response` object, which is a type of `TemplateResponse` that takes unrendered content and uses content negotiation to determine the correct content type to return to the client.\n\n```python\nreturn Response(data)  # Renders to content type as requested by the client.\n```\n\n## Status codes\n\nUsing numeric HTTP status codes in your views doesn't always make for obvious reading, and it's easy to not notice if you get an error code wrong.  REST framework provides more explicit identifiers for each status code, such as `HTTP_400_BAD_REQUEST` in the `status` module.  It's a good idea to use these throughout rather than using numeric identifiers.\n\n## Wrapping API views\n\nREST framework provides two wrappers you can use to write API views.\n\n1. The `@api_view` decorator for working with function based views.\n2. The `APIView` class for working with class-based views.\n\nThese wrappers provide a few bits of functionality such as making sure you receive `Request` instances in your view, and adding context to `Response` objects so that content negotiation can be performed.\n\nThe wrappers also provide behavior such as returning `405 Method Not Allowed` responses when appropriate, and handling any `ParseError` exceptions that occur when accessing `request.data` with malformed input.\n\n## Pulling it all together\n\nOkay, let's go ahead and start using these new components to refactor our views slightly.\n\n```python\nfrom rest_framework import status\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\nfrom snippets.models import Snippet\nfrom snippets.serializers import SnippetSerializer\n\n\n@api_view([\"GET\", \"POST\"])\ndef snippet_list(request):\n    \"\"\"\n    List all code snippets, or create a new snippet.\n    \"\"\"\n    if request.method == \"GET\":\n        snippets = Snippet.objects.all()\n        serializer = SnippetSerializer(snippets, many=True)\n        return Response(serializer.data)\n\n    elif request.method == \"POST\":\n        serializer = SnippetSerializer(data=request.data)\n        if serializer.is_valid():\n            serializer.save()\n            return Response(serializer.data, status=status.HTTP_201_CREATED)\n        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n```\n\nOur instance view is an improvement over the previous example.  It's a little more concise, and the code now feels very similar to if we were working with the Forms API.  We're also using named status codes, which makes the response meanings more obvious.\n\nHere is the view for an individual snippet, in the `views.py` module.\n\n```python\n@api_view([\"GET\", \"PUT\", \"DELETE\"])\ndef snippet_detail(request, pk):\n    \"\"\"\n    Retrieve, update or delete a code snippet.\n    \"\"\"\n    try:\n        snippet = Snippet.objects.get(pk=pk)\n    except Snippet.DoesNotExist:\n        return Response(status=status.HTTP_404_NOT_FOUND)\n\n    if request.method == \"GET\":\n        serializer = SnippetSerializer(snippet)\n        return Response(serializer.data)\n\n    elif request.method == \"PUT\":\n        serializer = SnippetSerializer(snippet, data=request.data)\n        if serializer.is_valid():\n            serializer.save()\n            return Response(serializer.data)\n        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n\n    elif request.method == \"DELETE\":\n        snippet.delete()\n        return Response(status=status.HTTP_204_NO_CONTENT)\n```\n\nThis should all feel very familiar - it is not a lot different from working with regular Django views.\n\nNotice that we're no longer explicitly tying our requests or responses to a given content type.  `request.data` can handle incoming `json` requests, but it can also handle other formats.  Similarly we're returning response objects with data, but allowing REST framework to render the response into the correct content type for us.\n\n## Adding optional format suffixes to our URLs\n\nTo take advantage of the fact that our responses are no longer hardwired to a single content type let's add support for format suffixes to our API endpoints.  Using format suffixes gives us URLs that explicitly refer to a given format, and means our API will be able to handle URLs such as [<http://example.com/api/items/4.json>][json-url].\n\nStart by adding a `format` keyword argument to both of the views, like so.\n`def snippet_list(request, format=None):`\nand\n`def snippet_detail(request, pk, format=None):`\n\nNow update the `snippets/urls.py` file slightly, to append a set of `format_suffix_patterns` in addition to the existing URLs.\n\n```python\nfrom django.urls import path\nfrom rest_framework.urlpatterns import format_suffix_patterns\nfrom snippets import views\n\nurlpatterns = [\n    path(\"snippets/\", views.snippet_list),\n    path(\"snippets/<int:pk>/\", views.snippet_detail),\n]\n\nurlpatterns = format_suffix_patterns(urlpatterns)\n```\n\nWe don't necessarily need to add these extra url patterns in, but it gives us a simple, clean way of referring to a specific format.\n\n## How's it looking?\n\nGo ahead and test the API from the command line, as we did in [tutorial part 1][tut-1].  Everything is working pretty similarly, although we've got some nicer error handling if we send invalid requests.\n\nWe can get a list of all of the snippets, as before.\n\n```bash\nhttp http://127.0.0.1:8000/snippets/\n\nHTTP/1.1 200 OK\n...\n[\n    {\n    \"id\": 1,\n    \"title\": \"\",\n    \"code\": \"foo = \\\"bar\\\"\\n\",\n    \"linenos\": false,\n    \"language\": \"python\",\n    \"style\": \"friendly\"\n    },\n    {\n    \"id\": 2,\n    \"title\": \"\",\n    \"code\": \"print(\\\"hello, world\\\")\\n\",\n    \"linenos\": false,\n    \"language\": \"python\",\n    \"style\": \"friendly\"\n    }\n]\n```\n\nWe can control the format of the response that we get back, either by using the `Accept` header:\n\n```bash\nhttp http://127.0.0.1:8000/snippets/ Accept:application/json  # Request JSON\nhttp http://127.0.0.1:8000/snippets/ Accept:text/html         # Request HTML\n```\n\nOr by appending a format suffix:\n\n```bash\nhttp http://127.0.0.1:8000/snippets.json  # JSON suffix\nhttp http://127.0.0.1:8000/snippets.api   # Browsable API suffix\n```\n\nSimilarly, we can control the format of the request that we send, using the `Content-Type` header.\n\n```bash\n# POST using form data\nhttp --form POST http://127.0.0.1:8000/snippets/ code=\"print(123)\"\n\n{\n    \"id\": 3,\n    \"title\": \"\",\n    \"code\": \"print(123)\",\n    \"linenos\": false,\n    \"language\": \"python\",\n    \"style\": \"friendly\"\n}\n\n# POST using JSON\nhttp --json POST http://127.0.0.1:8000/snippets/ code=\"print(456)\"\n\n{\n    \"id\": 4,\n    \"title\": \"\",\n    \"code\": \"print(456)\",\n    \"linenos\": false,\n    \"language\": \"python\",\n    \"style\": \"friendly\"\n}\n```\n\nIf you add a `--debug` switch to the `http` requests above, you will be able to see the request type in request headers.\n\nNow go and open the API in a web browser, by visiting [<http://127.0.0.1:8000/snippets/>][devserver].\n\n### Browsability\n\nBecause the API chooses the content type of the response based on the client request, it will, by default, return an HTML-formatted representation of the resource when that resource is requested by a web browser.  This allows for the API to return a fully web-browsable HTML representation.\n\nHaving a web-browsable API is a huge usability win, and makes developing and using your API much easier.  It also dramatically lowers the barrier-to-entry for other developers wanting to inspect and work with your API.\n\nSee the [browsable api][browsable-api] topic for more information about the browsable API feature and how to customize it.\n\n## What's next?\n\nIn [tutorial part 3][tut-3], we'll start using class-based views, and see how generic views reduce the amount of code we need to write.\n\n[json-url]: http://example.com/api/items/4.json\n[devserver]: http://127.0.0.1:8000/snippets/\n[browsable-api]: ../topics/browsable-api.md\n[tut-1]: 1-serialization.md\n[tut-3]: 3-class-based-views.md\n"
  },
  {
    "path": "docs/tutorial/3-class-based-views.md",
    "content": "# Tutorial 3: Class-based Views\n\nWe can also write our API views using class-based views, rather than function based views.  As we'll see this is a powerful pattern that allows us to reuse common functionality, and helps us keep our code [DRY][dry].\n\n## Rewriting our API using class-based views\n\nWe'll start by rewriting the root view as a class-based view.  All this involves is a little bit of refactoring of `views.py`.\n\n```python\nfrom snippets.models import Snippet\nfrom snippets.serializers import SnippetSerializer\nfrom django.http import Http404\nfrom rest_framework.views import APIView\nfrom rest_framework.response import Response\nfrom rest_framework import status\n\n\nclass SnippetList(APIView):\n    \"\"\"\n    List all snippets, or create a new snippet.\n    \"\"\"\n\n    def get(self, request, format=None):\n        snippets = Snippet.objects.all()\n        serializer = SnippetSerializer(snippets, many=True)\n        return Response(serializer.data)\n\n    def post(self, request, format=None):\n        serializer = SnippetSerializer(data=request.data)\n        if serializer.is_valid():\n            serializer.save()\n            return Response(serializer.data, status=status.HTTP_201_CREATED)\n        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n```\n\nSo far, so good.  It looks pretty similar to the previous case, but we've got better separation between the different HTTP methods.  We'll also need to update the instance view in `views.py`.\n\n```python\nclass SnippetDetail(APIView):\n    \"\"\"\n    Retrieve, update or delete a snippet instance.\n    \"\"\"\n\n    def get_object(self, pk):\n        try:\n            return Snippet.objects.get(pk=pk)\n        except Snippet.DoesNotExist:\n            raise Http404\n\n    def get(self, request, pk, format=None):\n        snippet = self.get_object(pk)\n        serializer = SnippetSerializer(snippet)\n        return Response(serializer.data)\n\n    def put(self, request, pk, format=None):\n        snippet = self.get_object(pk)\n        serializer = SnippetSerializer(snippet, data=request.data)\n        if serializer.is_valid():\n            serializer.save()\n            return Response(serializer.data)\n        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n\n    def delete(self, request, pk, format=None):\n        snippet = self.get_object(pk)\n        snippet.delete()\n        return Response(status=status.HTTP_204_NO_CONTENT)\n```\n\nThat's looking good.  Again, it's still pretty similar to the function based view right now.\n\nWe'll also need to refactor our `snippets/urls.py` slightly now that we're using class-based views.\n\n```python\nfrom django.urls import path\nfrom rest_framework.urlpatterns import format_suffix_patterns\nfrom snippets import views\n\nurlpatterns = [\n    path(\"snippets/\", views.SnippetList.as_view()),\n    path(\"snippets/<int:pk>/\", views.SnippetDetail.as_view()),\n]\n\nurlpatterns = format_suffix_patterns(urlpatterns)\n```\n\nOkay, we're done.  If you run the development server everything should be working just as before.\n\n## Using mixins\n\nOne of the big wins of using class-based views is that it allows us to easily compose reusable bits of behavior.\n\nThe create/retrieve/update/delete operations that we've been using so far are going to be pretty similar for any model-backed API views we create.  Those bits of common behavior are implemented in REST framework's mixin classes.\n\nLet's take a look at how we can compose the views by using the mixin classes.  Here's our `views.py` module again.\n\n```python\nfrom snippets.models import Snippet\nfrom snippets.serializers import SnippetSerializer\nfrom rest_framework import mixins\nfrom rest_framework import generics\n\n\nclass SnippetList(\n    mixins.ListModelMixin, mixins.CreateModelMixin, generics.GenericAPIView\n):\n    queryset = Snippet.objects.all()\n    serializer_class = SnippetSerializer\n\n    def get(self, request, *args, **kwargs):\n        return self.list(request, *args, **kwargs)\n\n    def post(self, request, *args, **kwargs):\n        return self.create(request, *args, **kwargs)\n```\n\nWe'll take a moment to examine exactly what's happening here.  We're building our view using `GenericAPIView`, and adding in `ListModelMixin` and `CreateModelMixin`.\n\nThe base class provides the core functionality, and the mixin classes provide the `.list()` and `.create()` actions.  We're then explicitly binding the `get` and `post` methods to the appropriate actions.  Simple enough stuff so far.\n\n```python\nclass SnippetDetail(\n    mixins.RetrieveModelMixin,\n    mixins.UpdateModelMixin,\n    mixins.DestroyModelMixin,\n    generics.GenericAPIView,\n):\n    queryset = Snippet.objects.all()\n    serializer_class = SnippetSerializer\n\n    def get(self, request, *args, **kwargs):\n        return self.retrieve(request, *args, **kwargs)\n\n    def put(self, request, *args, **kwargs):\n        return self.update(request, *args, **kwargs)\n\n    def delete(self, request, *args, **kwargs):\n        return self.destroy(request, *args, **kwargs)\n```\n\nPretty similar.  Again we're using the `GenericAPIView` class to provide the core functionality, and adding in mixins to provide the `.retrieve()`, `.update()` and `.destroy()` actions.\n\n## Using generic class-based views\n\nUsing the mixin classes we've rewritten the views to use slightly less code than before, but we can go one step further.  REST framework provides a set of already mixed-in generic views that we can use to trim down our `views.py` module even more.\n\n```python\nfrom snippets.models import Snippet\nfrom snippets.serializers import SnippetSerializer\nfrom rest_framework import generics\n\n\nclass SnippetList(generics.ListCreateAPIView):\n    queryset = Snippet.objects.all()\n    serializer_class = SnippetSerializer\n\n\nclass SnippetDetail(generics.RetrieveUpdateDestroyAPIView):\n    queryset = Snippet.objects.all()\n    serializer_class = SnippetSerializer\n```\n\nWow, that's pretty concise.  We've gotten a huge amount for free, and our code looks like good, clean, idiomatic Django.\n\nNext we'll move onto [part 4 of the tutorial][tut-4], where we'll take a look at how we can deal with authentication and permissions for our API.\n\n[dry]: https://en.wikipedia.org/wiki/Don't_repeat_yourself\n[tut-4]: 4-authentication-and-permissions.md\n"
  },
  {
    "path": "docs/tutorial/4-authentication-and-permissions.md",
    "content": "# Tutorial 4: Authentication & Permissions\n\nCurrently our API doesn't have any restrictions on who can edit or delete code snippets.  We'd like to have some more advanced behavior in order to make sure that:\n\n* Code snippets are always associated with a creator.\n* Only authenticated users may create snippets.\n* Only the creator of a snippet may update or delete it.\n* Unauthenticated requests should have full read-only access.\n\n## Adding information to our model\n\nWe're going to make a couple of changes to our `Snippet` model class.\nFirst, let's add a couple of fields.  One of those fields will be used to represent the user who created the code snippet.  The other field will be used to store the highlighted HTML representation of the code.\n\nAdd the following two fields to the `Snippet` model in `models.py`.\n\n```python\nowner = models.ForeignKey(\n    \"auth.User\", related_name=\"snippets\", on_delete=models.CASCADE\n)\nhighlighted = models.TextField()\n```\n\nWe'd also need to make sure that when the model is saved, that we populate the highlighted field, using the `pygments` code highlighting library.\n\nWe'll need some extra imports:\n\n```python\nfrom pygments.lexers import get_lexer_by_name\nfrom pygments.formatters.html import HtmlFormatter\nfrom pygments import highlight\n```\n\nAnd now we can add a `.save()` method to our model class:\n\n```python\ndef save(self, *args, **kwargs):\n    \"\"\"\n    Use the `pygments` library to create a highlighted HTML\n    representation of the code snippet.\n    \"\"\"\n    lexer = get_lexer_by_name(self.language)\n    linenos = \"table\" if self.linenos else False\n    options = {\"title\": self.title} if self.title else {}\n    formatter = HtmlFormatter(style=self.style, linenos=linenos, full=True, **options)\n    self.highlighted = highlight(self.code, lexer, formatter)\n    super().save(*args, **kwargs)\n```\n\nWhen that's all done we'll need to update our database tables.\nNormally we'd create a database migration in order to do that, but for the purposes of this tutorial, let's just delete the database and start again.\n\n```bash\nrm -f db.sqlite3\nrm -r snippets/migrations\npython manage.py makemigrations snippets\npython manage.py migrate\n```\n\nYou might also want to create a few different users, to use for testing the API.  The quickest way to do this will be with the `createsuperuser` command.\n\n```bash\npython manage.py createsuperuser\n```\n\n## Adding endpoints for our User models\n\nNow that we've got some users to work with, we'd better add representations of those users to our API.  Creating a new serializer is easy. In `serializers.py` add:\n\n```python\nfrom django.contrib.auth.models import User\n\n\nclass UserSerializer(serializers.ModelSerializer):\n    snippets = serializers.PrimaryKeyRelatedField(\n        many=True, queryset=Snippet.objects.all()\n    )\n\n    class Meta:\n        model = User\n        fields = [\"id\", \"username\", \"snippets\"]\n```\n\nBecause `'snippets'` is a *reverse* relationship on the User model, it will not be included by default when using the `ModelSerializer` class, so we needed to add an explicit field for it.\n\nWe'll also add a couple of views to `views.py`.  We'd like to just use read-only views for the user representations, so we'll use the `ListAPIView` and `RetrieveAPIView` generic class-based views.\n\n```python\nfrom django.contrib.auth.models import User\n\n\nclass UserList(generics.ListAPIView):\n    queryset = User.objects.all()\n    serializer_class = UserSerializer\n\n\nclass UserDetail(generics.RetrieveAPIView):\n    queryset = User.objects.all()\n    serializer_class = UserSerializer\n```\n\nMake sure to also import the `UserSerializer` class\n\n```python\nfrom snippets.serializers import UserSerializer\n```\n\nFinally we need to add those views into the API, by referencing them from the URL conf. Add the following to the patterns in `snippets/urls.py`.\n\n```python\npath(\"users/\", views.UserList.as_view()),\npath(\"users/<int:pk>/\", views.UserDetail.as_view()),\n```\n\n## Associating Snippets with Users\n\nRight now, if we created a code snippet, there'd be no way of associating the user that created the snippet, with the snippet instance.  The user isn't sent as part of the serialized representation, but is instead a property of the incoming request.\n\nThe way we deal with that is by overriding a `.perform_create()` method on our snippet views, that allows us to modify how the instance save is managed, and handle any information that is implicit in the incoming request or requested URL.\n\nOn the `SnippetList` view class, add the following method:\n\n```python\ndef perform_create(self, serializer):\n    serializer.save(owner=self.request.user)\n```\n\nThe `create()` method of our serializer will now be passed an additional `'owner'` field, along with the validated data from the request.\n\n## Updating our serializer\n\nNow that snippets are associated with the user that created them, let's update our `SnippetSerializer` to reflect that.  Add the following field to the serializer definition in `serializers.py`:\n\n```python\nowner = serializers.ReadOnlyField(source=\"owner.username\")\n```\n\n!!! note\n    Make sure you also add `'owner',` to the list of fields in the inner `Meta` class.\n\nThis field is doing something quite interesting.  The `source` argument controls which attribute is used to populate a field, and can point at any attribute on the serialized instance.  It can also take the dotted notation shown above, in which case it will traverse the given attributes, in a similar way as it is used with Django's template language.\n\nThe field we've added is the untyped `ReadOnlyField` class, in contrast to the other typed fields, such as `CharField`, `BooleanField` etc...  The untyped `ReadOnlyField` is always read-only, and will be used for serialized representations, but will not be used for updating model instances when they are deserialized. We could have also used `CharField(read_only=True)` here.\n\n## Adding required permissions to views\n\nNow that code snippets are associated with users, we want to make sure that only authenticated users are able to create, update and delete code snippets.\n\nREST framework includes a number of permission classes that we can use to restrict who can access a given view.  In this case the one we're looking for is `IsAuthenticatedOrReadOnly`, which will ensure that authenticated requests get read-write access, and unauthenticated requests get read-only access.\n\nFirst add the following import in the views module\n\n```python\nfrom rest_framework import permissions\n```\n\nThen, add the following property to **both** the `SnippetList` and `SnippetDetail` view classes.\n\n```python\npermission_classes = [permissions.IsAuthenticatedOrReadOnly]\n```\n\n## Adding login to the Browsable API\n\nIf you open a browser and navigate to the browsable API at the moment, you'll find that you're no longer able to create new code snippets.  In order to do so we'd need to be able to login as a user.\n\nWe can add a login view for use with the browsable API, by editing the URLconf in our project-level `urls.py` file.\n\nAdd the following import at the top of the file:\n\n```python\nfrom django.urls import path, include\n```\n\nAnd, at the end of the file, add a pattern to include the login and logout views for the browsable API.\n\n```python\nurlpatterns += [\n    path(\"api-auth/\", include(\"rest_framework.urls\")),\n]\n```\n\nThe `'api-auth/'` part of pattern can actually be whatever URL you want to use.\n\nNow if you open up the browser again and refresh the page you'll see a 'Login' link in the top right of the page.  If you log in as one of the users you created earlier, you'll be able to create code snippets again.\n\nOnce you've created a few code snippets, navigate to the '/users/' endpoint, and notice that the representation includes a list of the snippet ids that are associated with each user, in each user's 'snippets' field.\n\n## Object level permissions\n\nReally we'd like all code snippets to be visible to anyone, but also make sure that only the user that created a code snippet is able to update or delete it.\n\nTo do that we're going to need to create a custom permission.\n\nIn the snippets app, create a new file, `permissions.py`\n\n```python\nfrom rest_framework import permissions\n\n\nclass IsOwnerOrReadOnly(permissions.BasePermission):\n    \"\"\"\n    Custom permission to only allow owners of an object to edit it.\n    \"\"\"\n\n    def has_object_permission(self, request, view, obj):\n        # Read permissions are allowed to any request,\n        # so we'll always allow GET, HEAD or OPTIONS requests.\n        if request.method in permissions.SAFE_METHODS:\n            return True\n\n        # Write permissions are only allowed to the owner of the snippet.\n        return obj.owner == request.user\n```\n\nNow we can add that custom permission to our snippet instance endpoint, by editing the `permission_classes` property on the `SnippetDetail` view class:\n\n```python\npermission_classes = [permissions.IsAuthenticatedOrReadOnly, IsOwnerOrReadOnly]\n```\n\nMake sure to also import the `IsOwnerOrReadOnly` class.\n\n```python\nfrom snippets.permissions import IsOwnerOrReadOnly\n```\n\nNow, if you open a browser again, you find that the 'DELETE' and 'PUT' actions only appear on a snippet instance endpoint if you're logged in as the same user that created the code snippet.\n\n## Authenticating with the API\n\nBecause we now have a set of permissions on the API, we need to authenticate our requests to it if we want to edit any snippets.  We haven't set up any [authentication classes][authentication], so the defaults are currently applied, which are `SessionAuthentication` and `BasicAuthentication`.\n\nWhen we interact with the API through the web browser, we can login, and the browser session will then provide the required authentication for the requests.\n\nIf we're interacting with the API programmatically we need to explicitly provide the authentication credentials on each request.\n\nIf we try to create a snippet without authenticating, we'll get an error:\n\n```bash\nhttp POST http://127.0.0.1:8000/snippets/ code=\"print(123)\"\n\n{\n    \"detail\": \"Authentication credentials were not provided.\"\n}\n```\n\nWe can make a successful request by including the username and password of one of the users we created earlier.\n\n```bash\nhttp -a admin:password123 POST http://127.0.0.1:8000/snippets/ code=\"print(789)\"\n\n{\n    \"id\": 1,\n    \"owner\": \"admin\",\n    \"title\": \"foo\",\n    \"code\": \"print(789)\",\n    \"linenos\": false,\n    \"language\": \"python\",\n    \"style\": \"friendly\"\n}\n```\n\n## Summary\n\nWe've now got a fairly fine-grained set of permissions on our Web API, and end points for users of the system and for the code snippets that they have created.\n\nIn [part 5][tut-5] of the tutorial we'll look at how we can tie everything together by creating an HTML endpoint for our highlighted snippets, and improve the cohesion of our API by using hyperlinking for the relationships within the system.\n\n[authentication]: ../api-guide/authentication.md\n[tut-5]: 5-relationships-and-hyperlinked-apis.md\n"
  },
  {
    "path": "docs/tutorial/5-relationships-and-hyperlinked-apis.md",
    "content": "# Tutorial 5: Relationships & Hyperlinked APIs\n\nAt the moment relationships within our API are represented by using primary keys.  In this part of the tutorial we'll improve the cohesion and discoverability of our API, by instead using hyperlinking for relationships.\n\n## Creating an endpoint for the root of our API\n\nRight now we have endpoints for 'snippets' and 'users', but we don't have a single entry point to our API.  To create one, we'll use a regular function-based view and the `@api_view` decorator we introduced earlier. In your `snippets/views.py` add:\n\n```python\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\nfrom rest_framework.reverse import reverse\n\n\n@api_view([\"GET\"])\ndef api_root(request, format=None):\n    return Response(\n        {\n            \"users\": reverse(\"user-list\", request=request, format=format),\n            \"snippets\": reverse(\"snippet-list\", request=request, format=format),\n        }\n    )\n```\n\nTwo things should be noticed here. First, we're using REST framework's `reverse` function in order to return fully-qualified URLs; second, URL patterns are identified by convenience names that we will declare later on in our `snippets/urls.py`.\n\n## Creating an endpoint for the highlighted snippets\n\nThe other obvious thing that's still missing from our pastebin API is the code highlighting endpoints.\n\nUnlike all our other API endpoints, we don't want to use JSON, but instead just present an HTML representation.  There are two styles of HTML renderer provided by REST framework, one for dealing with HTML rendered using templates, the other for dealing with pre-rendered HTML.  The second renderer is the one we'd like to use for this endpoint.\n\nThe other thing we need to consider when creating the code highlight view is that there's no existing concrete generic view that we can use.  We're not returning an object instance, but instead a property of an object instance.\n\nInstead of using a concrete generic view, we'll use the base class for representing instances, and create our own `.get()` method.  In your `snippets/views.py` add:\n\n```python\nfrom rest_framework import renderers\n\n\nclass SnippetHighlight(generics.GenericAPIView):\n    queryset = Snippet.objects.all()\n    renderer_classes = [renderers.StaticHTMLRenderer]\n\n    def get(self, request, *args, **kwargs):\n        snippet = self.get_object()\n        return Response(snippet.highlighted)\n```\n\nAs usual we need to add the new views that we've created in to our URLconf.\nWe'll add a url pattern for our new API root in `snippets/urls.py`:\n\n```python\npath(\"\", views.api_root),\n```\n\nAnd then add a url pattern for the snippet highlights:\n\n```python\npath(\"snippets/<int:pk>/highlight/\", views.SnippetHighlight.as_view()),\n```\n\n## Hyperlinking our API\n\nDealing with relationships between entities is one of the more challenging aspects of Web API design.  There are a number of different ways that we might choose to represent a relationship:\n\n* Using primary keys.\n* Using hyperlinking between entities.\n* Using a unique identifying slug field on the related entity.\n* Using the default string representation of the related entity.\n* Nesting the related entity inside the parent representation.\n* Some other custom representation.\n\nREST framework supports all of these styles, and can apply them across forward or reverse relationships, or apply them across custom managers such as generic foreign keys.\n\nIn this case we'd like to use a hyperlinked style between entities.  In order to do so, we'll modify our serializers to extend `HyperlinkedModelSerializer` instead of the existing `ModelSerializer`.\n\nThe `HyperlinkedModelSerializer` has the following differences from `ModelSerializer`:\n\n* It does not include the `id` field by default.\n* It includes a `url` field, using `HyperlinkedIdentityField`.\n* Relationships use `HyperlinkedRelatedField`,\n  instead of `PrimaryKeyRelatedField`.\n\nWe can easily re-write our existing serializers to use hyperlinking. In your `snippets/serializers.py` add:\n\n```python\nclass SnippetSerializer(serializers.HyperlinkedModelSerializer):\n    owner = serializers.ReadOnlyField(source=\"owner.username\")\n    highlight = serializers.HyperlinkedIdentityField(\n        view_name=\"snippet-highlight\", format=\"html\"\n    )\n\n    class Meta:\n        model = Snippet\n        fields = [\n            \"url\",\n            \"id\",\n            \"highlight\",\n            \"owner\",\n            \"title\",\n            \"code\",\n            \"linenos\",\n            \"language\",\n            \"style\",\n        ]\n\n\nclass UserSerializer(serializers.HyperlinkedModelSerializer):\n    snippets = serializers.HyperlinkedRelatedField(\n        many=True, view_name=\"snippet-detail\", read_only=True\n    )\n\n    class Meta:\n        model = User\n        fields = [\"url\", \"id\", \"username\", \"snippets\"]\n```\n\nNotice that we've also added a new `'highlight'` field.  This field is of the same type as the `url` field, except that it points to the `'snippet-highlight'` url pattern, instead of the `'snippet-detail'` url pattern.\n\nBecause we've included format suffixed URLs such as `'.json'`, we also need to indicate on the `highlight` field that any format suffixed hyperlinks it returns should use the `'.html'` suffix.\n\n!!! note\n    When you are manually instantiating these serializers inside your views (e.g., in `SnippetDetail` or `SnippetList`), you **must** pass `context={'request': request}` so the serializer knows how to build absolute URLs. For example, instead of:\n\n        serializer = SnippetSerializer(snippet)\n    \n    You must write:\n\n        serializer = SnippetSerializer(snippet, context={\"request\": request})\n    \n    If your view is a subclass of `GenericAPIView`, you may use the `get_serializer_context()` as a convenience method.\n\n## Making sure our URL patterns are named\n\nIf we're going to have a hyperlinked API, we need to make sure we name our URL patterns.  Let's take a look at which URL patterns we need to name.\n\n* The root of our API refers to `'user-list'` and `'snippet-list'`.\n* Our snippet serializer includes a field that refers to `'snippet-highlight'`.\n* Our user serializer includes a field that refers to `'snippet-detail'`.\n* Our snippet and user serializers include `'url'` fields that by default will refer to `'{model_name}-detail'`, which in this case will be `'snippet-detail'` and `'user-detail'`.\n\nAfter adding all those names into our URLconf, our final `snippets/urls.py` file should look like this:\n\n```python\nfrom django.urls import path\nfrom rest_framework.urlpatterns import format_suffix_patterns\nfrom snippets import views\n\n# API endpoints\nurlpatterns = format_suffix_patterns(\n    [\n        path(\"\", views.api_root),\n        path(\"snippets/\", views.SnippetList.as_view(), name=\"snippet-list\"),\n        path(\n            \"snippets/<int:pk>/\", views.SnippetDetail.as_view(), name=\"snippet-detail\"\n        ),\n        path(\n            \"snippets/<int:pk>/highlight/\",\n            views.SnippetHighlight.as_view(),\n            name=\"snippet-highlight\",\n        ),\n        path(\"users/\", views.UserList.as_view(), name=\"user-list\"),\n        path(\"users/<int:pk>/\", views.UserDetail.as_view(), name=\"user-detail\"),\n    ]\n)\n```\n\n## Adding pagination\n\nThe list views for users and code snippets could end up returning quite a lot of instances, so really we'd like to make sure we paginate the results, and allow the API client to step through each of the individual pages.\n\nWe can change the default list style to use pagination, by modifying our `tutorial/settings.py` file slightly. Add the following setting:\n\n```python\nREST_FRAMEWORK = {\n    \"DEFAULT_PAGINATION_CLASS\": \"rest_framework.pagination.PageNumberPagination\",\n    \"PAGE_SIZE\": 10,\n}\n```\n\nNote that settings in REST framework are all namespaced into a single dictionary setting, named `REST_FRAMEWORK`, which helps keep them well separated from your other project settings.\n\nWe could also customize the pagination style if we needed to, but in this case we'll just stick with the default.\n\n## Browsing the API\n\nIf we open a browser and navigate to the browsable API, you'll find that you can now work your way around the API simply by following links.\n\nYou'll also be able to see the 'highlight' links on the snippet instances, that will take you to the highlighted code HTML representations.\n\nIn [part 6][tut-6] of the tutorial we'll look at how we can use ViewSets and Routers to reduce the amount of code we need to build our API.\n\n[tut-6]: 6-viewsets-and-routers.md\n"
  },
  {
    "path": "docs/tutorial/6-viewsets-and-routers.md",
    "content": "# Tutorial 6: ViewSets & Routers\n\nREST framework includes an abstraction for dealing with `ViewSets`, that allows the developer to concentrate on modeling the state and interactions of the API, and leave the URL construction to be handled automatically, based on common conventions.\n\n`ViewSet` classes are almost the same thing as `View` classes, except that they provide operations such as `retrieve`, or `update`, and not method handlers such as `get` or `put`.\n\nA `ViewSet` class is only bound to a set of method handlers at the last moment, when it is instantiated into a set of views, typically by using a `Router` class which handles the complexities of defining the URL conf for you.\n\n## Refactoring to use ViewSets\n\nLet's take our current set of views, and refactor them into view sets.\n\nFirst of all let's refactor our `UserList` and `UserDetail` classes into a single `UserViewSet` class. In the `snippets/views.py` file, we can remove the two view classes and replace them with a single ViewSet class:\n\n```python\nfrom rest_framework import viewsets\n\n\nclass UserViewSet(viewsets.ReadOnlyModelViewSet):\n    \"\"\"\n    This viewset automatically provides `list` and `retrieve` actions.\n    \"\"\"\n\n    queryset = User.objects.all()\n    serializer_class = UserSerializer\n```\n\nHere we've used the `ReadOnlyModelViewSet` class to automatically provide the default 'read-only' operations.  We're still setting the `queryset` and `serializer_class` attributes exactly as we did when we were using regular views, but we no longer need to provide the same information to two separate classes.\n\nNext we're going to replace the `SnippetList`, `SnippetDetail` and `SnippetHighlight` view classes.  We can remove the three views, and again replace them with a single class.\n\n```python\nfrom rest_framework import permissions\nfrom rest_framework import renderers\nfrom rest_framework.decorators import action\nfrom rest_framework.response import Response\n\n\nclass SnippetViewSet(viewsets.ModelViewSet):\n    \"\"\"\n    This ViewSet automatically provides `list`, `create`, `retrieve`,\n    `update` and `destroy` actions.\n\n    Additionally we also provide an extra `highlight` action.\n    \"\"\"\n\n    queryset = Snippet.objects.all()\n    serializer_class = SnippetSerializer\n    permission_classes = [permissions.IsAuthenticatedOrReadOnly, IsOwnerOrReadOnly]\n\n    @action(detail=True, renderer_classes=[renderers.StaticHTMLRenderer])\n    def highlight(self, request, *args, **kwargs):\n        snippet = self.get_object()\n        return Response(snippet.highlighted)\n\n    def perform_create(self, serializer):\n        serializer.save(owner=self.request.user)\n```\n\nThis time we've used the `ModelViewSet` class in order to get the complete set of default read and write operations.\n\nNotice that we've also used the `@action` decorator to create a custom action, named `highlight`.  This decorator can be used to add any custom endpoints that don't fit into the standard `create`/`update`/`delete` style.\n\nCustom actions which use the `@action` decorator will respond to `GET` requests by default.  We can use the `methods` argument if we wanted an action that responded to `POST` requests.\n\nThe URLs for custom actions by default depend on the method name itself. If you want to change the way url should be constructed, you can include `url_path` as a decorator keyword argument.\n\n## Binding ViewSets to URLs explicitly\n\nThe handler methods only get bound to the actions when we define the URLConf.\nTo see what's going on under the hood let's first explicitly create a set of views from our ViewSets.\n\nIn the `snippets/urls.py` file we bind our `ViewSet` classes into a set of concrete views.\n\n```python\nfrom rest_framework import renderers\n\nfrom snippets.views import api_root, SnippetViewSet, UserViewSet\n\nsnippet_list = SnippetViewSet.as_view({\"get\": \"list\", \"post\": \"create\"})\nsnippet_detail = SnippetViewSet.as_view(\n    {\"get\": \"retrieve\", \"put\": \"update\", \"patch\": \"partial_update\", \"delete\": \"destroy\"}\n)\nsnippet_highlight = SnippetViewSet.as_view(\n    {\"get\": \"highlight\"}, renderer_classes=[renderers.StaticHTMLRenderer]\n)\nuser_list = UserViewSet.as_view({\"get\": \"list\"})\nuser_detail = UserViewSet.as_view({\"get\": \"retrieve\"})\n```\n\nNotice how we're creating multiple views from each `ViewSet` class, by binding the HTTP methods to the required action for each view.\n\nNow that we've bound our resources into concrete views, we can register the views with the URL conf as usual.\n\n```python\nurlpatterns = format_suffix_patterns(\n    [\n        path(\"\", api_root),\n        path(\"snippets/\", snippet_list, name=\"snippet-list\"),\n        path(\"snippets/<int:pk>/\", snippet_detail, name=\"snippet-detail\"),\n        path(\n            \"snippets/<int:pk>/highlight/\", snippet_highlight, name=\"snippet-highlight\"\n        ),\n        path(\"users/\", user_list, name=\"user-list\"),\n        path(\"users/<int:pk>/\", user_detail, name=\"user-detail\"),\n    ]\n)\n```\n\n## Using Routers\n\nBecause we're using `ViewSet` classes rather than `View` classes, we actually don't need to design the URL conf ourselves.  The conventions for wiring up resources into views and urls can be handled automatically, using a `Router` class.  All we need to do is register the appropriate view sets with a router, and let it do the rest.\n\nHere's our re-wired `snippets/urls.py` file.\n\n```python\nfrom django.urls import path, include\nfrom rest_framework.routers import DefaultRouter\n\nfrom snippets import views\n\n# Create a router and register our ViewSets with it.\nrouter = DefaultRouter()\nrouter.register(r\"snippets\", views.SnippetViewSet, basename=\"snippet\")\nrouter.register(r\"users\", views.UserViewSet, basename=\"user\")\n\n# The API URLs are now determined automatically by the router.\nurlpatterns = [\n    path(\"\", include(router.urls)),\n]\n```\n\nRegistering the ViewSets with the router is similar to providing a urlpattern.  We include two arguments - the URL prefix for the views, and the view set itself.\n\nThe `DefaultRouter` class we're using also automatically creates the API root view for us, so we can now delete the `api_root` function from our `views` module.\n\n## Trade-offs between views vs ViewSets\n\nUsing ViewSets can be a really useful abstraction.  It helps ensure that URL conventions will be consistent across your API, minimizes the amount of code you need to write, and allows you to concentrate on the interactions and representations your API provides rather than the specifics of the URL conf.\n\nThat doesn't mean it's always the right approach to take. There's a similar set of trade-offs to consider as when using class-based views instead of function-based views. Using ViewSets is less explicit than building your API views individually.\n"
  },
  {
    "path": "docs/tutorial/quickstart.md",
    "content": "# Quickstart\n\nWe're going to create a simple API to allow admin users to view and edit the users and groups in the system.\n\n## Project setup\n\nCreate a new Django project named `tutorial`, then start a new app called `quickstart`.\n\n=== \":fontawesome-brands-linux: Linux, :fontawesome-brands-apple: macOS\"\n\n    ```bash\n    # Create the project directory\n    mkdir tutorial\n    cd tutorial\n    \n    # Create a virtual environment to isolate our package dependencies locally\n    python3 -m venv .venv\n    source .venv/bin/activate\n    \n    # Install Django and Django REST framework into the virtual environment\n    pip install djangorestframework\n    \n    # Set up a new project with a single application\n    django-admin startproject tutorial .  # Note the trailing '.' character\n    cd tutorial\n    django-admin startapp quickstart\n    cd ..\n    ```\n\n=== \":fontawesome-brands-windows: Windows\"\n\n    If you use Bash for Windows\n\n    ```bash\n    # Create the project directory\n    mkdir tutorial\n    cd tutorial\n    \n    # Create a virtual environment to isolate our package dependencies locally\n    python3 -m venv .venv\n    source .venv\\Scripts\\activate\n    \n    # Install Django and Django REST framework into the virtual environment\n    pip install djangorestframework\n    \n    # Set up a new project with a single application\n    django-admin startproject tutorial .  # Note the trailing '.' character\n    cd tutorial\n    django-admin startapp quickstart\n    cd ..\n    ```\n\nThe project layout should look like:\n\n```bash\n$ pwd\n<some path>/tutorial\n$ find .\n.\n./tutorial\n./tutorial/asgi.py\n./tutorial/__init__.py\n./tutorial/quickstart\n./tutorial/quickstart/migrations\n./tutorial/quickstart/migrations/__init__.py\n./tutorial/quickstart/models.py\n./tutorial/quickstart/__init__.py\n./tutorial/quickstart/apps.py\n./tutorial/quickstart/admin.py\n./tutorial/quickstart/tests.py\n./tutorial/quickstart/views.py\n./tutorial/settings.py\n./tutorial/urls.py\n./tutorial/wsgi.py\n./env\n./env/...\n./manage.py\n```\n\nIt may look unusual that the application has been created within the project directory. Using the project's namespace avoids name clashes with external modules (a topic that goes outside the scope of the quickstart).\n\nNow sync your database for the first time:\n\n```bash\npython manage.py migrate\n```\n\nWe'll also create an initial user named `admin` with a password. We'll authenticate as that user later in our example.\n\n```bash\npython manage.py createsuperuser --username admin --email admin@example.com\n```\n\nOnce you've set up a database and the initial user is created and ready to go, open up the app's directory and we'll get coding...\n\n## Serializers\n\nFirst up we're going to define some serializers. Let's create a new module named `tutorial/quickstart/serializers.py` that we'll use for our data representations.\n\n```python\nfrom django.contrib.auth.models import Group, User\nfrom rest_framework import serializers\n\n\nclass UserSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = User\n        fields = [\"url\", \"username\", \"email\", \"groups\"]\n\n\nclass GroupSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = Group\n        fields = [\"url\", \"name\"]\n```\n\nNotice that we're using hyperlinked relations in this case with `HyperlinkedModelSerializer`.  You can also use primary key and various other relationships, but hyperlinking is good RESTful design.\n\n## Views\n\nRight, we'd better write some views then.  Open `tutorial/quickstart/views.py` and get typing.\n\n```python\nfrom django.contrib.auth.models import Group, User\nfrom rest_framework import permissions, viewsets\n\nfrom tutorial.quickstart.serializers import GroupSerializer, UserSerializer\n\n\nclass UserViewSet(viewsets.ModelViewSet):\n    \"\"\"\n    API endpoint that allows users to be viewed or edited.\n    \"\"\"\n\n    queryset = User.objects.all().order_by(\"-date_joined\")\n    serializer_class = UserSerializer\n    permission_classes = [permissions.IsAuthenticated]\n\n\nclass GroupViewSet(viewsets.ModelViewSet):\n    \"\"\"\n    API endpoint that allows groups to be viewed or edited.\n    \"\"\"\n\n    queryset = Group.objects.all().order_by(\"name\")\n    serializer_class = GroupSerializer\n    permission_classes = [permissions.IsAuthenticated]\n```\n\nRather than write multiple views we're grouping together all the common behavior into classes called `ViewSets`.\n\nWe can easily break these down into individual views if we need to, but using viewsets keeps the view logic nicely organized as well as being very concise.\n\n## URLs\n\nOkay, now let's wire up the API URLs.  On to `tutorial/urls.py`...\n\n```python\nfrom django.urls import include, path\nfrom rest_framework import routers\n\nfrom tutorial.quickstart import views\n\nrouter = routers.DefaultRouter()\nrouter.register(r\"users\", views.UserViewSet)\nrouter.register(r\"groups\", views.GroupViewSet)\n\n# Wire up our API using automatic URL routing.\n# Additionally, we include login URLs for the browsable API.\nurlpatterns = [\n    path(\"\", include(router.urls)),\n    path(\"api-auth/\", include(\"rest_framework.urls\", namespace=\"rest_framework\")),\n]\n```\n\nBecause we're using viewsets instead of views, we can automatically generate the URL conf for our API, by simply registering the viewsets with a router class.\n\nAgain, if we need more control over the API URLs we can simply drop down to using regular class-based views, and writing the URL conf explicitly.\n\nFinally, we're including default login and logout views for use with the browsable API.  That's optional, but useful if your API requires authentication and you want to use the browsable API.\n\n## Pagination\n\nPagination allows you to control how many objects per page are returned. To enable it add the following lines to `tutorial/settings.py`\n\n```python\nREST_FRAMEWORK = {\n    \"DEFAULT_PAGINATION_CLASS\": \"rest_framework.pagination.PageNumberPagination\",\n    \"PAGE_SIZE\": 10,\n}\n```\n\n## Settings\n\nAdd `'rest_framework'` to `INSTALLED_APPS`. The settings module will be in `tutorial/settings.py`\n\n```text\nINSTALLED_APPS = [\n    ...\n    'rest_framework',\n]\n```\n\nOkay, we're done.\n\n---\n\n## Testing our API\n\nWe're now ready to test the API we've built.  Let's fire up the server from the command line.\n\n```bash\npython manage.py runserver\n```\n\nWe can now access our API, both from the command-line, using tools like `curl`...\n\n```bash\nbash: curl -u admin -H 'Accept: application/json; indent=4' http://127.0.0.1:8000/users/\nEnter host password for user 'admin':\n{\n    \"count\": 1,\n    \"next\": null,\n    \"previous\": null,\n    \"results\": [\n        {\n            \"url\": \"http://127.0.0.1:8000/users/1/\",\n            \"username\": \"admin\",\n            \"email\": \"admin@example.com\",\n            \"groups\": []\n        }\n    ]\n}\n```\n\nOr using the [httpie][httpie], command line tool...\n\n```bash\nbash: http -a admin http://127.0.0.1:8000/users/\nhttp: password for admin@127.0.0.1:8000:: \n$HTTP/1.1 200 OK\n...\n{\n    \"count\": 1,\n    \"next\": null,\n    \"previous\": null,\n    \"results\": [\n        {\n            \"email\": \"admin@example.com\",\n            \"groups\": [],\n            \"url\": \"http://127.0.0.1:8000/users/1/\",\n            \"username\": \"admin\"\n        }\n    ]\n}\n```\n\nOr directly through the browser, by going to the URL `http://127.0.0.1:8000/users/`...\n\n![Quick start image][image]\n\nIf you're working through the browser, make sure to login using the control in the top right corner.\n\nGreat, that was easy!\n\nIf you want to get a more in depth understanding of how REST framework fits together head on over to [the tutorial][tutorial], or start browsing the [API guide][guide].\n\n[image]: ../img/quickstart.png\n[tutorial]: 1-serialization.md\n[guide]: ../api-guide/requests.md\n[httpie]: https://httpie.io/docs#installation\n"
  },
  {
    "path": "licenses/bootstrap.md",
    "content": "https://github.com/twbs/bootstrap/\n\nThe MIT License (MIT)\n\nCopyright (c) 2011-2016 Twitter, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n"
  },
  {
    "path": "licenses/jquery.json-view.md",
    "content": "https://github.com/bazh/jquery.json-view/\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 bazh. (https://github.com/bazh)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "mkdocs.yml",
    "content": "site_name: Django REST framework\nsite_url: https://www.django-rest-framework.org/\nsite_description: Django REST framework - Web APIs for Django\n\nrepo_url: https://github.com/encode/django-rest-framework\n\ntheme:\n  name: material\n  custom_dir: docs/theme\n  favicon: theme/img/favicon.ico\n  logo: theme/img/logo.png\n  palette:\n    - media: \"(prefers-color-scheme)\"\n      primary: custom\n      accent: custom\n      toggle:\n        icon: material/brightness-auto\n        name: \"Switch to light mode\"\n    - media: \"(prefers-color-scheme: light)\"\n      scheme: default\n      primary: custom\n      accent: custom\n      toggle:\n        icon: material/brightness-7\n        name: \"Switch to dark mode\"\n    - media: \"(prefers-color-scheme: dark)\"\n      scheme: slate\n      primary: custom\n      accent: custom\n      toggle:\n        icon: material/brightness-4\n        name: \"Switch to system preference\"\n  features:\n    - content.tabs.link\n    - content.code.annotate\n    - content.code.copy\n    - navigation.tabs\n    - navigation.tabs.sticky\n    - navigation.instant\n    - navigation.instant.prefetch\n    - navigation.instant.progress\n    - navigation.path\n    - navigation.sections\n    - navigation.top\n    - navigation.tracking\n    - search.suggest\n    - toc.follow\n\nextra_css:\n  - theme/stylesheets/extra.css\n  - theme/stylesheets/prettify.css\nextra_javascript:\n  - theme/js/prettify-1.0.js\n\nmarkdown_extensions:\n  - admonition\n  - attr_list\n  - toc:\n      permalink: true\n  - pymdownx.highlight:\n      pygments_lang_class: true\n  - pymdownx.inlinehilite\n  - pymdownx.snippets\n  - pymdownx.superfences\n  - pymdownx.tabbed:\n      alternate_style: true\n  - pymdownx.emoji:\n      emoji_index: !!python/name:material.extensions.emoji.twemoji\n      emoji_generator: !!python/name:material.extensions.emoji.to_svg\n\nnav:\n  - Home: 'index.md'\n  - Tutorial:\n    - 'Quickstart': 'tutorial/quickstart.md'\n    - '1 - Serialization': 'tutorial/1-serialization.md'\n    - '2 - Requests and responses': 'tutorial/2-requests-and-responses.md'\n    - '3 - Class based views': 'tutorial/3-class-based-views.md'\n    - '4 - Authentication and permissions': 'tutorial/4-authentication-and-permissions.md'\n    - '5 - Relationships and hyperlinked APIs': 'tutorial/5-relationships-and-hyperlinked-apis.md'\n    - '6 - Viewsets and routers': 'tutorial/6-viewsets-and-routers.md'\n  - API Guide:\n    - 'Requests': 'api-guide/requests.md'\n    - 'Responses': 'api-guide/responses.md'\n    - 'Views': 'api-guide/views.md'\n    - 'Generic views': 'api-guide/generic-views.md'\n    - 'Viewsets': 'api-guide/viewsets.md'\n    - 'Routers': 'api-guide/routers.md'\n    - 'Parsers': 'api-guide/parsers.md'\n    - 'Renderers': 'api-guide/renderers.md'\n    - 'Serializers': 'api-guide/serializers.md'\n    - 'Serializer fields': 'api-guide/fields.md'\n    - 'Serializer relations': 'api-guide/relations.md'\n    - 'Validators': 'api-guide/validators.md'\n    - 'Authentication': 'api-guide/authentication.md'\n    - 'Permissions': 'api-guide/permissions.md'\n    - 'Caching': 'api-guide/caching.md'\n    - 'Throttling': 'api-guide/throttling.md'\n    - 'Filtering': 'api-guide/filtering.md'\n    - 'Pagination': 'api-guide/pagination.md'\n    - 'Versioning': 'api-guide/versioning.md'\n    - 'Content negotiation': 'api-guide/content-negotiation.md'\n    - 'Metadata': 'api-guide/metadata.md'\n    - 'Schemas': 'api-guide/schemas.md'\n    - 'Format suffixes': 'api-guide/format-suffixes.md'\n    - 'Returning URLs': 'api-guide/reverse.md'\n    - 'Exceptions': 'api-guide/exceptions.md'\n    - 'Status codes': 'api-guide/status-codes.md'\n    - 'Testing': 'api-guide/testing.md'\n    - 'Settings': 'api-guide/settings.md'\n  - Topics:\n     - 'Documenting your API': 'topics/documenting-your-api.md'\n     - 'Internationalization': 'topics/internationalization.md'\n     - 'AJAX, CSRF & CORS': 'topics/ajax-csrf-cors.md'\n     - 'HTML & Forms': 'topics/html-and-forms.md'\n     - 'Browser Enhancements': 'topics/browser-enhancements.md'\n     - 'The Browsable API': 'topics/browsable-api.md'\n     - 'REST, Hypermedia & HATEOAS': 'topics/rest-hypermedia-hateoas.md'\n  - Community:\n     - 'Tutorials and Resources': 'community/tutorials-and-resources.md'\n     - 'Third Party Packages': 'community/third-party-packages.md'\n     - 'Contributing to REST framework': 'community/contributing.md'\n     - 'Project management': 'community/project-management.md'\n     - 'Release Notes': 'community/release-notes.md'\n     - '3.16 Announcement': 'community/3.16-announcement.md'\n     - '3.15 Announcement': 'community/3.15-announcement.md'\n     - '3.14 Announcement': 'community/3.14-announcement.md'\n     - '3.13 Announcement': 'community/3.13-announcement.md'\n     - '3.12 Announcement': 'community/3.12-announcement.md'\n     - '3.11 Announcement': 'community/3.11-announcement.md'\n     - '3.10 Announcement': 'community/3.10-announcement.md'\n     - '3.9 Announcement': 'community/3.9-announcement.md'\n     - '3.8 Announcement': 'community/3.8-announcement.md'\n     - '3.7 Announcement': 'community/3.7-announcement.md'\n     - '3.6 Announcement': 'community/3.6-announcement.md'\n     - '3.5 Announcement': 'community/3.5-announcement.md'\n     - '3.4 Announcement': 'community/3.4-announcement.md'\n     - '3.3 Announcement': 'community/3.3-announcement.md'\n     - '3.2 Announcement': 'community/3.2-announcement.md'\n     - '3.1 Announcement': 'community/3.1-announcement.md'\n     - '3.0 Announcement': 'community/3.0-announcement.md'\n     - 'Kickstarter Announcement': 'community/kickstarter-announcement.md'\n     - 'Mozilla Grant': 'community/mozilla-grant.md'\n     - 'Jobs': 'community/jobs.md'\n"
  },
  {
    "path": "pyproject.toml",
    "content": "[build-system]\nbuild-backend = \"setuptools.build_meta\"\nrequires = [ \"setuptools>=77.0.3\" ]\n\n[project]\nname = \"djangorestframework\"\ndescription = \"Web APIs for Django, made easy.\"\nreadme = \"README.md\"\nlicense = \"BSD-3-Clause\"\nlicense-files = [ \"LICENSE.md\" ]\nauthors = [ { name = \"Tom Christie\", email = \"tom@tomchristie.com\" } ]\nrequires-python = \">=3.10\"\nclassifiers = [\n  \"Development Status :: 5 - Production/Stable\",\n  \"Environment :: Web Environment\",\n  \"Framework :: Django\",\n  \"Framework :: Django :: 4.2\",\n  \"Framework :: Django :: 5.0\",\n  \"Framework :: Django :: 5.1\",\n  \"Framework :: Django :: 5.2\",\n  \"Framework :: Django :: 6.0\",\n  \"Intended Audience :: Developers\",\n  \"Operating System :: OS Independent\",\n  \"Programming Language :: Python\",\n  \"Programming Language :: Python :: 3 :: Only\",\n  \"Programming Language :: Python :: 3.10\",\n  \"Programming Language :: Python :: 3.11\",\n  \"Programming Language :: Python :: 3.12\",\n  \"Programming Language :: Python :: 3.13\",\n  \"Programming Language :: Python :: 3.14\",\n  \"Topic :: Internet :: WWW/HTTP\",\n]\ndynamic = [ \"version\" ]\ndependencies = [ \"django>=4.2\" ]\nurls.Changelog = \"https://www.django-rest-framework.org/community/release-notes/\"\nurls.Funding = \"https://fund.django-rest-framework.org/topics/funding/\"\nurls.Homepage = \"https://www.django-rest-framework.org\"\nurls.Source = \"https://github.com/encode/django-rest-framework\"\n\n[dependency-groups]\ndev = [\n  { include-group = \"docs\" },\n  { include-group = \"optional\" },\n  { include-group = \"test\" },\n]\ntest = [\n  \"importlib-metadata<9.0\",\n  # Pytest for running the tests.\n  \"pytest==9.*\",\n  \"pytest-cov==7.*\",\n  \"pytest-django>=4.5.2,<5\",\n\n  # Remove when dropping support for Django<5.0\n  \"pytz\",\n]\ndocs = [\n  # MkDocs to build our documentation.\n  \"mkdocs==1.6.1\",\n  \"mkdocs-material[imaging]==9.7.5\",\n  # pylinkvalidator to check for broken links in documentation.\n  \"pylinkvalidator==0.3\",\n]\noptional = [\n  # Optional packages which may be used with REST framework.\n  \"django-filter\",\n  \"django-guardian>=2.4.0,<3.4\",\n  \"inflection==0.5.1\",\n  \"legacy-cgi; python_version>='3.13'\",\n  \"markdown>=3.3.7\",\n  \"psycopg[binary]>=3.1.8\",\n  \"pygments>=2.17,<2.20\",\n  \"pyyaml>=5.3.1,<6.1\",\n  \"requests\",\n  \"uritemplate\",\n]\ndjango42 = [ \"django>=4.2,<5.0\" ]\ndjango50 = [ \"django>=5.0,<5.1\" ]\ndjango51 = [ \"django>=5.1,<5.2\" ]\ndjango52 = [ \"django>=5.2,<6.0\" ]\ndjango60 = [ \"django>=6.0,<6.1\" ]\ndjangomain = [ \"django @ https://github.com/django/django/archive/main.tar.gz\" ]\n\n[tool.setuptools]\n\n[tool.setuptools.dynamic]\nversion = { attr = \"rest_framework.__version__\" }\n\n[tool.setuptools.packages.find]\ninclude = [ \"rest_framework*\" ]\n\n[tool.setuptools.package-data]\n\"rest_framework\" = [\n  \"templates/**/*\",\n  \"static/**/*\",\n  \"locale/**/*.mo\",\n]\n\n[tool.isort]\nskip = [ \".tox\" ]\natomic = true\nmulti_line_output = 5\nextra_standard_library = [ \"types\" ]\nknown_third_party = [ \"pytest\", \"_pytest\", \"django\", \"pytz\", \"uritemplate\" ]\nknown_first_party = [ \"rest_framework\", \"tests\" ]\n\n[tool.codespell]\n# Ref: https://github.com/codespell-project/codespell#using-a-config-file\nskip = \"*/kickstarter-announcement.md,*.js,*.map,*.po,*.css,locale\"\nignore-words = \"codespell-ignore-words.txt\"\nbuiltin = \"clear,rare,code,names,en-GB_to_en-US\"\n\n[tool.pyproject-fmt]\nmax_supported_python = \"3.14\"\nkeep_full_version = true\n\n[tool.pytest.ini_options]\naddopts = \"--tb=short --strict-markers -ra\"\ntestpaths = [ \"tests\" ]\nfilterwarnings = [\n  \"ignore:'cgi' is deprecated:DeprecationWarning\",\n]\n\n[tool.coverage.run]\n# NOTE: source is ignored with pytest-cov (but uses the same).\nsource = [ \".\" ]\ninclude = [ \"rest_framework/*\", \"tests/*\" ]\nbranch = true\n\n[tool.coverage.report]\ninclude = [ \"rest_framework/*\", \"tests/*\" ]\nexclude_lines = [\n  \"pragma: no cover\",\n  \"raise NotImplementedError\",\n]\n"
  },
  {
    "path": "rest_framework/__init__.py",
    "content": "r\"\"\"\n______ _____ _____ _____    __\n| ___ \\  ___/  ___|_   _|  / _|                                           | |\n| |_/ / |__ \\ `--.  | |   | |_ _ __ __ _ _ __ ___   _____      _____  _ __| |__\n|    /|  __| `--. \\ | |   |  _| '__/ _` | '_ ` _ \\ / _ \\ \\ /\\ / / _ \\| '__| |/ /\n| |\\ \\| |___/\\__/ / | |   | | | | | (_| | | | | | |  __/\\ V  V / (_) | |  |   <\n\\_| \\_\\____/\\____/  \\_/   |_| |_|  \\__,_|_| |_| |_|\\___| \\_/\\_/ \\___/|_|  |_|\\_|\n\"\"\"\n\n__title__ = 'Django REST framework'\n__version__ = '3.17.0'\n__author__ = 'Tom Christie'\n__license__ = 'BSD-3-Clause'\n__copyright__ = 'Copyright 2011-2023 Encode OSS Ltd'\n\n# Version synonym\nVERSION = __version__\n\n# Header encoding (see RFC5987)\nHTTP_HEADER_ENCODING = 'iso-8859-1'\n\n# Default datetime input and output formats\nISO_8601 = 'iso-8601'\nDJANGO_DURATION_FORMAT = 'django'\n"
  },
  {
    "path": "rest_framework/apps.py",
    "content": "from django.apps import AppConfig\n\n\nclass RestFrameworkConfig(AppConfig):\n    name = 'rest_framework'\n    verbose_name = \"Django REST framework\"\n\n    def ready(self):\n        # Add System checks\n        from .checks import pagination_system_check  # NOQA\n"
  },
  {
    "path": "rest_framework/authentication.py",
    "content": "\"\"\"\nProvides various authentication policies.\n\"\"\"\nimport base64\nimport binascii\n\nfrom django.contrib.auth import authenticate, get_user_model\nfrom django.middleware.csrf import CsrfViewMiddleware\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework import HTTP_HEADER_ENCODING, exceptions\n\n\ndef get_authorization_header(request):\n    \"\"\"\n    Return request's 'Authorization:' header, as a bytestring.\n\n    Hide some test client ickyness where the header can be unicode.\n    \"\"\"\n    auth = request.META.get('HTTP_AUTHORIZATION', b'')\n    if isinstance(auth, str):\n        # Work around django test client oddness\n        auth = auth.encode(HTTP_HEADER_ENCODING)\n    return auth\n\n\nclass CSRFCheck(CsrfViewMiddleware):\n    def _reject(self, request, reason):\n        # Return the failure reason instead of an HttpResponse\n        return reason\n\n\nclass BaseAuthentication:\n    \"\"\"\n    All authentication classes should extend BaseAuthentication.\n    \"\"\"\n\n    def authenticate(self, request):\n        \"\"\"\n        Authenticate the request and return a two-tuple of (user, token).\n        \"\"\"\n        raise NotImplementedError(\".authenticate() must be overridden.\")\n\n    def authenticate_header(self, request):\n        \"\"\"\n        Return a string to be used as the value of the `WWW-Authenticate`\n        header in a `401 Unauthenticated` response, or `None` if the\n        authentication scheme should return `403 Permission Denied` responses.\n        \"\"\"\n        pass\n\n\nclass BasicAuthentication(BaseAuthentication):\n    \"\"\"\n    HTTP Basic authentication against username/password.\n    \"\"\"\n    www_authenticate_realm = 'api'\n\n    def authenticate(self, request):\n        \"\"\"\n        Returns a `User` if a correct username and password have been supplied\n        using HTTP Basic authentication.  Otherwise returns `None`.\n        \"\"\"\n        auth = get_authorization_header(request).split()\n\n        if not auth or auth[0].lower() != b'basic':\n            return None\n\n        if len(auth) == 1:\n            msg = _('Invalid basic header. No credentials provided.')\n            raise exceptions.AuthenticationFailed(msg)\n        elif len(auth) > 2:\n            msg = _('Invalid basic header. Credentials string should not contain spaces.')\n            raise exceptions.AuthenticationFailed(msg)\n\n        try:\n            try:\n                auth_decoded = base64.b64decode(auth[1]).decode('utf-8')\n            except UnicodeDecodeError:\n                auth_decoded = base64.b64decode(auth[1]).decode('latin-1')\n\n            userid, password = auth_decoded.split(':', 1)\n        except (TypeError, ValueError, UnicodeDecodeError, binascii.Error):\n            msg = _('Invalid basic header. Credentials not correctly base64 encoded.')\n            raise exceptions.AuthenticationFailed(msg)\n\n        return self.authenticate_credentials(userid, password, request)\n\n    def authenticate_credentials(self, userid, password, request=None):\n        \"\"\"\n        Authenticate the userid and password against username and password\n        with optional request for context.\n        \"\"\"\n        credentials = {\n            get_user_model().USERNAME_FIELD: userid,\n            'password': password\n        }\n        user = authenticate(request=request, **credentials)\n\n        if user is None:\n            raise exceptions.AuthenticationFailed(_('Invalid username/password.'))\n\n        if not user.is_active:\n            raise exceptions.AuthenticationFailed(_('User inactive or deleted.'))\n\n        return (user, None)\n\n    def authenticate_header(self, request):\n        return 'Basic realm=\"%s\"' % self.www_authenticate_realm\n\n\nclass SessionAuthentication(BaseAuthentication):\n    \"\"\"\n    Use Django's session framework for authentication.\n    \"\"\"\n\n    def authenticate(self, request):\n        \"\"\"\n        Returns a `User` if the request session currently has a logged in user.\n        Otherwise returns `None`.\n        \"\"\"\n\n        # Get the session-based user from the underlying HttpRequest object\n        user = getattr(request._request, 'user', None)\n\n        # Unauthenticated, CSRF validation not required\n        if not user or not user.is_active:\n            return None\n\n        self.enforce_csrf(request)\n\n        # CSRF passed with authenticated user\n        return (user, None)\n\n    def enforce_csrf(self, request):\n        \"\"\"\n        Enforce CSRF validation for session based authentication.\n        \"\"\"\n        def dummy_get_response(request):  # pragma: no cover\n            return None\n\n        check = CSRFCheck(dummy_get_response)\n        # populates request.META['CSRF_COOKIE'], which is used in process_view()\n        check.process_request(request)\n        reason = check.process_view(request, None, (), {})\n        if reason:\n            # CSRF failed, bail with explicit error message\n            raise exceptions.PermissionDenied('CSRF Failed: %s' % reason)\n\n\nclass TokenAuthentication(BaseAuthentication):\n    \"\"\"\n    Simple token based authentication.\n\n    Clients should authenticate by passing the token key in the \"Authorization\"\n    HTTP header, prepended with the string \"Token \".  For example:\n\n        Authorization: Token 401f7ac837da42b97f613d789819ff93537bee6a\n    \"\"\"\n\n    keyword = 'Token'\n    model = None\n\n    def get_model(self):\n        if self.model is not None:\n            return self.model\n        from rest_framework.authtoken.models import Token\n        return Token\n\n    \"\"\"\n    A custom token model may be used, but must have the following properties.\n\n    * key -- The string identifying the token\n    * user -- The user to which the token belongs\n    \"\"\"\n\n    def authenticate(self, request):\n        auth = get_authorization_header(request).split()\n\n        if not auth or auth[0].lower() != self.keyword.lower().encode():\n            return None\n\n        if len(auth) == 1:\n            msg = _('Invalid token header. No credentials provided.')\n            raise exceptions.AuthenticationFailed(msg)\n        elif len(auth) > 2:\n            msg = _('Invalid token header. Token string should not contain spaces.')\n            raise exceptions.AuthenticationFailed(msg)\n\n        try:\n            token = auth[1].decode()\n        except UnicodeError:\n            msg = _('Invalid token header. Token string should not contain invalid characters.')\n            raise exceptions.AuthenticationFailed(msg)\n\n        return self.authenticate_credentials(token)\n\n    def authenticate_credentials(self, key):\n        model = self.get_model()\n        try:\n            token = model.objects.select_related('user').get(key=key)\n        except model.DoesNotExist:\n            raise exceptions.AuthenticationFailed(_('Invalid token.'))\n\n        if not token.user.is_active:\n            raise exceptions.AuthenticationFailed(_('User inactive or deleted.'))\n\n        return (token.user, token)\n\n    def authenticate_header(self, request):\n        return self.keyword\n\n\nclass RemoteUserAuthentication(BaseAuthentication):\n    \"\"\"\n    REMOTE_USER authentication.\n\n    To use this, set up your web server to perform authentication, which will\n    set the REMOTE_USER environment variable. You will need to have\n    'django.contrib.auth.backends.RemoteUserBackend in your\n    AUTHENTICATION_BACKENDS setting\n    \"\"\"\n\n    # Name of request header to grab username from.  This will be the key as\n    # used in the request.META dictionary, i.e. the normalization of headers to\n    # all uppercase and the addition of \"HTTP_\" prefix apply.\n    header = \"REMOTE_USER\"\n\n    def authenticate(self, request):\n        user = authenticate(request=request, remote_user=request.META.get(self.header))\n        if user and user.is_active:\n            return (user, None)\n"
  },
  {
    "path": "rest_framework/authtoken/__init__.py",
    "content": ""
  },
  {
    "path": "rest_framework/authtoken/admin.py",
    "content": "from django.contrib import admin\nfrom django.contrib.admin.utils import quote\nfrom django.contrib.admin.views.main import ChangeList\nfrom django.contrib.auth import get_user_model\nfrom django.core.exceptions import ValidationError\nfrom django.urls import reverse\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework.authtoken.models import Token, TokenProxy\n\nUser = get_user_model()\n\n\nclass TokenChangeList(ChangeList):\n    \"\"\"Map to matching User id\"\"\"\n    def url_for_result(self, result):\n        pk = result.user.pk\n        return reverse('admin:%s_%s_change' % (self.opts.app_label,\n                                               self.opts.model_name),\n                       args=(quote(pk),),\n                       current_app=self.model_admin.admin_site.name)\n\n\nclass TokenAdmin(admin.ModelAdmin):\n    list_display = ('key', 'user', 'created')\n    list_filter = ('created',)\n    fields = ('user',)\n    search_fields = ('user__%s' % User.USERNAME_FIELD,)\n    search_help_text = _('Username')\n    ordering = ('user__%s' % User.USERNAME_FIELD,)\n    actions = None  # Actions not compatible with mapped IDs.\n\n    def get_changelist(self, request, **kwargs):\n        return TokenChangeList\n\n    def get_object(self, request, object_id, from_field=None):\n        \"\"\"\n        Map from User ID to matching Token.\n        \"\"\"\n        queryset = self.get_queryset(request)\n        field = User._meta.pk\n        try:\n            object_id = field.to_python(object_id)\n            user = User.objects.get(**{field.name: object_id})\n            return queryset.get(user=user)\n        except (queryset.model.DoesNotExist, User.DoesNotExist, ValidationError, ValueError):\n            return None\n\n    def delete_model(self, request, obj):\n        # Map back to actual Token, since delete() uses pk.\n        token = Token.objects.get(key=obj.key)\n        return super().delete_model(request, token)\n\n\nadmin.site.register(TokenProxy, TokenAdmin)\n"
  },
  {
    "path": "rest_framework/authtoken/apps.py",
    "content": "from django.apps import AppConfig\nfrom django.utils.translation import gettext_lazy as _\n\n\nclass AuthTokenConfig(AppConfig):\n    name = 'rest_framework.authtoken'\n    verbose_name = _(\"Auth Token\")\n"
  },
  {
    "path": "rest_framework/authtoken/management/__init__.py",
    "content": ""
  },
  {
    "path": "rest_framework/authtoken/management/commands/__init__.py",
    "content": ""
  },
  {
    "path": "rest_framework/authtoken/management/commands/drf_create_token.py",
    "content": "from django.contrib.auth import get_user_model\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom rest_framework.authtoken.models import Token\n\nUserModel = get_user_model()\n\n\nclass Command(BaseCommand):\n    help = 'Create DRF Token for a given user'\n\n    def create_user_token(self, username, reset_token):\n        user = UserModel._default_manager.get_by_natural_key(username)\n\n        if reset_token:\n            Token.objects.filter(user=user).delete()\n\n        token = Token.objects.get_or_create(user=user)\n        return token[0]\n\n    def add_arguments(self, parser):\n        parser.add_argument('username', type=str)\n\n        parser.add_argument(\n            '-r',\n            '--reset',\n            action='store_true',\n            dest='reset_token',\n            default=False,\n            help='Reset existing User token and create a new one',\n        )\n\n    def handle(self, *args, **options):\n        username = options['username']\n        reset_token = options['reset_token']\n\n        try:\n            token = self.create_user_token(username, reset_token)\n        except UserModel.DoesNotExist:\n            raise CommandError(\n                'Cannot create the Token: user {} does not exist'.format(\n                    username)\n            )\n        self.stdout.write(\n            f'Generated token {token.key} for user {username}')\n"
  },
  {
    "path": "rest_framework/authtoken/migrations/0001_initial.py",
    "content": "from django.conf import settings\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        migrations.swappable_dependency(settings.AUTH_USER_MODEL),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name='Token',\n            fields=[\n                ('key', models.CharField(primary_key=True, serialize=False, max_length=40)),\n                ('created', models.DateTimeField(auto_now_add=True)),\n                ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, related_name='auth_token', on_delete=models.CASCADE)),\n            ],\n            options={\n            },\n            bases=(models.Model,),\n        ),\n    ]\n"
  },
  {
    "path": "rest_framework/authtoken/migrations/0002_auto_20160226_1747.py",
    "content": "from django.conf import settings\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        ('authtoken', '0001_initial'),\n    ]\n\n    operations = [\n        migrations.AlterModelOptions(\n            name='token',\n            options={'verbose_name_plural': 'Tokens', 'verbose_name': 'Token'},\n        ),\n        migrations.AlterField(\n            model_name='token',\n            name='created',\n            field=models.DateTimeField(verbose_name='Created', auto_now_add=True),\n        ),\n        migrations.AlterField(\n            model_name='token',\n            name='key',\n            field=models.CharField(verbose_name='Key', max_length=40, primary_key=True, serialize=False),\n        ),\n        migrations.AlterField(\n            model_name='token',\n            name='user',\n            field=models.OneToOneField(to=settings.AUTH_USER_MODEL, verbose_name='User', related_name='auth_token', on_delete=models.CASCADE),\n        ),\n    ]\n"
  },
  {
    "path": "rest_framework/authtoken/migrations/0003_tokenproxy.py",
    "content": "# Generated by Django 3.1.1 on 2020-09-28 09:34\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        ('authtoken', '0002_auto_20160226_1747'),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name='TokenProxy',\n            fields=[\n            ],\n            options={\n                'verbose_name': 'token',\n                'proxy': True,\n                'indexes': [],\n                'constraints': [],\n            },\n            bases=('authtoken.token',),\n        ),\n    ]\n"
  },
  {
    "path": "rest_framework/authtoken/migrations/0004_alter_tokenproxy_options.py",
    "content": "# Generated by Django 4.1.3 on 2022-11-24 21:07\n\nfrom django.db import migrations\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        ('authtoken', '0003_tokenproxy'),\n    ]\n\n    operations = [\n        migrations.AlterModelOptions(\n            name='tokenproxy',\n            options={'verbose_name': 'Token', 'verbose_name_plural': 'Tokens'},\n        ),\n    ]\n"
  },
  {
    "path": "rest_framework/authtoken/migrations/__init__.py",
    "content": ""
  },
  {
    "path": "rest_framework/authtoken/models.py",
    "content": "import secrets\n\nfrom django.conf import settings\nfrom django.db import models\nfrom django.utils.translation import gettext_lazy as _\n\n\nclass Token(models.Model):\n    \"\"\"\n    The default authorization token model.\n    \"\"\"\n    key = models.CharField(_(\"Key\"), max_length=40, primary_key=True)\n    user = models.OneToOneField(\n        settings.AUTH_USER_MODEL, related_name='auth_token',\n        on_delete=models.CASCADE, verbose_name=_(\"User\")\n    )\n    created = models.DateTimeField(_(\"Created\"), auto_now_add=True)\n\n    class Meta:\n        # Work around for a bug in Django:\n        # https://code.djangoproject.com/ticket/19422\n        #\n        # Also see corresponding ticket:\n        # https://github.com/encode/django-rest-framework/issues/705\n        abstract = 'rest_framework.authtoken' not in settings.INSTALLED_APPS\n        verbose_name = _(\"Token\")\n        verbose_name_plural = _(\"Tokens\")\n\n    def save(self, *args, **kwargs):\n        \"\"\"\n        Save the token instance.\n\n        If no key is provided, generates a cryptographically secure key.\n        For new tokens, ensures they are inserted as new (not updated).\n        \"\"\"\n        if not self.key:\n            self.key = self.generate_key()\n            # For new objects, force INSERT to prevent overwriting existing tokens\n            if self._state.adding:\n                kwargs['force_insert'] = True\n        return super().save(*args, **kwargs)\n\n    @classmethod\n    def generate_key(cls):\n        return secrets.token_hex(20)\n\n    def __str__(self):\n        return self.key\n\n\nclass TokenProxy(Token):\n    \"\"\"\n    Proxy mapping pk to user pk for use in admin.\n    \"\"\"\n    @property\n    def pk(self):\n        return self.user_id\n\n    class Meta:\n        proxy = 'rest_framework.authtoken' in settings.INSTALLED_APPS\n        abstract = 'rest_framework.authtoken' not in settings.INSTALLED_APPS\n        verbose_name = _(\"Token\")\n        verbose_name_plural = _(\"Tokens\")\n"
  },
  {
    "path": "rest_framework/authtoken/serializers.py",
    "content": "from django.contrib.auth import authenticate\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework import serializers\n\n\nclass AuthTokenSerializer(serializers.Serializer):\n    username = serializers.CharField(\n        label=_(\"Username\"),\n        write_only=True\n    )\n    password = serializers.CharField(\n        label=_(\"Password\"),\n        style={'input_type': 'password'},\n        trim_whitespace=False,\n        write_only=True\n    )\n    token = serializers.CharField(\n        label=_(\"Token\"),\n        read_only=True\n    )\n\n    def validate(self, attrs):\n        username = attrs.get('username')\n        password = attrs.get('password')\n\n        if username and password:\n            user = authenticate(request=self.context.get('request'),\n                                username=username, password=password)\n\n            # The authenticate call simply returns None for is_active=False\n            # users. (Assuming the default ModelBackend authentication\n            # backend.)\n            if not user:\n                msg = _('Unable to log in with provided credentials.')\n                raise serializers.ValidationError(msg, code='authorization')\n        else:\n            msg = _('Must include \"username\" and \"password\".')\n            raise serializers.ValidationError(msg, code='authorization')\n\n        attrs['user'] = user\n        return attrs\n"
  },
  {
    "path": "rest_framework/authtoken/views.py",
    "content": "from rest_framework import parsers, renderers\nfrom rest_framework.authtoken.models import Token\nfrom rest_framework.authtoken.serializers import AuthTokenSerializer\nfrom rest_framework.response import Response\nfrom rest_framework.views import APIView\n\n\nclass ObtainAuthToken(APIView):\n    throttle_classes = ()\n    permission_classes = ()\n    parser_classes = (parsers.FormParser, parsers.MultiPartParser, parsers.JSONParser,)\n    renderer_classes = (renderers.JSONRenderer,)\n    serializer_class = AuthTokenSerializer\n\n    def get_serializer_context(self):\n        return {\n            'request': self.request,\n            'format': self.format_kwarg,\n            'view': self\n        }\n\n    def get_serializer(self, *args, **kwargs):\n        kwargs['context'] = self.get_serializer_context()\n        return self.serializer_class(*args, **kwargs)\n\n    def post(self, request, *args, **kwargs):\n        serializer = self.get_serializer(data=request.data)\n        serializer.is_valid(raise_exception=True)\n        user = serializer.validated_data['user']\n        token, created = Token.objects.get_or_create(user=user)\n        return Response({'token': token.key})\n\n\nobtain_auth_token = ObtainAuthToken.as_view()\n"
  },
  {
    "path": "rest_framework/checks.py",
    "content": "from django.core.checks import Tags, Warning, register\n\n\n@register(Tags.compatibility)\ndef pagination_system_check(app_configs, **kwargs):\n    errors = []\n    # Use of default page size setting requires a default Paginator class\n    from rest_framework.settings import api_settings\n    if api_settings.PAGE_SIZE and not api_settings.DEFAULT_PAGINATION_CLASS:\n        errors.append(\n            Warning(\n                \"You have specified a default PAGE_SIZE pagination rest_framework setting, \"\n                \"without specifying also a DEFAULT_PAGINATION_CLASS.\",\n                hint=\"The default for DEFAULT_PAGINATION_CLASS is None. \"\n                     \"In previous versions this was PageNumberPagination. \"\n                     \"If you wish to define PAGE_SIZE globally whilst defining \"\n                     \"pagination_class on a per-view basis you may silence this check.\",\n                id=\"rest_framework.W001\"\n            )\n        )\n    return errors\n"
  },
  {
    "path": "rest_framework/compat.py",
    "content": "\"\"\"\nThe `compat` module provides support for backwards compatibility with older\nversions of Django/Python, and compatibility wrappers around optional packages.\n\"\"\"\nimport django\nfrom django.db import models\nfrom django.db.models.constants import LOOKUP_SEP\nfrom django.db.models.sql.query import Node\nfrom django.views.generic import View\n\n\ndef unicode_http_header(value):\n    # Coerce HTTP header value to unicode.\n    if isinstance(value, bytes):\n        return value.decode('iso-8859-1')\n    return value\n\n\n# django.contrib.postgres requires psycopg\ntry:\n    from django.contrib.postgres import fields as postgres_fields\nexcept ImportError:\n    postgres_fields = None\n\n\n# uritemplate is required for OpenAPI schema generation\ntry:\n    import uritemplate\nexcept ImportError:\n    uritemplate = None\n\n\n# pyyaml is optional\ntry:\n    import yaml\nexcept ImportError:\n    yaml = None\n\n# inflection is optional\ntry:\n    import inflection\nexcept ImportError:\n    inflection = None\n\n\n# requests is optional\ntry:\n    import requests\nexcept ImportError:\n    requests = None\n\n\n# PATCH method is not implemented by Django\nif 'patch' not in View.http_method_names:\n    View.http_method_names = View.http_method_names + ['patch']\n\n\n# Markdown is optional (version 3.0+ required)\ntry:\n    import markdown\n\n    HEADERID_EXT_PATH = 'markdown.extensions.toc'\n    LEVEL_PARAM = 'baselevel'\n\n    def apply_markdown(text):\n        \"\"\"\n        Simple wrapper around :func:`markdown.markdown` to set the base level\n        of '#' style headers to <h2>.\n        \"\"\"\n        extensions = [HEADERID_EXT_PATH]\n        extension_configs = {\n            HEADERID_EXT_PATH: {\n                LEVEL_PARAM: '2'\n            }\n        }\n        md = markdown.Markdown(\n            extensions=extensions, extension_configs=extension_configs\n        )\n        md_filter_add_syntax_highlight(md)\n        return md.convert(text)\nexcept ImportError:\n    apply_markdown = None\n    markdown = None\n\n\ntry:\n    import pygments\n    from pygments.formatters import HtmlFormatter\n    from pygments.lexers import TextLexer, get_lexer_by_name\n\n    def pygments_highlight(text, lang, style):\n        lexer = get_lexer_by_name(lang, stripall=False)\n        formatter = HtmlFormatter(nowrap=True, style=style)\n        return pygments.highlight(text, lexer, formatter)\n\n    def pygments_css(style):\n        formatter = HtmlFormatter(style=style)\n        return formatter.get_style_defs('.highlight')\n\nexcept ImportError:\n    pygments = None\n\n    def pygments_highlight(text, lang, style):\n        return text\n\n    def pygments_css(style):\n        return None\n\nif markdown is not None and pygments is not None:\n    # starting from this blogpost and modified to support current markdown extensions API\n    # https://zerokspot.com/weblog/2008/06/18/syntax-highlighting-in-markdown-with-pygments/\n\n    import re\n\n    from markdown.preprocessors import Preprocessor\n\n    class CodeBlockPreprocessor(Preprocessor):\n        pattern = re.compile(\n            r'^\\s*``` *([^\\n]+)\\n(.+?)^\\s*```', re.M | re.S)\n\n        formatter = HtmlFormatter()\n\n        def run(self, lines):\n            def repl(m):\n                try:\n                    lexer = get_lexer_by_name(m.group(1))\n                except (ValueError, NameError):\n                    lexer = TextLexer()\n                code = m.group(2).replace('\\t', '    ')\n                code = pygments.highlight(code, lexer, self.formatter)\n                code = code.replace('\\n\\n', '\\n&nbsp;\\n').replace('\\n', '<br />').replace('\\\\@', '@')\n                return '\\n\\n%s\\n\\n' % code\n            ret = self.pattern.sub(repl, \"\\n\".join(lines))\n            return ret.split(\"\\n\")\n\n    def md_filter_add_syntax_highlight(md):\n        md.preprocessors.register(CodeBlockPreprocessor(), 'highlight', 40)\n        return True\nelse:\n    def md_filter_add_syntax_highlight(md):\n        return False\n\n\nif django.VERSION >= (5, 1):\n    # Django 5.1+: use the stock ip_address_validators function\n    # Note: Before Django 5.1, ip_address_validators returns a tuple containing\n    #       1) the list of validators and 2) the error message. Starting from\n    #       Django 5.1 ip_address_validators only returns the list of validators\n    from django.core.validators import ip_address_validators\n\n    def get_referenced_base_fields_from_q(q):\n        return q.referenced_base_fields\n\nelse:\n    # Django <= 5.1: create a compatibility shim for ip_address_validators\n    from django.core.validators import \\\n        ip_address_validators as _ip_address_validators\n\n    def ip_address_validators(protocol, unpack_ipv4):\n        return _ip_address_validators(protocol, unpack_ipv4)[0]\n\n    # Django < 5.1: create a compatibility shim for Q.referenced_base_fields\n    # https://github.com/django/django/blob/5.1a1/django/db/models/query_utils.py#L179\n    def _get_paths_from_expression(expr):\n        if isinstance(expr, models.F):\n            yield expr.name\n        elif hasattr(expr, 'flatten'):\n            for child in expr.flatten():\n                if isinstance(child, models.F):\n                    yield child.name\n                elif isinstance(child, models.Q):\n                    yield from _get_children_from_q(child)\n\n    def _get_children_from_q(q):\n        for child in q.children:\n            if isinstance(child, Node):\n                yield from _get_children_from_q(child)\n            elif isinstance(child, tuple):\n                lhs, rhs = child\n                yield lhs\n                if hasattr(rhs, 'resolve_expression'):\n                    yield from _get_paths_from_expression(rhs)\n            elif hasattr(child, 'resolve_expression'):\n                yield from _get_paths_from_expression(child)\n\n    def get_referenced_base_fields_from_q(q):\n        return {\n            child.split(LOOKUP_SEP, 1)[0] for child in _get_children_from_q(q)\n        }\n\n\n# `separators` argument to `json.dumps()` differs between 2.x and 3.x\n# See: https://bugs.python.org/issue22767\nSHORT_SEPARATORS = (',', ':')\nLONG_SEPARATORS = (', ', ': ')\nINDENT_SEPARATORS = (',', ': ')\n"
  },
  {
    "path": "rest_framework/decorators.py",
    "content": "\"\"\"\nThe most important decorator in this module is `@api_view`, which is used\nfor writing function-based views with REST framework.\n\nThere are also various decorators for setting the API policies on function\nbased views, as well as the `@action` decorator, which is used to annotate\nmethods on viewsets that should be included by routers.\n\"\"\"\nimport types\n\nfrom django.forms.utils import pretty_name\n\nfrom rest_framework.views import APIView\n\n\ndef api_view(http_method_names=None):\n    \"\"\"\n    Decorator that converts a function-based view into an APIView subclass.\n    Takes a list of allowed methods for the view as an argument.\n    \"\"\"\n    http_method_names = ['GET'] if (http_method_names is None) else http_method_names\n\n    def decorator(func):\n\n        WrappedAPIView = type(\n            'WrappedAPIView',\n            (APIView,),\n            {'__doc__': func.__doc__}\n        )\n\n        # Note, the above allows us to set the docstring.\n        # It is the equivalent of:\n        #\n        #     class WrappedAPIView(APIView):\n        #         pass\n        #     WrappedAPIView.__doc__ = func.doc    <--- Not possible to do this\n\n        # api_view applied without (method_names)\n        assert not isinstance(http_method_names, types.FunctionType), \\\n            '@api_view missing list of allowed HTTP methods'\n\n        # api_view applied with eg. string instead of list of strings\n        assert isinstance(http_method_names, (list, tuple)), \\\n            '@api_view expected a list of strings, received %s' % type(http_method_names).__name__\n\n        allowed_methods = set(http_method_names) | {'options'}\n        WrappedAPIView.http_method_names = [method.lower() for method in allowed_methods]\n\n        def handler(self, *args, **kwargs):\n            return func(*args, **kwargs)\n\n        for method in http_method_names:\n            setattr(WrappedAPIView, method.lower(), handler)\n\n        WrappedAPIView.__name__ = func.__name__\n        WrappedAPIView.__module__ = func.__module__\n\n        WrappedAPIView.renderer_classes = getattr(func, 'renderer_classes',\n                                                  APIView.renderer_classes)\n\n        WrappedAPIView.parser_classes = getattr(func, 'parser_classes',\n                                                APIView.parser_classes)\n\n        WrappedAPIView.authentication_classes = getattr(func, 'authentication_classes',\n                                                        APIView.authentication_classes)\n\n        WrappedAPIView.throttle_classes = getattr(func, 'throttle_classes',\n                                                  APIView.throttle_classes)\n\n        WrappedAPIView.permission_classes = getattr(func, 'permission_classes',\n                                                    APIView.permission_classes)\n\n        WrappedAPIView.content_negotiation_class = getattr(func, 'content_negotiation_class',\n                                                           APIView.content_negotiation_class)\n\n        WrappedAPIView.metadata_class = getattr(func, 'metadata_class',\n                                                APIView.metadata_class)\n\n        WrappedAPIView.versioning_class = getattr(func, \"versioning_class\",\n                                                  APIView.versioning_class)\n\n        WrappedAPIView.schema = getattr(func, 'schema',\n                                        APIView.schema)\n\n        return WrappedAPIView.as_view()\n\n    return decorator\n\n\ndef _check_decorator_order(func, decorator_name):\n    \"\"\"\n    Check if an API policy decorator is being applied after @api_view.\n    \"\"\"\n    # Check if func is actually a view function (result of APIView.as_view())\n    if hasattr(func, 'cls') and issubclass(func.cls, APIView):\n        raise TypeError(\n            f\"@{decorator_name} must come after (below) the @api_view decorator. \"\n            \"The correct order is:\\n\\n\"\n            \"    @api_view(['GET'])\\n\"\n            f\"    @{decorator_name}(...)\\n\"\n            \"    def my_view(request):\\n\"\n            \"        ...\\n\\n\"\n            \"See https://www.django-rest-framework.org/api-guide/views/#api-policy-decorators\"\n        )\n\n\ndef renderer_classes(renderer_classes):\n    def decorator(func):\n        _check_decorator_order(func, 'renderer_classes')\n        func.renderer_classes = renderer_classes\n        return func\n    return decorator\n\n\ndef parser_classes(parser_classes):\n    def decorator(func):\n        _check_decorator_order(func, 'parser_classes')\n        func.parser_classes = parser_classes\n        return func\n    return decorator\n\n\ndef authentication_classes(authentication_classes):\n    def decorator(func):\n        _check_decorator_order(func, 'authentication_classes')\n        func.authentication_classes = authentication_classes\n        return func\n    return decorator\n\n\ndef throttle_classes(throttle_classes):\n    def decorator(func):\n        _check_decorator_order(func, 'throttle_classes')\n        func.throttle_classes = throttle_classes\n        return func\n    return decorator\n\n\ndef permission_classes(permission_classes):\n    def decorator(func):\n        _check_decorator_order(func, 'permission_classes')\n        func.permission_classes = permission_classes\n        return func\n    return decorator\n\n\ndef content_negotiation_class(content_negotiation_class):\n    def decorator(func):\n        _check_decorator_order(func, 'content_negotiation_class')\n        func.content_negotiation_class = content_negotiation_class\n        return func\n    return decorator\n\n\ndef metadata_class(metadata_class):\n    def decorator(func):\n        _check_decorator_order(func, 'metadata_class')\n        func.metadata_class = metadata_class\n        return func\n    return decorator\n\n\ndef versioning_class(versioning_class):\n    def decorator(func):\n        _check_decorator_order(func, 'versioning_class')\n        func.versioning_class = versioning_class\n        return func\n    return decorator\n\n\ndef schema(view_inspector):\n    def decorator(func):\n        _check_decorator_order(func, 'schema')\n        func.schema = view_inspector\n        return func\n    return decorator\n\n\ndef action(methods=None, detail=None, url_path=None, url_name=None, **kwargs):\n    \"\"\"\n    Mark a ViewSet method as a routable action.\n\n    `@action`-decorated functions will be endowed with a `mapping` property,\n    a `MethodMapper` that can be used to add additional method-based behaviors\n    on the routed action.\n\n    :param methods: A list of HTTP method names this action responds to.\n                    Defaults to GET only.\n    :param detail: Required. Determines whether this action applies to\n                   instance/detail requests or collection/list requests.\n    :param url_path: Define the URL segment for this action. Defaults to the\n                     name of the method decorated.\n    :param url_name: Define the internal (`reverse`) URL name for this action.\n                     Defaults to the name of the method decorated with underscores\n                     replaced with dashes.\n    :param kwargs: Additional properties to set on the view.  This can be used\n                   to override viewset-level *_classes settings, equivalent to\n                   how the `@renderer_classes` etc. decorators work for function-\n                   based API views.\n    \"\"\"\n    methods = ['get'] if methods is None else methods\n    methods = [method.lower() for method in methods]\n\n    assert detail is not None, (\n        \"@action() missing required argument: 'detail'\"\n    )\n\n    # name and suffix are mutually exclusive\n    if 'name' in kwargs and 'suffix' in kwargs:\n        raise TypeError(\"`name` and `suffix` are mutually exclusive arguments.\")\n\n    def decorator(func):\n        func.mapping = MethodMapper(func, methods)\n\n        func.detail = detail\n        func.url_path = url_path if url_path else func.__name__\n        func.url_name = url_name if url_name else func.__name__.replace('_', '-')\n\n        # These kwargs will end up being passed to `ViewSet.as_view()` within\n        # the router, which eventually delegates to Django's CBV `View`,\n        # which assigns them as instance attributes for each request.\n        func.kwargs = kwargs\n\n        # Set descriptive arguments for viewsets\n        if 'name' not in kwargs and 'suffix' not in kwargs:\n            func.kwargs['name'] = pretty_name(func.__name__)\n        func.kwargs['description'] = func.__doc__ or None\n\n        return func\n    return decorator\n\n\nclass MethodMapper(dict):\n    \"\"\"\n    Enables mapping HTTP methods to different ViewSet methods for a single,\n    logical action.\n\n    Example usage:\n\n        class MyViewSet(ViewSet):\n\n            @action(detail=False)\n            def example(self, request, **kwargs):\n                ...\n\n            @example.mapping.post\n            def create_example(self, request, **kwargs):\n                ...\n    \"\"\"\n\n    def __init__(self, action, methods):\n        self.action = action\n        for method in methods:\n            self[method] = self.action.__name__\n\n    def _map(self, method, func):\n        assert method not in self, (\n            \"Method '%s' has already been mapped to '.%s'.\" % (method, self[method]))\n        assert func.__name__ != self.action.__name__, (\n            \"Method mapping does not behave like the property decorator. You \"\n            \"cannot use the same method name for each mapping declaration.\")\n\n        self[method] = func.__name__\n\n        return func\n\n    def get(self, func):\n        return self._map('get', func)\n\n    def post(self, func):\n        return self._map('post', func)\n\n    def put(self, func):\n        return self._map('put', func)\n\n    def patch(self, func):\n        return self._map('patch', func)\n\n    def delete(self, func):\n        return self._map('delete', func)\n\n    def head(self, func):\n        return self._map('head', func)\n\n    def options(self, func):\n        return self._map('options', func)\n\n    def trace(self, func):\n        return self._map('trace', func)\n"
  },
  {
    "path": "rest_framework/exceptions.py",
    "content": "\"\"\"\nHandled exceptions raised by REST framework.\n\nIn addition, Django's built in 403 and 404 exceptions are handled.\n(`django.http.Http404` and `django.core.exceptions.PermissionDenied`)\n\"\"\"\nimport math\n\nfrom django.http import JsonResponse\nfrom django.utils.encoding import force_str\nfrom django.utils.translation import gettext_lazy as _\nfrom django.utils.translation import ngettext\n\nfrom rest_framework import status\nfrom rest_framework.utils.serializer_helpers import ReturnDict, ReturnList\n\n\ndef _get_error_details(data, default_code=None):\n    \"\"\"\n    Descend into a nested data structure, forcing any\n    lazy translation strings or strings into `ErrorDetail`.\n    \"\"\"\n    if isinstance(data, (list, tuple)):\n        ret = [\n            _get_error_details(item, default_code) for item in data\n        ]\n        if isinstance(data, ReturnList):\n            return ReturnList(ret, serializer=data.serializer)\n        return ret\n    elif isinstance(data, dict):\n        ret = {\n            key: _get_error_details(value, default_code)\n            for key, value in data.items()\n        }\n        if isinstance(data, ReturnDict):\n            return ReturnDict(ret, serializer=data.serializer)\n        return ret\n\n    text = force_str(data)\n    code = getattr(data, 'code', default_code)\n    return ErrorDetail(text, code)\n\n\ndef _get_codes(detail):\n    if isinstance(detail, list):\n        return [_get_codes(item) for item in detail]\n    elif isinstance(detail, dict):\n        return {key: _get_codes(value) for key, value in detail.items()}\n    return detail.code\n\n\ndef _get_full_details(detail):\n    if isinstance(detail, list):\n        return [_get_full_details(item) for item in detail]\n    elif isinstance(detail, dict):\n        return {key: _get_full_details(value) for key, value in detail.items()}\n    return {\n        'message': detail,\n        'code': detail.code\n    }\n\n\nclass ErrorDetail(str):\n    \"\"\"\n    A string-like object that can additionally have a code.\n    \"\"\"\n    code = None\n\n    def __new__(cls, string, code=None):\n        self = super().__new__(cls, string)\n        self.code = code\n        return self\n\n    def __eq__(self, other):\n        result = super().__eq__(other)\n        if result is NotImplemented:\n            return NotImplemented\n        try:\n            return result and self.code == other.code\n        except AttributeError:\n            return result\n\n    def __ne__(self, other):\n        result = self.__eq__(other)\n        if result is NotImplemented:\n            return NotImplemented\n        return not result\n\n    def __repr__(self):\n        return 'ErrorDetail(string=%r, code=%r)' % (\n            str(self),\n            self.code,\n        )\n\n    def __hash__(self):\n        return hash(str(self))\n\n\nclass APIException(Exception):\n    \"\"\"\n    Base class for REST framework exceptions.\n    Subclasses should provide `.status_code` and `.default_detail` properties.\n    \"\"\"\n    status_code = status.HTTP_500_INTERNAL_SERVER_ERROR\n    default_detail = _('A server error occurred.')\n    default_code = 'error'\n\n    def __init__(self, detail=None, code=None):\n        if detail is None:\n            detail = self.default_detail\n        if code is None:\n            code = self.default_code\n\n        self.detail = _get_error_details(detail, code)\n\n    def __str__(self):\n        return str(self.detail)\n\n    def get_codes(self):\n        \"\"\"\n        Return only the code part of the error details.\n\n        Eg. {\"name\": [\"required\"]}\n        \"\"\"\n        return _get_codes(self.detail)\n\n    def get_full_details(self):\n        \"\"\"\n        Return both the message & code parts of the error details.\n\n        Eg. {\"name\": [{\"message\": \"This field is required.\", \"code\": \"required\"}]}\n        \"\"\"\n        return _get_full_details(self.detail)\n\n\n# The recommended style for using `ValidationError` is to keep it namespaced\n# under `serializers`, in order to minimize potential confusion with Django's\n# built in `ValidationError`. For example:\n#\n# from rest_framework import serializers\n# raise serializers.ValidationError('Value was invalid')\n\nclass ValidationError(APIException):\n    status_code = status.HTTP_400_BAD_REQUEST\n    default_detail = _('Invalid input.')\n    default_code = 'invalid'\n\n    def __init__(self, detail=None, code=None):\n        if detail is None:\n            detail = self.default_detail\n        if code is None:\n            code = self.default_code\n\n        # For validation failures, we may collect many errors together,\n        # so the details should always be coerced to a list if not already.\n        if isinstance(detail, tuple):\n            detail = list(detail)\n        elif not isinstance(detail, dict) and not isinstance(detail, list):\n            detail = [detail]\n\n        self.detail = _get_error_details(detail, code)\n\n\nclass ParseError(APIException):\n    status_code = status.HTTP_400_BAD_REQUEST\n    default_detail = _('Malformed request.')\n    default_code = 'parse_error'\n\n\nclass AuthenticationFailed(APIException):\n    status_code = status.HTTP_401_UNAUTHORIZED\n    default_detail = _('Incorrect authentication credentials.')\n    default_code = 'authentication_failed'\n\n\nclass NotAuthenticated(APIException):\n    status_code = status.HTTP_401_UNAUTHORIZED\n    default_detail = _('Authentication credentials were not provided.')\n    default_code = 'not_authenticated'\n\n\nclass PermissionDenied(APIException):\n    status_code = status.HTTP_403_FORBIDDEN\n    default_detail = _('You do not have permission to perform this action.')\n    default_code = 'permission_denied'\n\n\nclass NotFound(APIException):\n    status_code = status.HTTP_404_NOT_FOUND\n    default_detail = _('Not found.')\n    default_code = 'not_found'\n\n\nclass MethodNotAllowed(APIException):\n    status_code = status.HTTP_405_METHOD_NOT_ALLOWED\n    default_detail = _('Method \"{method}\" not allowed.')\n    default_code = 'method_not_allowed'\n\n    def __init__(self, method, detail=None, code=None):\n        if detail is None:\n            detail = force_str(self.default_detail).format(method=method)\n        super().__init__(detail, code)\n\n\nclass NotAcceptable(APIException):\n    status_code = status.HTTP_406_NOT_ACCEPTABLE\n    default_detail = _('Could not satisfy the request Accept header.')\n    default_code = 'not_acceptable'\n\n    def __init__(self, detail=None, code=None, available_renderers=None):\n        self.available_renderers = available_renderers\n        super().__init__(detail, code)\n\n\nclass UnsupportedMediaType(APIException):\n    status_code = status.HTTP_415_UNSUPPORTED_MEDIA_TYPE\n    default_detail = _('Unsupported media type \"{media_type}\" in request.')\n    default_code = 'unsupported_media_type'\n\n    def __init__(self, media_type, detail=None, code=None):\n        if detail is None:\n            detail = force_str(self.default_detail).format(media_type=media_type)\n        super().__init__(detail, code)\n\n\nclass Throttled(APIException):\n    status_code = status.HTTP_429_TOO_MANY_REQUESTS\n    default_detail = _('Request was throttled.')\n    extra_detail_singular = _('Expected available in {wait} second.')\n    extra_detail_plural = _('Expected available in {wait} seconds.')\n    default_code = 'throttled'\n\n    def __init__(self, wait=None, detail=None, code=None):\n        if detail is None:\n            detail = force_str(self.default_detail)\n        if wait is not None:\n            wait = math.ceil(wait)\n            detail = ' '.join((\n                detail,\n                force_str(ngettext(self.extra_detail_singular.format(wait=wait),\n                                   self.extra_detail_plural.format(wait=wait),\n                                   wait))))\n        self.wait = wait\n        super().__init__(detail, code)\n\n\ndef server_error(request, *args, **kwargs):\n    \"\"\"\n    Generic 500 error handler.\n    \"\"\"\n    data = {\n        'error': 'Server Error (500)'\n    }\n    return JsonResponse(data, status=status.HTTP_500_INTERNAL_SERVER_ERROR)\n\n\ndef bad_request(request, exception, *args, **kwargs):\n    \"\"\"\n    Generic 400 error handler.\n    \"\"\"\n    data = {\n        'error': 'Bad Request (400)'\n    }\n    return JsonResponse(data, status=status.HTTP_400_BAD_REQUEST)\n"
  },
  {
    "path": "rest_framework/fields.py",
    "content": "import contextlib\nimport copy\nimport datetime\nimport decimal\nimport functools\nimport inspect\nimport re\nimport uuid\nimport warnings\nfrom collections.abc import Mapping\nfrom enum import Enum\n\nfrom django.conf import settings\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.core.exceptions import ValidationError as DjangoValidationError\nfrom django.core.validators import (\n    EmailValidator, MaxLengthValidator, MaxValueValidator, MinLengthValidator,\n    MinValueValidator, ProhibitNullCharactersValidator, RegexValidator,\n    URLValidator\n)\nfrom django.forms import FilePathField as DjangoFilePathField\nfrom django.forms import ImageField as DjangoImageField\nfrom django.utils import timezone\nfrom django.utils.dateparse import (\n    parse_date, parse_datetime, parse_duration, parse_time\n)\nfrom django.utils.duration import duration_iso_string, duration_string\nfrom django.utils.encoding import is_protected_type, smart_str\nfrom django.utils.formats import localize_input, sanitize_separators\nfrom django.utils.ipv6 import clean_ipv6_address\nfrom django.utils.translation import gettext_lazy as _\n\ntry:\n    import pytz\nexcept ImportError:\n    pytz = None\n\nfrom rest_framework import DJANGO_DURATION_FORMAT, ISO_8601\nfrom rest_framework.compat import ip_address_validators\nfrom rest_framework.exceptions import ErrorDetail, ValidationError\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils import html, humanize_datetime, json, representation\nfrom rest_framework.utils.formatting import lazy_format\nfrom rest_framework.utils.timezone import valid_datetime\nfrom rest_framework.validators import ProhibitSurrogateCharactersValidator\n\n\nclass empty:\n    \"\"\"\n    This class is used to represent no data being provided for a given input\n    or output value.\n\n    It is required because `None` may be a valid input or output value.\n    \"\"\"\n    pass\n\n\nclass BuiltinSignatureError(Exception):\n    \"\"\"\n    Built-in function signatures are not inspectable. This exception is raised\n    so the serializer can raise a helpful error message.\n    \"\"\"\n    pass\n\n\ndef is_simple_callable(obj):\n    \"\"\"\n    True if the object is a callable that takes no arguments.\n    \"\"\"\n    if not callable(obj):\n        return False\n\n    # Bail early since we cannot inspect built-in function signatures.\n    if inspect.isbuiltin(obj):\n        raise BuiltinSignatureError(\n            'Built-in function signatures are not inspectable. '\n            'Wrap the function call in a simple, pure Python function.')\n\n    if not (inspect.isfunction(obj) or inspect.ismethod(obj) or isinstance(obj, functools.partial)):\n        return False\n\n    sig = inspect.signature(obj)\n    params = sig.parameters.values()\n    return all(\n        param.kind == param.VAR_POSITIONAL or\n        param.kind == param.VAR_KEYWORD or\n        param.default != param.empty\n        for param in params\n    )\n\n\ndef get_attribute(instance, attrs):\n    \"\"\"\n    Similar to Python's built in `getattr(instance, attr)`,\n    but takes a list of nested attributes, instead of a single attribute.\n\n    Also accepts either attribute lookup on objects or dictionary lookups.\n    \"\"\"\n    for attr in attrs:\n        try:\n            if isinstance(instance, Mapping):\n                instance = instance[attr]\n            else:\n                instance = getattr(instance, attr)\n        except ObjectDoesNotExist:\n            return None\n        if is_simple_callable(instance):\n            try:\n                instance = instance()\n            except (AttributeError, KeyError) as exc:\n                # If we raised an Attribute or KeyError here it'd get treated\n                # as an omitted field in `Field.get_attribute()`. Instead we\n                # raise a ValueError to ensure the exception is not masked.\n                raise ValueError(f'Exception raised in callable attribute \"{attr}\"; original exception was: {exc}')\n\n    return instance\n\n\ndef to_choices_dict(choices):\n    \"\"\"\n    Convert choices into key/value dicts.\n\n    to_choices_dict([1]) -> {1: 1}\n    to_choices_dict([(1, '1st'), (2, '2nd')]) -> {1: '1st', 2: '2nd'}\n    to_choices_dict([('Group', ((1, '1st'), 2))]) -> {'Group': {1: '1st', 2: '2'}}\n    \"\"\"\n    # Allow single, paired or grouped choices style:\n    # choices = [1, 2, 3]\n    # choices = [(1, 'First'), (2, 'Second'), (3, 'Third')]\n    # choices = [('Category', ((1, 'First'), (2, 'Second'))), (3, 'Third')]\n    ret = {}\n    for choice in choices:\n        if not isinstance(choice, (list, tuple)):\n            # single choice\n            ret[choice] = choice\n        else:\n            key, value = choice\n            if isinstance(value, (list, tuple)):\n                # grouped choices (category, sub choices)\n                ret[key] = to_choices_dict(value)\n            else:\n                # paired choice (key, display value)\n                ret[key] = value\n    return ret\n\n\ndef flatten_choices_dict(choices):\n    \"\"\"\n    Convert a group choices dict into a flat dict of choices.\n\n    flatten_choices_dict({1: '1st', 2: '2nd'}) -> {1: '1st', 2: '2nd'}\n    flatten_choices_dict({'Group': {1: '1st', 2: '2nd'}}) -> {1: '1st', 2: '2nd'}\n    \"\"\"\n    ret = {}\n    for key, value in choices.items():\n        if isinstance(value, dict):\n            # grouped choices (category, sub choices)\n            for sub_key, sub_value in value.items():\n                ret[sub_key] = sub_value\n        else:\n            # choice (key, display value)\n            ret[key] = value\n    return ret\n\n\ndef iter_options(grouped_choices, cutoff=None, cutoff_text=None):\n    \"\"\"\n    Helper function for options and option groups in templates.\n    \"\"\"\n    class StartOptionGroup:\n        start_option_group = True\n        end_option_group = False\n\n        def __init__(self, label):\n            self.label = label\n\n    class EndOptionGroup:\n        start_option_group = False\n        end_option_group = True\n\n    class Option:\n        start_option_group = False\n        end_option_group = False\n\n        def __init__(self, value, display_text, disabled=False):\n            self.value = value\n            self.display_text = display_text\n            self.disabled = disabled\n\n    count = 0\n\n    for key, value in grouped_choices.items():\n        if cutoff and count >= cutoff:\n            break\n\n        if isinstance(value, dict):\n            yield StartOptionGroup(label=key)\n            for sub_key, sub_value in value.items():\n                if cutoff and count >= cutoff:\n                    break\n                yield Option(value=sub_key, display_text=sub_value)\n                count += 1\n            yield EndOptionGroup()\n        else:\n            yield Option(value=key, display_text=value)\n            count += 1\n\n    if cutoff and count >= cutoff and cutoff_text:\n        cutoff_text = cutoff_text.format(count=cutoff)\n        yield Option(value='n/a', display_text=cutoff_text, disabled=True)\n\n\ndef get_error_detail(exc_info):\n    \"\"\"\n    Given a Django ValidationError, return a list of ErrorDetail,\n    with the `code` populated.\n    \"\"\"\n    code = getattr(exc_info, 'code', None) or 'invalid'\n\n    try:\n        error_dict = exc_info.error_dict\n    except AttributeError:\n        return [\n            ErrorDetail((error.message % error.params) if error.params else error.message,\n                        code=error.code if error.code else code)\n            for error in exc_info.error_list]\n    return {\n        k: [\n            ErrorDetail((error.message % error.params) if error.params else error.message,\n                        code=error.code if error.code else code)\n            for error in errors\n        ] for k, errors in error_dict.items()\n    }\n\n\nclass CreateOnlyDefault:\n    \"\"\"\n    This class may be used to provide default values that are only used\n    for create operations, but that do not return any value for update\n    operations.\n    \"\"\"\n    requires_context = True\n\n    def __init__(self, default):\n        self.default = default\n\n    def __call__(self, serializer_field):\n        is_update = serializer_field.parent.instance is not None\n        if is_update:\n            raise SkipField()\n        if callable(self.default):\n            if getattr(self.default, 'requires_context', False):\n                return self.default(serializer_field)\n            else:\n                return self.default()\n        return self.default\n\n    def __repr__(self):\n        return '%s(%s)' % (self.__class__.__name__, repr(self.default))\n\n\nclass CurrentUserDefault:\n    requires_context = True\n\n    def __call__(self, serializer_field):\n        return serializer_field.context['request'].user\n\n    def __repr__(self):\n        return '%s()' % self.__class__.__name__\n\n\nclass SkipField(Exception):\n    pass\n\n\nREGEX_TYPE = type(re.compile(''))\n\nNOT_READ_ONLY_WRITE_ONLY = 'May not set both `read_only` and `write_only`'\nNOT_READ_ONLY_REQUIRED = 'May not set both `read_only` and `required`'\nNOT_REQUIRED_DEFAULT = 'May not set both `required` and `default`'\nUSE_READONLYFIELD = 'Field(read_only=True) should be ReadOnlyField'\nMISSING_ERROR_MESSAGE = (\n    'ValidationError raised by `{class_name}`, but error key `{key}` does '\n    'not exist in the `error_messages` dictionary.'\n)\n\n\nclass Field:\n    _creation_counter = 0\n\n    default_error_messages = {\n        'required': _('This field is required.'),\n        'null': _('This field may not be null.')\n    }\n    default_validators = []\n    default_empty_html = empty\n    initial = None\n\n    def __init__(self, *, read_only=False, write_only=False,\n                 required=None, default=empty, initial=empty, source=None,\n                 label=None, help_text=None, style=None,\n                 error_messages=None, validators=None, allow_null=False):\n        self._creation_counter = Field._creation_counter\n        Field._creation_counter += 1\n\n        # If `required` is unset, then use `True` unless a default is provided.\n        if required is None:\n            required = default is empty and not read_only\n\n        # Some combinations of keyword arguments do not make sense.\n        assert not (read_only and write_only), NOT_READ_ONLY_WRITE_ONLY\n        assert not (read_only and required), NOT_READ_ONLY_REQUIRED\n        assert not (required and default is not empty), NOT_REQUIRED_DEFAULT\n        assert not (read_only and self.__class__ == Field), USE_READONLYFIELD\n\n        self.read_only = read_only\n        self.write_only = write_only\n        self.required = required\n        self.default = default\n        self.source = source\n        self.initial = self.initial if (initial is empty) else initial\n        self.label = label\n        self.help_text = help_text\n        self.style = {} if style is None else style\n        self.allow_null = allow_null\n\n        if self.default_empty_html is not empty:\n            if default is not empty:\n                self.default_empty_html = default\n\n        if validators is not None:\n            self.validators = list(validators)\n\n        # These are set up by `.bind()` when the field is added to a serializer.\n        self.field_name = None\n        self.parent = None\n\n        # Collect default error message from self and parent classes\n        messages = {}\n        for cls in reversed(self.__class__.__mro__):\n            messages.update(getattr(cls, 'default_error_messages', {}))\n        messages.update(error_messages or {})\n        self.error_messages = messages\n\n    # Allow generic typing checking for fields.\n    def __class_getitem__(cls, *args, **kwargs):\n        return cls\n\n    def bind(self, field_name, parent):\n        \"\"\"\n        Initializes the field name and parent for the field instance.\n        Called when a field is added to the parent serializer instance.\n        \"\"\"\n\n        # In order to enforce a consistent style, we error if a redundant\n        # 'source' argument has been used. For example:\n        # my_field = serializer.CharField(source='my_field')\n        assert self.source != field_name, (\n            \"It is redundant to specify `source='%s'` on field '%s' in \"\n            \"serializer '%s', because it is the same as the field name. \"\n            \"Remove the `source` keyword argument.\" %\n            (field_name, self.__class__.__name__, parent.__class__.__name__)\n        )\n\n        self.field_name = field_name\n        self.parent = parent\n\n        # `self.label` should default to being based on the field name.\n        if self.label is None:\n            self.label = field_name.replace('_', ' ').capitalize()\n\n        # self.source should default to being the same as the field name.\n        if self.source is None:\n            self.source = field_name\n\n        # self.source_attrs is a list of attributes that need to be looked up\n        # when serializing the instance, or populating the validated data.\n        if self.source == '*':\n            self.source_attrs = []\n        else:\n            self.source_attrs = self.source.split('.')\n\n    # .validators is a lazily loaded property, that gets its default\n    # value from `get_validators`.\n    @property\n    def validators(self):\n        if not hasattr(self, '_validators'):\n            self._validators = self.get_validators()\n        return self._validators\n\n    @validators.setter\n    def validators(self, validators):\n        self._validators = validators\n\n    def get_validators(self):\n        return list(self.default_validators)\n\n    def get_initial(self):\n        \"\"\"\n        Return a value to use when the field is being returned as a primitive\n        value, without any object instance.\n        \"\"\"\n        if callable(self.initial):\n            return self.initial()\n        return self.initial\n\n    def get_value(self, dictionary):\n        \"\"\"\n        Given the *incoming* primitive data, return the value for this field\n        that should be validated and transformed to a native value.\n        \"\"\"\n        if html.is_html_input(dictionary):\n            # HTML forms will represent empty fields as '', and cannot\n            # represent None or False values directly.\n            if self.field_name not in dictionary:\n                if getattr(self.root, 'partial', False):\n                    return empty\n                return self.default_empty_html\n            ret = dictionary[self.field_name]\n            if ret == '' and self.allow_null:\n                # If the field is blank, and null is a valid value then\n                # determine if we should use null instead.\n                return '' if getattr(self, 'allow_blank', False) else None\n            elif ret == '' and not self.required:\n                # If the field is blank, and emptiness is valid then\n                # determine if we should use emptiness instead.\n                return '' if getattr(self, 'allow_blank', False) else empty\n            return ret\n        return dictionary.get(self.field_name, empty)\n\n    def get_attribute(self, instance):\n        \"\"\"\n        Given the *outgoing* object instance, return the primitive value\n        that should be used for this field.\n        \"\"\"\n        try:\n            return get_attribute(instance, self.source_attrs)\n        except BuiltinSignatureError as exc:\n            msg = (\n                'Field source for `{serializer}.{field}` maps to a built-in '\n                'function type and is invalid. Define a property or method on '\n                'the `{instance}` instance that wraps the call to the built-in '\n                'function.'.format(\n                    serializer=self.parent.__class__.__name__,\n                    field=self.field_name,\n                    instance=instance.__class__.__name__,\n                )\n            )\n            raise type(exc)(msg)\n        except (KeyError, AttributeError) as exc:\n            if self.default is not empty:\n                return self.get_default()\n            if self.allow_null:\n                return None\n            if not self.required:\n                raise SkipField()\n            msg = (\n                'Got {exc_type} when attempting to get a value for field '\n                '`{field}` on serializer `{serializer}`.\\nThe serializer '\n                'field might be named incorrectly and not match '\n                'any attribute or key on the `{instance}` instance.\\n'\n                'Original exception text was: {exc}.'.format(\n                    exc_type=type(exc).__name__,\n                    field=self.field_name,\n                    serializer=self.parent.__class__.__name__,\n                    instance=instance.__class__.__name__,\n                    exc=exc\n                )\n            )\n            raise type(exc)(msg)\n\n    def get_default(self):\n        \"\"\"\n        Return the default value to use when validating data if no input\n        is provided for this field.\n\n        If a default has not been set for this field then this will simply\n        raise `SkipField`, indicating that no value should be set in the\n        validated data for this field.\n        \"\"\"\n        if self.default is empty or getattr(self.root, 'partial', False):\n            # No default, or this is a partial update.\n            raise SkipField()\n        if callable(self.default):\n            if getattr(self.default, 'requires_context', False):\n                return self.default(self)\n            else:\n                return self.default()\n\n        return self.default\n\n    def validate_empty_values(self, data):\n        \"\"\"\n        Validate empty values, and either:\n\n        * Raise `ValidationError`, indicating invalid data.\n        * Raise `SkipField`, indicating that the field should be ignored.\n        * Return (True, data), indicating an empty value that should be\n          returned without any further validation being applied.\n        * Return (False, data), indicating a non-empty value, that should\n          have validation applied as normal.\n        \"\"\"\n        if self.read_only:\n            return (True, self.get_default())\n\n        if data is empty:\n            if getattr(self.root, 'partial', False):\n                raise SkipField()\n            if self.required:\n                self.fail('required')\n            return (True, self.get_default())\n\n        if data is None:\n            if not self.allow_null:\n                self.fail('null')\n            # Nullable `source='*'` fields should not be skipped when its named\n            # field is given a null value. This is because `source='*'` means\n            # the field is passed the entire object, which is not null.\n            elif self.source == '*':\n                return (False, None)\n            return (True, None)\n\n        return (False, data)\n\n    def run_validation(self, data=empty):\n        \"\"\"\n        Validate a simple representation and return the internal value.\n\n        The provided data may be `empty` if no representation was included\n        in the input.\n\n        May raise `SkipField` if the field should not be included in the\n        validated data.\n        \"\"\"\n        (is_empty_value, data) = self.validate_empty_values(data)\n        if is_empty_value:\n            return data\n        value = self.to_internal_value(data)\n        self.run_validators(value)\n        return value\n\n    def run_validators(self, value):\n        \"\"\"\n        Test the given value against all the validators on the field,\n        and either raise a `ValidationError` or simply return.\n        \"\"\"\n        errors = []\n        for validator in self.validators:\n            try:\n                if getattr(validator, 'requires_context', False):\n                    validator(value, self)\n                else:\n                    validator(value)\n            except ValidationError as exc:\n                # If the validation error contains a mapping of fields to\n                # errors then simply raise it immediately rather than\n                # attempting to accumulate a list of errors.\n                if isinstance(exc.detail, dict):\n                    raise\n                errors.extend(exc.detail)\n            except DjangoValidationError as exc:\n                errors.extend(get_error_detail(exc))\n        if errors:\n            raise ValidationError(errors)\n\n    def to_internal_value(self, data):\n        \"\"\"\n        Transform the *incoming* primitive data into a native value.\n        \"\"\"\n        raise NotImplementedError(\n            '{cls}.to_internal_value() must be implemented for field '\n            '{field_name}. If you do not need to support write operations '\n            'you probably want to subclass `ReadOnlyField` instead.'.format(\n                cls=self.__class__.__name__,\n                field_name=self.field_name,\n            )\n        )\n\n    def to_representation(self, value):\n        \"\"\"\n        Transform the *outgoing* native value into primitive data.\n        \"\"\"\n        raise NotImplementedError(\n            '{cls}.to_representation() must be implemented for field {field_name}.'.format(\n                cls=self.__class__.__name__,\n                field_name=self.field_name,\n            )\n        )\n\n    def fail(self, key, **kwargs):\n        \"\"\"\n        A helper method that simply raises a validation error.\n        \"\"\"\n        try:\n            msg = self.error_messages[key]\n        except KeyError:\n            class_name = self.__class__.__name__\n            msg = MISSING_ERROR_MESSAGE.format(class_name=class_name, key=key)\n            raise AssertionError(msg)\n        message_string = msg.format(**kwargs)\n        raise ValidationError(message_string, code=key)\n\n    @property\n    def root(self):\n        \"\"\"\n        Returns the top-level serializer for this field.\n        \"\"\"\n        root = self\n        while root.parent is not None:\n            root = root.parent\n        return root\n\n    @property\n    def context(self):\n        \"\"\"\n        Returns the context as passed to the root serializer on initialization.\n        \"\"\"\n        return getattr(self.root, '_context', {})\n\n    def __new__(cls, *args, **kwargs):\n        \"\"\"\n        When a field is instantiated, we store the arguments that were used,\n        so that we can present a helpful representation of the object.\n        \"\"\"\n        instance = super().__new__(cls)\n        instance._args = args\n        instance._kwargs = kwargs\n        return instance\n\n    def __deepcopy__(self, memo):\n        \"\"\"\n        When cloning fields we instantiate using the arguments it was\n        originally created with, rather than copying the complete state.\n        \"\"\"\n        # Treat regexes and validators as immutable.\n        # See https://github.com/encode/django-rest-framework/issues/1954\n        # and https://github.com/encode/django-rest-framework/pull/4489\n        args = [\n            copy.deepcopy(item) if not isinstance(item, REGEX_TYPE) else item\n            for item in self._args\n        ]\n        kwargs = {\n            key: (copy.deepcopy(value, memo) if (key not in ('validators', 'regex')) else value)\n            for key, value in self._kwargs.items()\n        }\n        return self.__class__(*args, **kwargs)\n\n    def __repr__(self):\n        \"\"\"\n        Fields are represented using their initial calling arguments.\n        This allows us to create descriptive representations for serializer\n        instances that show all the declared fields on the serializer.\n        \"\"\"\n        return representation.field_repr(self)\n\n\n# Boolean types...\n\nclass BooleanField(Field):\n    default_error_messages = {\n        'invalid': _('Must be a valid boolean.')\n    }\n    default_empty_html = False\n    initial = False\n    TRUE_VALUES = {\n        't',\n        'y',\n        'yes',\n        'true',\n        'on',\n        '1',\n        1,\n        True,\n    }\n    FALSE_VALUES = {\n        'f',\n        'n',\n        'no',\n        'false',\n        'off',\n        '0',\n        0,\n        0.0,\n        False,\n    }\n    NULL_VALUES = {'null', '', None}\n\n    def __init__(self, **kwargs):\n        if kwargs.get('allow_null', False):\n            self.default_empty_html = None\n            self.initial = None\n        super().__init__(**kwargs)\n\n    @staticmethod\n    def _lower_if_str(value):\n        if isinstance(value, str):\n            return value.lower()\n        return value\n\n    def to_internal_value(self, data):\n        with contextlib.suppress(TypeError):\n            if self._lower_if_str(data) in self.TRUE_VALUES:\n                return True\n            elif self._lower_if_str(data) in self.FALSE_VALUES:\n                return False\n            elif self._lower_if_str(data) in self.NULL_VALUES and self.allow_null:\n                return None\n        self.fail(\"invalid\", input=data)\n\n    def to_representation(self, value):\n        if self._lower_if_str(value) in self.TRUE_VALUES:\n            return True\n        elif self._lower_if_str(value) in self.FALSE_VALUES:\n            return False\n        if self._lower_if_str(value) in self.NULL_VALUES and self.allow_null:\n            return None\n        return bool(value)\n\n\n# String types...\n\nclass CharField(Field):\n    default_error_messages = {\n        'invalid': _('Not a valid string.'),\n        'blank': _('This field may not be blank.'),\n        'max_length': _('Ensure this field has no more than {max_length} characters.'),\n        'min_length': _('Ensure this field has at least {min_length} characters.'),\n    }\n    initial = ''\n\n    def __init__(self, **kwargs):\n        self.allow_blank = kwargs.pop('allow_blank', False)\n        self.trim_whitespace = kwargs.pop('trim_whitespace', True)\n        self.max_length = kwargs.pop('max_length', None)\n        self.min_length = kwargs.pop('min_length', None)\n        super().__init__(**kwargs)\n        if self.max_length is not None:\n            message = lazy_format(self.error_messages['max_length'], max_length=self.max_length)\n            self.validators.append(\n                MaxLengthValidator(self.max_length, message=message))\n        if self.min_length is not None:\n            message = lazy_format(self.error_messages['min_length'], min_length=self.min_length)\n            self.validators.append(\n                MinLengthValidator(self.min_length, message=message))\n\n        self.validators.append(ProhibitNullCharactersValidator())\n        self.validators.append(ProhibitSurrogateCharactersValidator())\n\n    def run_validation(self, data=empty):\n        # Test for the empty string here so that it does not get validated,\n        # and so that subclasses do not need to handle it explicitly\n        # inside the `to_internal_value()` method.\n        if data == '' or (self.trim_whitespace and str(data).strip() == ''):\n            if not self.allow_blank:\n                self.fail('blank')\n            return ''\n        return super().run_validation(data)\n\n    def to_internal_value(self, data):\n        # We're lenient with allowing basic numerics to be coerced into strings,\n        # but other types should fail. Eg. unclear if booleans should represent as `true` or `True`,\n        # and composites such as lists are likely user error.\n        if isinstance(data, bool) or not isinstance(data, (str, int, float,)):\n            self.fail('invalid')\n        value = str(data)\n        return value.strip() if self.trim_whitespace else value\n\n    def to_representation(self, value):\n        return str(value)\n\n\nclass EmailField(CharField):\n    default_error_messages = {\n        'invalid': _('Enter a valid email address.')\n    }\n\n    def __init__(self, **kwargs):\n        super().__init__(**kwargs)\n        validator = EmailValidator(message=self.error_messages['invalid'])\n        self.validators.append(validator)\n\n\nclass RegexField(CharField):\n    default_error_messages = {\n        'invalid': _('This value does not match the required pattern.')\n    }\n\n    def __init__(self, regex, **kwargs):\n        super().__init__(**kwargs)\n        validator = RegexValidator(regex, message=self.error_messages['invalid'])\n        self.validators.append(validator)\n\n\nclass SlugField(CharField):\n    default_error_messages = {\n        'invalid': _('Enter a valid \"slug\" consisting of letters, numbers, underscores or hyphens.'),\n        'invalid_unicode': _('Enter a valid \"slug\" consisting of Unicode letters, numbers, underscores, or hyphens.')\n    }\n\n    def __init__(self, allow_unicode=False, **kwargs):\n        super().__init__(**kwargs)\n        self.allow_unicode = allow_unicode\n        if self.allow_unicode:\n            validator = RegexValidator(re.compile(r'^[-\\w]+\\Z', re.UNICODE), message=self.error_messages['invalid_unicode'])\n        else:\n            validator = RegexValidator(re.compile(r'^[-a-zA-Z0-9_]+$'), message=self.error_messages['invalid'])\n        self.validators.append(validator)\n\n\nclass URLField(CharField):\n    default_error_messages = {\n        'invalid': _('Enter a valid URL.')\n    }\n\n    def __init__(self, **kwargs):\n        super().__init__(**kwargs)\n        validator = URLValidator(message=self.error_messages['invalid'])\n        self.validators.append(validator)\n\n\nclass UUIDField(Field):\n    valid_formats = ('hex_verbose', 'hex', 'int', 'urn')\n\n    default_error_messages = {\n        'invalid': _('Must be a valid UUID.'),\n    }\n\n    def __init__(self, **kwargs):\n        self.uuid_format = kwargs.pop('format', 'hex_verbose')\n        if self.uuid_format not in self.valid_formats:\n            raise ValueError(\n                'Invalid format for uuid representation. '\n                'Must be one of \"{}\"'.format('\", \"'.join(self.valid_formats))\n            )\n        super().__init__(**kwargs)\n\n    def to_internal_value(self, data):\n        if not isinstance(data, uuid.UUID):\n            try:\n                if isinstance(data, int):\n                    return uuid.UUID(int=data)\n                elif isinstance(data, str):\n                    return uuid.UUID(hex=data)\n                else:\n                    self.fail('invalid', value=data)\n            except (ValueError):\n                self.fail('invalid', value=data)\n        return data\n\n    def to_representation(self, value):\n        if self.uuid_format == 'hex_verbose':\n            return str(value)\n        else:\n            return getattr(value, self.uuid_format)\n\n\nclass IPAddressField(CharField):\n    \"\"\"Support both IPAddressField and GenericIPAddressField\"\"\"\n\n    default_error_messages = {\n        'invalid': _('Enter a valid IPv4 or IPv6 address.'),\n    }\n\n    def __init__(self, protocol='both', **kwargs):\n        self.protocol = protocol.lower()\n        self.unpack_ipv4 = (self.protocol == 'both')\n        super().__init__(**kwargs)\n        validators = ip_address_validators(protocol, self.unpack_ipv4)\n        self.validators.extend(validators)\n\n    def to_internal_value(self, data):\n        if not isinstance(data, str):\n            self.fail('invalid', value=data)\n\n        if ':' in data:\n            try:\n                if self.protocol in ('both', 'ipv6'):\n                    return clean_ipv6_address(data, self.unpack_ipv4)\n            except DjangoValidationError:\n                self.fail('invalid', value=data)\n\n        return super().to_internal_value(data)\n\n\n# Number types...\n\nclass IntegerField(Field):\n    default_error_messages = {\n        'invalid': _('A valid integer is required.'),\n        'max_value': _('Ensure this value is less than or equal to {max_value}.'),\n        'min_value': _('Ensure this value is greater than or equal to {min_value}.'),\n        'max_string_length': _('String value too large.')\n    }\n    MAX_STRING_LENGTH = 1000  # Guard against malicious string inputs.\n    re_decimal = re.compile(r'\\.0*\\s*$')  # allow e.g. '1.0' as an int, but not '1.2'\n\n    def __init__(self, **kwargs):\n        self.max_value = kwargs.pop('max_value', None)\n        self.min_value = kwargs.pop('min_value', None)\n        super().__init__(**kwargs)\n        if self.max_value is not None:\n            message = lazy_format(self.error_messages['max_value'], max_value=self.max_value)\n            self.validators.append(\n                MaxValueValidator(self.max_value, message=message))\n        if self.min_value is not None:\n            message = lazy_format(self.error_messages['min_value'], min_value=self.min_value)\n            self.validators.append(\n                MinValueValidator(self.min_value, message=message))\n\n    def to_internal_value(self, data):\n        if isinstance(data, str) and len(data) > self.MAX_STRING_LENGTH:\n            self.fail('max_string_length')\n\n        try:\n            data = int(self.re_decimal.sub('', str(data)))\n        except (ValueError, TypeError):\n            self.fail('invalid')\n        return data\n\n    def to_representation(self, value):\n        return int(value)\n\n\nclass BigIntegerField(IntegerField):\n\n    default_error_messages = {\n        'invalid': _('A valid biginteger is required.'),\n        'max_value': _('Ensure this value is less than or equal to {max_value}.'),\n        'min_value': _('Ensure this value is greater than or equal to {min_value}.'),\n        'max_string_length': _('String value too large.')\n    }\n\n    def __init__(self, coerce_to_string=None, **kwargs):\n        super().__init__(**kwargs)\n\n        if coerce_to_string is not None:\n            self.coerce_to_string = coerce_to_string\n\n    def to_representation(self, value):\n        if getattr(self, 'coerce_to_string', api_settings.COERCE_BIGINT_TO_STRING):\n            return '' if value is None else str(value)\n\n        return super().to_representation(value)\n\n\nclass FloatField(Field):\n    default_error_messages = {\n        'invalid': _('A valid number is required.'),\n        'max_value': _('Ensure this value is less than or equal to {max_value}.'),\n        'min_value': _('Ensure this value is greater than or equal to {min_value}.'),\n        'max_string_length': _('String value too large.'),\n        'overflow': _('Integer value too large to convert to float')\n    }\n    MAX_STRING_LENGTH = 1000  # Guard against malicious string inputs.\n\n    def __init__(self, **kwargs):\n        self.max_value = kwargs.pop('max_value', None)\n        self.min_value = kwargs.pop('min_value', None)\n        super().__init__(**kwargs)\n        if self.max_value is not None:\n            message = lazy_format(self.error_messages['max_value'], max_value=self.max_value)\n            self.validators.append(\n                MaxValueValidator(self.max_value, message=message))\n        if self.min_value is not None:\n            message = lazy_format(self.error_messages['min_value'], min_value=self.min_value)\n            self.validators.append(\n                MinValueValidator(self.min_value, message=message))\n\n    def to_internal_value(self, data):\n\n        if isinstance(data, str) and len(data) > self.MAX_STRING_LENGTH:\n            self.fail('max_string_length')\n\n        try:\n            return float(data)\n        except (TypeError, ValueError):\n            self.fail('invalid')\n        except OverflowError:\n            self.fail('overflow')\n\n    def to_representation(self, value):\n        return float(value)\n\n\nclass DecimalField(Field):\n    default_error_messages = {\n        'invalid': _('A valid number is required.'),\n        'max_value': _('Ensure this value is less than or equal to {max_value}.'),\n        'min_value': _('Ensure this value is greater than or equal to {min_value}.'),\n        'max_digits': _('Ensure that there are no more than {max_digits} digits in total.'),\n        'max_decimal_places': _('Ensure that there are no more than {max_decimal_places} decimal places.'),\n        'max_whole_digits': _('Ensure that there are no more than {max_whole_digits} digits before the decimal point.'),\n        'max_string_length': _('String value too large.')\n    }\n    MAX_STRING_LENGTH = 1000  # Guard against malicious string inputs.\n\n    def __init__(self, max_digits, decimal_places, coerce_to_string=None, max_value=None, min_value=None,\n                 localize=False, rounding=None, normalize_output=False, **kwargs):\n        self.max_digits = max_digits\n        self.decimal_places = decimal_places\n        self.localize = localize\n        self.normalize_output = normalize_output\n        if coerce_to_string is not None:\n            self.coerce_to_string = coerce_to_string\n        if self.localize:\n            self.coerce_to_string = True\n\n        self.max_value = max_value\n        self.min_value = min_value\n\n        if self.max_value is not None and not isinstance(self.max_value, (int, decimal.Decimal)):\n            warnings.warn(\"max_value should be an integer or Decimal instance.\")\n        if self.min_value is not None and not isinstance(self.min_value, (int, decimal.Decimal)):\n            warnings.warn(\"min_value should be an integer or Decimal instance.\")\n\n        if self.max_digits is not None and self.decimal_places is not None:\n            self.max_whole_digits = self.max_digits - self.decimal_places\n        else:\n            self.max_whole_digits = None\n\n        super().__init__(**kwargs)\n\n        if self.max_value is not None:\n            message = lazy_format(self.error_messages['max_value'], max_value=self.max_value)\n            self.validators.append(\n                MaxValueValidator(self.max_value, message=message))\n        if self.min_value is not None:\n            message = lazy_format(self.error_messages['min_value'], min_value=self.min_value)\n            self.validators.append(\n                MinValueValidator(self.min_value, message=message))\n\n        if rounding is not None:\n            valid_roundings = [v for k, v in vars(decimal).items() if k.startswith('ROUND_')]\n            assert rounding in valid_roundings, (\n                'Invalid rounding option %s. Valid values for rounding are: %s' % (rounding, valid_roundings))\n        self.rounding = rounding\n\n    def validate_empty_values(self, data):\n        if smart_str(data).strip() == '' and self.allow_null:\n            return (True, None)\n        return super().validate_empty_values(data)\n\n    def to_internal_value(self, data):\n        \"\"\"\n        Validate that the input is a decimal number and return a Decimal\n        instance.\n        \"\"\"\n\n        data = smart_str(data).strip()\n\n        if self.localize:\n            data = sanitize_separators(data)\n\n        if len(data) > self.MAX_STRING_LENGTH:\n            self.fail('max_string_length')\n\n        try:\n            value = decimal.Decimal(data)\n        except decimal.DecimalException:\n            self.fail('invalid')\n\n        if value.is_nan():\n            self.fail('invalid')\n\n        # Check for infinity and negative infinity.\n        if value in (decimal.Decimal('Inf'), decimal.Decimal('-Inf')):\n            self.fail('invalid')\n\n        return self.quantize(self.validate_precision(value))\n\n    def validate_precision(self, value):\n        \"\"\"\n        Ensure that there are no more than max_digits in the number, and no\n        more than decimal_places digits after the decimal point.\n\n        Override this method to disable the precision validation for input\n        values or to enhance it in any way you need to.\n        \"\"\"\n        sign, digittuple, exponent = value.as_tuple()\n\n        if exponent >= 0:\n            # 1234500.0\n            total_digits = len(digittuple) + exponent\n            whole_digits = total_digits\n            decimal_places = 0\n        elif len(digittuple) > abs(exponent):\n            # 123.45\n            total_digits = len(digittuple)\n            whole_digits = total_digits - abs(exponent)\n            decimal_places = abs(exponent)\n        else:\n            # 0.001234\n            total_digits = abs(exponent)\n            whole_digits = 0\n            decimal_places = total_digits\n\n        if self.max_digits is not None and total_digits > self.max_digits:\n            self.fail('max_digits', max_digits=self.max_digits)\n        if self.decimal_places is not None and decimal_places > self.decimal_places:\n            self.fail('max_decimal_places', max_decimal_places=self.decimal_places)\n        if self.max_whole_digits is not None and whole_digits > self.max_whole_digits:\n            self.fail('max_whole_digits', max_whole_digits=self.max_whole_digits)\n\n        return value\n\n    def to_representation(self, value):\n        coerce_to_string = getattr(self, 'coerce_to_string', api_settings.COERCE_DECIMAL_TO_STRING)\n\n        if value is None:\n            if coerce_to_string:\n                return ''\n            else:\n                return None\n\n        if not isinstance(value, decimal.Decimal):\n            value = decimal.Decimal(str(value).strip())\n\n        quantized = self.quantize(value)\n\n        if self.normalize_output:\n            quantized = quantized.normalize()\n\n        if not coerce_to_string:\n            return quantized\n        if self.localize:\n            return localize_input(quantized)\n\n        return f'{quantized:f}'\n\n    def quantize(self, value):\n        \"\"\"\n        Quantize the decimal value to the configured precision.\n        \"\"\"\n        if self.decimal_places is None:\n            return value\n\n        context = decimal.getcontext().copy()\n        if self.max_digits is not None:\n            context.prec = self.max_digits\n        return value.quantize(\n            decimal.Decimal('.1') ** self.decimal_places,\n            rounding=self.rounding,\n            context=context\n        )\n\n\n# Date & time fields...\n\nclass DateTimeField(Field):\n    default_error_messages = {\n        'invalid': _('Datetime has wrong format. Use one of these formats instead: {format}.'),\n        'date': _('Expected a datetime but got a date.'),\n        'make_aware': _('Invalid datetime for the timezone \"{timezone}\".'),\n        'overflow': _('Datetime value out of range.')\n    }\n    datetime_parser = datetime.datetime.strptime\n\n    def __init__(self, format=empty, input_formats=None, default_timezone=None, **kwargs):\n        if format is not empty:\n            self.format = format\n        if input_formats is not None:\n            self.input_formats = input_formats\n        if default_timezone is not None:\n            self.timezone = default_timezone\n        super().__init__(**kwargs)\n\n    def enforce_timezone(self, value):\n        \"\"\"\n        When `self.default_timezone` is `None`, always return naive datetimes.\n        When `self.default_timezone` is not `None`, always return aware datetimes.\n        \"\"\"\n        field_timezone = self.timezone if hasattr(self, 'timezone') else self.default_timezone()\n\n        if field_timezone is not None:\n            if timezone.is_aware(value):\n                try:\n                    return value.astimezone(field_timezone)\n                except OverflowError:\n                    self.fail('overflow')\n            try:\n                dt = timezone.make_aware(value, field_timezone)\n                # When the resulting datetime is a ZoneInfo instance, it won't necessarily\n                # throw given an invalid datetime, so we need to specifically check.\n                if not valid_datetime(dt):\n                    self.fail('make_aware', timezone=field_timezone)\n                return dt\n            except Exception as e:\n                if pytz and isinstance(e, pytz.exceptions.InvalidTimeError):\n                    self.fail('make_aware', timezone=field_timezone)\n                raise e\n        elif (field_timezone is None) and timezone.is_aware(value):\n            return timezone.make_naive(value, datetime.timezone.utc)\n        return value\n\n    def default_timezone(self):\n        return timezone.get_current_timezone() if settings.USE_TZ else None\n\n    def to_internal_value(self, value):\n        input_formats = getattr(self, 'input_formats', api_settings.DATETIME_INPUT_FORMATS)\n\n        if isinstance(value, datetime.date) and not isinstance(value, datetime.datetime):\n            self.fail('date')\n\n        if isinstance(value, datetime.datetime):\n            return self.enforce_timezone(value)\n\n        for input_format in input_formats:\n            with contextlib.suppress(ValueError, TypeError):\n                if input_format.lower() == ISO_8601:\n                    parsed = parse_datetime(value)\n                    if parsed is not None:\n                        return self.enforce_timezone(parsed)\n\n                parsed = self.datetime_parser(value, input_format)\n                return self.enforce_timezone(parsed)\n\n        humanized_format = humanize_datetime.datetime_formats(input_formats)\n        self.fail('invalid', format=humanized_format)\n\n    def to_representation(self, value):\n        if not value:\n            return None\n\n        output_format = getattr(self, 'format', api_settings.DATETIME_FORMAT)\n\n        if output_format is None or isinstance(value, str):\n            return value\n\n        value = self.enforce_timezone(value)\n\n        if output_format.lower() == ISO_8601:\n            value = value.isoformat()\n            if value.endswith('+00:00'):\n                value = value[:-6] + 'Z'\n            return value\n        return value.strftime(output_format)\n\n\nclass DateField(Field):\n    default_error_messages = {\n        'invalid': _('Date has wrong format. Use one of these formats instead: {format}.'),\n        'datetime': _('Expected a date but got a datetime.'),\n    }\n    datetime_parser = datetime.datetime.strptime\n\n    def __init__(self, format=empty, input_formats=None, **kwargs):\n        if format is not empty:\n            self.format = format\n        if input_formats is not None:\n            self.input_formats = input_formats\n        super().__init__(**kwargs)\n\n    def to_internal_value(self, value):\n        input_formats = getattr(self, 'input_formats', api_settings.DATE_INPUT_FORMATS)\n\n        if isinstance(value, datetime.datetime):\n            self.fail('datetime')\n\n        if isinstance(value, datetime.date):\n            return value\n\n        for input_format in input_formats:\n            if input_format.lower() == ISO_8601:\n                try:\n                    parsed = parse_date(value)\n                except (ValueError, TypeError):\n                    pass\n                else:\n                    if parsed is not None:\n                        return parsed\n            else:\n                try:\n                    parsed = self.datetime_parser(value, input_format)\n                except (ValueError, TypeError):\n                    pass\n                else:\n                    return parsed.date()\n\n        humanized_format = humanize_datetime.date_formats(input_formats)\n        self.fail('invalid', format=humanized_format)\n\n    def to_representation(self, value):\n        if not value:\n            return None\n\n        output_format = getattr(self, 'format', api_settings.DATE_FORMAT)\n\n        if output_format is None or isinstance(value, str):\n            return value\n\n        # Applying a `DateField` to a datetime value is almost always\n        # not a sensible thing to do, as it means naively dropping\n        # any explicit or implicit timezone info.\n        assert not isinstance(value, datetime.datetime), (\n            'Expected a `date`, but got a `datetime`. Refusing to coerce, '\n            'as this may mean losing timezone information. Use a custom '\n            'read-only field and deal with timezone issues explicitly.'\n        )\n\n        if output_format.lower() == ISO_8601:\n            return value.isoformat()\n\n        return value.strftime(output_format)\n\n\nclass TimeField(Field):\n    default_error_messages = {\n        'invalid': _('Time has wrong format. Use one of these formats instead: {format}.'),\n    }\n    datetime_parser = datetime.datetime.strptime\n\n    def __init__(self, format=empty, input_formats=None, **kwargs):\n        if format is not empty:\n            self.format = format\n        if input_formats is not None:\n            self.input_formats = input_formats\n        super().__init__(**kwargs)\n\n    def to_internal_value(self, value):\n        input_formats = getattr(self, 'input_formats', api_settings.TIME_INPUT_FORMATS)\n\n        if isinstance(value, datetime.time):\n            return value\n\n        for input_format in input_formats:\n            if input_format.lower() == ISO_8601:\n                try:\n                    parsed = parse_time(value)\n                except (ValueError, TypeError):\n                    pass\n                else:\n                    if parsed is not None:\n                        return parsed\n            else:\n                try:\n                    parsed = self.datetime_parser(value, input_format)\n                except (ValueError, TypeError):\n                    pass\n                else:\n                    return parsed.time()\n\n        humanized_format = humanize_datetime.time_formats(input_formats)\n        self.fail('invalid', format=humanized_format)\n\n    def to_representation(self, value):\n        if value in (None, ''):\n            return None\n\n        output_format = getattr(self, 'format', api_settings.TIME_FORMAT)\n\n        if output_format is None or isinstance(value, str):\n            return value\n\n        # Applying a `TimeField` to a datetime value is almost always\n        # not a sensible thing to do, as it means naively dropping\n        # any explicit or implicit timezone info.\n        assert not isinstance(value, datetime.datetime), (\n            'Expected a `time`, but got a `datetime`. Refusing to coerce, '\n            'as this may mean losing timezone information. Use a custom '\n            'read-only field and deal with timezone issues explicitly.'\n        )\n\n        if output_format.lower() == ISO_8601:\n            return value.isoformat()\n        return value.strftime(output_format)\n\n\nclass DurationField(Field):\n    default_error_messages = {\n        'invalid': _('Duration has wrong format. Use one of these formats instead: {format}.'),\n        'max_value': _('Ensure this value is less than or equal to {max_value}.'),\n        'min_value': _('Ensure this value is greater than or equal to {min_value}.'),\n        'overflow': _('The number of days must be between {min_days} and {max_days}.'),\n    }\n\n    def __init__(self, *, format=empty, **kwargs):\n        self.max_value = kwargs.pop('max_value', None)\n        self.min_value = kwargs.pop('min_value', None)\n        if format is not empty:\n            if format is None or (isinstance(format, str) and format.lower() in (ISO_8601, DJANGO_DURATION_FORMAT)):\n                self.format = format\n            elif isinstance(format, str):\n                raise ValueError(\n                    f\"Unknown duration format provided, got '{format}'\"\n                    \" while expecting 'django', 'iso-8601' or `None`.\"\n                )\n            else:\n                raise TypeError(\n                    \"duration format must be either str or `None`,\"\n                    f\" not {type(format).__name__}\"\n                )\n        super().__init__(**kwargs)\n        if self.max_value is not None:\n            message = lazy_format(self.error_messages['max_value'], max_value=self.max_value)\n            self.validators.append(\n                MaxValueValidator(self.max_value, message=message))\n        if self.min_value is not None:\n            message = lazy_format(self.error_messages['min_value'], min_value=self.min_value)\n            self.validators.append(\n                MinValueValidator(self.min_value, message=message))\n\n    def to_internal_value(self, value):\n        if isinstance(value, datetime.timedelta):\n            return value\n        try:\n            parsed = parse_duration(str(value))\n        except OverflowError:\n            self.fail('overflow', min_days=datetime.timedelta.min.days, max_days=datetime.timedelta.max.days)\n        if parsed is not None:\n            return parsed\n        self.fail('invalid', format='[DD] [HH:[MM:]]ss[.uuuuuu]')\n\n    def to_representation(self, value):\n        output_format = getattr(self, 'format', api_settings.DURATION_FORMAT)\n\n        if output_format is None:\n            return value\n\n        if isinstance(output_format, str):\n            if output_format.lower() == ISO_8601:\n                return duration_iso_string(value)\n\n            if output_format.lower() == DJANGO_DURATION_FORMAT:\n                return duration_string(value)\n\n            raise ValueError(\n                f\"Unknown duration format provided, got '{output_format}'\"\n                \" while expecting 'django', 'iso-8601' or `None`.\"\n            )\n        raise TypeError(\n            \"duration format must be either str or `None`,\"\n            f\" not {type(output_format).__name__}\"\n        )\n\n\n# Choice types...\n\nclass ChoiceField(Field):\n    default_error_messages = {\n        'invalid_choice': _('\"{input}\" is not a valid choice.')\n    }\n    html_cutoff = None\n    html_cutoff_text = _('More than {count} items...')\n\n    def __init__(self, choices, **kwargs):\n        self.choices = choices\n        self.html_cutoff = kwargs.pop('html_cutoff', self.html_cutoff)\n        self.html_cutoff_text = kwargs.pop('html_cutoff_text', self.html_cutoff_text)\n\n        self.allow_blank = kwargs.pop('allow_blank', False)\n\n        super().__init__(**kwargs)\n\n    def to_internal_value(self, data):\n        if data == '' and self.allow_blank:\n            return ''\n        if isinstance(data, Enum) and str(data) != str(data.value):\n            data = data.value\n        try:\n            return self.choice_strings_to_values[str(data)]\n        except KeyError:\n            self.fail('invalid_choice', input=data)\n\n    def to_representation(self, value):\n        if value in ('', None):\n            return value\n        if isinstance(value, Enum) and str(value) != str(value.value):\n            value = value.value\n        return self.choice_strings_to_values.get(str(value), value)\n\n    def iter_options(self):\n        \"\"\"\n        Helper method for use with templates rendering select widgets.\n        \"\"\"\n        return iter_options(\n            self.grouped_choices,\n            cutoff=self.html_cutoff,\n            cutoff_text=self.html_cutoff_text\n        )\n\n    def _get_choices(self):\n        return self._choices\n\n    def _set_choices(self, choices):\n        self.grouped_choices = to_choices_dict(choices)\n        self._choices = flatten_choices_dict(self.grouped_choices)\n\n        # Map the string representation of choices to the underlying value.\n        # Allows us to deal with eg. integer choices while supporting either\n        # integer or string input, but still get the correct datatype out.\n        self.choice_strings_to_values = {\n            str(key.value) if isinstance(key, Enum) and str(key) != str(key.value) else str(key): key for key in self.choices\n        }\n\n    choices = property(_get_choices, _set_choices)\n\n\nclass MultipleChoiceField(ChoiceField):\n    default_error_messages = {\n        'invalid_choice': _('\"{input}\" is not a valid choice.'),\n        'not_a_list': _('Expected a list of items but got type \"{input_type}\".'),\n        'empty': _('This selection may not be empty.')\n    }\n    default_empty_html = []\n\n    def __init__(self, **kwargs):\n        self.allow_empty = kwargs.pop('allow_empty', True)\n        super().__init__(**kwargs)\n\n    def get_value(self, dictionary):\n        if self.field_name not in dictionary:\n            if getattr(self.root, 'partial', False):\n                return empty\n        # We override the default field access in order to support\n        # lists in HTML forms.\n        if html.is_html_input(dictionary):\n            return dictionary.getlist(self.field_name)\n        return dictionary.get(self.field_name, empty)\n\n    def to_internal_value(self, data):\n        if isinstance(data, str) or not hasattr(data, '__iter__'):\n            self.fail('not_a_list', input_type=type(data).__name__)\n        if not self.allow_empty and len(data) == 0:\n            self.fail('empty')\n\n        # Arguments for super() are needed because of scoping inside\n        # comprehensions.\n        return list(\n            dict.fromkeys(\n                super(MultipleChoiceField, self).to_internal_value(item)\n                for item in data\n            )\n        )\n\n    def to_representation(self, value):\n        return list(\n            dict.fromkeys(\n                self.choice_strings_to_values.get(str(item), item)\n                for item in value\n            )\n        )\n\n\nclass FilePathField(ChoiceField):\n    default_error_messages = {\n        'invalid_choice': _('\"{input}\" is not a valid path choice.')\n    }\n\n    def __init__(self, path, match=None, recursive=False, allow_files=True,\n                 allow_folders=False, required=None, **kwargs):\n        # Defer to Django's FilePathField implementation to get the\n        # valid set of choices.\n        field = DjangoFilePathField(\n            path, match=match, recursive=recursive, allow_files=allow_files,\n            allow_folders=allow_folders, required=required\n        )\n        kwargs['choices'] = field.choices\n        kwargs['required'] = required\n        super().__init__(**kwargs)\n\n\n# File types...\n\nclass FileField(Field):\n    default_error_messages = {\n        'required': _('No file was submitted.'),\n        'invalid': _('The submitted data was not a file. Check the encoding type on the form.'),\n        'no_name': _('No filename could be determined.'),\n        'empty': _('The submitted file is empty.'),\n        'max_length': _('Ensure this filename has at most {max_length} characters (it has {length}).'),\n    }\n\n    def __init__(self, **kwargs):\n        self.max_length = kwargs.pop('max_length', None)\n        self.allow_empty_file = kwargs.pop('allow_empty_file', False)\n        if 'use_url' in kwargs:\n            self.use_url = kwargs.pop('use_url')\n        super().__init__(**kwargs)\n\n    def to_internal_value(self, data):\n        try:\n            # `UploadedFile` objects should have name and size attributes.\n            file_name = data.name\n            file_size = data.size\n        except AttributeError:\n            self.fail('invalid')\n\n        if not file_name:\n            self.fail('no_name')\n        if not self.allow_empty_file and not file_size:\n            self.fail('empty')\n        if self.max_length and len(file_name) > self.max_length:\n            self.fail('max_length', max_length=self.max_length, length=len(file_name))\n\n        return data\n\n    def to_representation(self, value):\n        if not value:\n            return None\n\n        use_url = getattr(self, 'use_url', api_settings.UPLOADED_FILES_USE_URL)\n        if use_url:\n            try:\n                url = value.url\n            except AttributeError:\n                return None\n            request = self.context.get('request', None)\n            if request is not None:\n                return request.build_absolute_uri(url)\n            return url\n\n        return value.name\n\n\nclass ImageField(FileField):\n    default_error_messages = {\n        'invalid_image': _(\n            'Upload a valid image. The file you uploaded was either not an image or a corrupted image.'\n        ),\n    }\n\n    def __init__(self, **kwargs):\n        self._DjangoImageField = kwargs.pop('_DjangoImageField', DjangoImageField)\n        super().__init__(**kwargs)\n\n    def to_internal_value(self, data):\n        # Image validation is a bit grungy, so we'll just outright\n        # defer to Django's implementation so we don't need to\n        # consider it, or treat PIL as a test dependency.\n        file_object = super().to_internal_value(data)\n        django_field = self._DjangoImageField()\n        django_field.error_messages = self.error_messages\n        return django_field.clean(file_object)\n\n\n# Composite field types...\n\nclass _UnvalidatedField(Field):\n    def __init__(self, **kwargs):\n        super().__init__(**kwargs)\n        self.allow_blank = True\n        self.allow_null = True\n\n    def to_internal_value(self, data):\n        return data\n\n    def to_representation(self, value):\n        return value\n\n\nclass ListField(Field):\n    child = _UnvalidatedField()\n    initial = []\n    default_error_messages = {\n        'not_a_list': _('Expected a list of items but got type \"{input_type}\".'),\n        'empty': _('This list may not be empty.'),\n        'min_length': _('Ensure this field has at least {min_length} elements.'),\n        'max_length': _('Ensure this field has no more than {max_length} elements.')\n    }\n\n    def __init__(self, **kwargs):\n        self.child = kwargs.pop('child', copy.deepcopy(self.child))\n        self.allow_empty = kwargs.pop('allow_empty', True)\n        self.max_length = kwargs.pop('max_length', None)\n        self.min_length = kwargs.pop('min_length', None)\n\n        assert not inspect.isclass(self.child), '`child` has not been instantiated.'\n        assert self.child.source is None, (\n            \"The `source` argument is not meaningful when applied to a `child=` field. \"\n            \"Remove `source=` from the field declaration.\"\n        )\n\n        super().__init__(**kwargs)\n        self.child.bind(field_name='', parent=self)\n        if self.max_length is not None:\n            message = lazy_format(self.error_messages['max_length'], max_length=self.max_length)\n            self.validators.append(MaxLengthValidator(self.max_length, message=message))\n        if self.min_length is not None:\n            message = lazy_format(self.error_messages['min_length'], min_length=self.min_length)\n            self.validators.append(MinLengthValidator(self.min_length, message=message))\n\n    def get_value(self, dictionary):\n        if self.field_name not in dictionary:\n            if getattr(self.root, 'partial', False):\n                return empty\n        # We override the default field access in order to support\n        # lists in HTML forms.\n        if html.is_html_input(dictionary):\n            val = dictionary.getlist(self.field_name, [])\n            if len(val) > 0:\n                # Support QueryDict lists in HTML input.\n                return val\n            return html.parse_html_list(dictionary, prefix=self.field_name, default=empty)\n\n        return dictionary.get(self.field_name, empty)\n\n    def to_internal_value(self, data):\n        \"\"\"\n        List of dicts of native values <- List of dicts of primitive datatypes.\n        \"\"\"\n        if html.is_html_input(data):\n            data = html.parse_html_list(data, default=[])\n        if isinstance(data, (str, Mapping)) or not hasattr(data, '__iter__'):\n            self.fail('not_a_list', input_type=type(data).__name__)\n        if not self.allow_empty and len(data) == 0:\n            self.fail('empty')\n        return self.run_child_validation(data)\n\n    def to_representation(self, data):\n        \"\"\"\n        List of object instances -> List of dicts of primitive datatypes.\n        \"\"\"\n        return [self.child.to_representation(item) if item is not None else None for item in data]\n\n    def run_child_validation(self, data):\n        result = []\n        errors = {}\n\n        for idx, item in enumerate(data):\n            try:\n                result.append(self.child.run_validation(item))\n            except ValidationError as e:\n                errors[idx] = e.detail\n            except DjangoValidationError as e:\n                errors[idx] = get_error_detail(e)\n\n        if not errors:\n            return result\n        raise ValidationError(errors)\n\n\nclass DictField(Field):\n    child = _UnvalidatedField()\n    initial = {}\n    default_error_messages = {\n        'not_a_dict': _('Expected a dictionary of items but got type \"{input_type}\".'),\n        'empty': _('This dictionary may not be empty.'),\n    }\n\n    def __init__(self, **kwargs):\n        self.child = kwargs.pop('child', copy.deepcopy(self.child))\n        self.allow_empty = kwargs.pop('allow_empty', True)\n\n        assert not inspect.isclass(self.child), '`child` has not been instantiated.'\n        assert self.child.source is None, (\n            \"The `source` argument is not meaningful when applied to a `child=` field. \"\n            \"Remove `source=` from the field declaration.\"\n        )\n\n        super().__init__(**kwargs)\n        self.child.bind(field_name='', parent=self)\n\n    def get_value(self, dictionary):\n        # We override the default field access in order to support\n        # dictionaries in HTML forms.\n        if html.is_html_input(dictionary):\n            return html.parse_html_dict(dictionary, prefix=self.field_name)\n        return dictionary.get(self.field_name, empty)\n\n    def to_internal_value(self, data):\n        \"\"\"\n        Dicts of native values <- Dicts of primitive datatypes.\n        \"\"\"\n        if html.is_html_input(data):\n            data = html.parse_html_dict(data)\n        if not isinstance(data, dict):\n            self.fail('not_a_dict', input_type=type(data).__name__)\n        if not self.allow_empty and len(data) == 0:\n            self.fail('empty')\n\n        return self.run_child_validation(data)\n\n    def to_representation(self, value):\n        return {\n            str(key): self.child.to_representation(val) if val is not None else None\n            for key, val in value.items()\n        }\n\n    def run_child_validation(self, data):\n        result = {}\n        errors = {}\n\n        for key, value in data.items():\n            key = str(key)\n\n            try:\n                result[key] = self.child.run_validation(value)\n            except ValidationError as e:\n                errors[key] = e.detail\n\n        if not errors:\n            return result\n        raise ValidationError(errors)\n\n\nclass HStoreField(DictField):\n    child = CharField(allow_blank=True, allow_null=True)\n\n    def __init__(self, **kwargs):\n        super().__init__(**kwargs)\n        assert isinstance(self.child, CharField), (\n            \"The `child` argument must be an instance of `CharField`, \"\n            \"as the hstore extension stores values as strings.\"\n        )\n\n\nclass JSONField(Field):\n    default_error_messages = {\n        'invalid': _('Value must be valid JSON.')\n    }\n\n    # Workaround for isinstance calls when importing the field isn't possible\n    _is_jsonfield = True\n\n    def __init__(self, **kwargs):\n        self.binary = kwargs.pop('binary', False)\n        self.encoder = kwargs.pop('encoder', None)\n        self.decoder = kwargs.pop('decoder', None)\n        super().__init__(**kwargs)\n\n    def get_value(self, dictionary):\n        if html.is_html_input(dictionary) and self.field_name in dictionary:\n            # When HTML form input is used, mark up the input\n            # as being a JSON string, rather than a JSON primitive.\n            class JSONString(str):\n                def __new__(cls, value):\n                    ret = str.__new__(cls, value)\n                    ret.is_json_string = True\n                    return ret\n            return JSONString(dictionary[self.field_name])\n        return dictionary.get(self.field_name, empty)\n\n    def to_internal_value(self, data):\n        try:\n            if self.binary or getattr(data, 'is_json_string', False):\n                if isinstance(data, bytes):\n                    data = data.decode()\n                return json.loads(data, cls=self.decoder)\n            else:\n                json.dumps(data, cls=self.encoder)\n        except (TypeError, ValueError):\n            self.fail('invalid')\n        return data\n\n    def to_representation(self, value):\n        if self.binary:\n            value = json.dumps(value, cls=self.encoder)\n            value = value.encode()\n        return value\n\n\n# Miscellaneous field types...\n\nclass ReadOnlyField(Field):\n    \"\"\"\n    A read-only field that simply returns the field value.\n\n    If the field is a method with no parameters, the method will be called\n    and its return value used as the representation.\n\n    For example, the following would call `get_expiry_date()` on the object:\n\n    class ExampleSerializer(Serializer):\n        expiry_date = ReadOnlyField(source='get_expiry_date')\n    \"\"\"\n\n    def __init__(self, **kwargs):\n        kwargs['read_only'] = True\n        super().__init__(**kwargs)\n\n    def to_representation(self, value):\n        return value\n\n\nclass HiddenField(Field):\n    \"\"\"\n    A hidden field does not take input from the user, or present any output,\n    but it does populate a field in `validated_data`, based on its default\n    value. This is particularly useful when we have a `unique_for_date`\n    constraint on a pair of fields, as we need some way to include the date in\n    the validated data.\n    \"\"\"\n\n    def __init__(self, **kwargs):\n        assert 'default' in kwargs, 'default is a required argument.'\n        kwargs['write_only'] = True\n        super().__init__(**kwargs)\n\n    def get_value(self, dictionary):\n        # We always use the default value for `HiddenField`.\n        # User input is never provided or accepted.\n        return empty\n\n    def to_internal_value(self, data):\n        return data\n\n\nclass SerializerMethodField(Field):\n    \"\"\"\n    A read-only field that get its representation from calling a method on the\n    parent serializer class. The method called will be of the form\n    \"get_{field_name}\", and should take a single argument, which is the\n    object being serialized.\n\n    For example:\n\n    class ExampleSerializer(Serializer):\n        extra_info = SerializerMethodField()\n\n        def get_extra_info(self, obj):\n            return ...  # Calculate some data to return.\n    \"\"\"\n\n    def __init__(self, method_name=None, **kwargs):\n        self.method_name = method_name\n        kwargs['source'] = '*'\n        kwargs['read_only'] = True\n        super().__init__(**kwargs)\n\n    def bind(self, field_name, parent):\n        # The method name defaults to `get_{field_name}`.\n        if self.method_name is None:\n            self.method_name = f'get_{field_name}'\n\n        super().bind(field_name, parent)\n\n    def to_representation(self, value):\n        method = getattr(self.parent, self.method_name)\n        return method(value)\n\n\nclass ModelField(Field):\n    \"\"\"\n    A generic field that can be used against an arbitrary model field.\n\n    This is used by `ModelSerializer` when dealing with custom model fields,\n    that do not have a serializer field to be mapped to.\n    \"\"\"\n    default_error_messages = {\n        'max_length': _('Ensure this field has no more than {max_length} characters.'),\n    }\n\n    def __init__(self, model_field, **kwargs):\n        self.model_field = model_field\n        # The `max_length` option is supported by Django's base `Field` class,\n        # so we'd better support it here.\n        self.max_length = kwargs.pop('max_length', None)\n        super().__init__(**kwargs)\n        if self.max_length is not None:\n            message = lazy_format(self.error_messages['max_length'], max_length=self.max_length)\n            self.validators.append(\n                MaxLengthValidator(self.max_length, message=message))\n\n    def to_internal_value(self, data):\n        rel = self.model_field.remote_field\n        if rel is not None:\n            return rel.model._meta.get_field(rel.field_name).to_python(data)\n        return self.model_field.to_python(data)\n\n    def get_attribute(self, obj):\n        # We pass the object instance onto `to_representation`,\n        # not just the field attribute.\n        return obj\n\n    def to_representation(self, obj):\n        value = self.model_field.value_from_object(obj)\n        if is_protected_type(value):\n            return value\n        return self.model_field.value_to_string(obj)\n"
  },
  {
    "path": "rest_framework/filters.py",
    "content": "\"\"\"\nProvides generic filtering backends that can be used to filter the results\nreturned by list views.\n\"\"\"\nimport operator\nfrom functools import reduce\n\nfrom django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured\nfrom django.db import models\nfrom django.db.models.constants import LOOKUP_SEP\nfrom django.template import loader\nfrom django.utils.encoding import force_str\nfrom django.utils.text import smart_split, unescape_string_literal\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework.fields import CharField\nfrom rest_framework.settings import api_settings\n\n\ndef search_smart_split(search_terms):\n    \"\"\"Returns sanitized search terms as a list.\"\"\"\n    split_terms = []\n    for term in smart_split(search_terms):\n        # trim commas to avoid bad matching for quoted phrases\n        term = term.strip(',')\n        if term.startswith(('\"', \"'\")) and term[0] == term[-1]:\n            # quoted phrases are kept together without any other split\n            split_terms.append(unescape_string_literal(term))\n        else:\n            # non-quoted tokens are split by comma, keeping only non-empty ones\n            for sub_term in term.split(','):\n                if sub_term:\n                    split_terms.append(sub_term.strip())\n    return split_terms\n\n\nclass BaseFilterBackend:\n    \"\"\"\n    A base class from which all filter backend classes should inherit.\n    \"\"\"\n\n    def filter_queryset(self, request, queryset, view):\n        \"\"\"\n        Return a filtered queryset.\n        \"\"\"\n        raise NotImplementedError(\".filter_queryset() must be overridden.\")\n\n    def get_schema_operation_parameters(self, view):\n        return []\n\n\nclass SearchFilter(BaseFilterBackend):\n    # The URL query parameter used for the search.\n    search_param = api_settings.SEARCH_PARAM\n    template = 'rest_framework/filters/search.html'\n    lookup_prefixes = {\n        '^': 'istartswith',\n        '=': 'iexact',\n        '@': 'search',\n        '$': 'iregex',\n    }\n    search_title = _('Search')\n    search_description = _('A search term.')\n\n    def get_search_fields(self, view, request):\n        \"\"\"\n        Search fields are obtained from the view, but the request is always\n        passed to this method. Sub-classes can override this method to\n        dynamically change the search fields based on request content.\n        \"\"\"\n        return getattr(view, 'search_fields', None)\n\n    def get_search_terms(self, request):\n        \"\"\"\n        Search terms are set by a ?search=... query parameter,\n        and may be whitespace delimited.\n        \"\"\"\n        value = request.query_params.get(self.search_param, '')\n        field = CharField(trim_whitespace=False, allow_blank=True)\n        cleaned_value = field.run_validation(value)\n        return search_smart_split(cleaned_value)\n\n    def construct_search(self, field_name, queryset):\n        lookup = self.lookup_prefixes.get(field_name[0])\n        if lookup:\n            field_name = field_name[1:]\n        else:\n            # Use field_name if it includes a lookup.\n            opts = queryset.model._meta\n            lookup_fields = field_name.split(LOOKUP_SEP)\n            # Go through the fields, following all relations.\n            prev_field = None\n            for path_part in lookup_fields:\n                if path_part == \"pk\":\n                    path_part = opts.pk.name\n                try:\n                    field = opts.get_field(path_part)\n                except FieldDoesNotExist:\n                    # Use valid query lookups.\n                    if prev_field and prev_field.get_lookup(path_part):\n                        return field_name\n                else:\n                    prev_field = field\n                    if hasattr(field, \"path_infos\"):\n                        # Update opts to follow the relation.\n                        opts = field.path_infos[-1].to_opts\n            # Otherwise, use the field with icontains.\n            lookup = 'icontains'\n        return LOOKUP_SEP.join([field_name, lookup])\n\n    def must_call_distinct(self, queryset, search_fields):\n        \"\"\"\n        Return True if 'distinct()' should be used to query the given lookups.\n        \"\"\"\n        for search_field in search_fields:\n            opts = queryset.model._meta\n            if search_field[0] in self.lookup_prefixes:\n                search_field = search_field[1:]\n            # Annotated fields do not need to be distinct\n            if isinstance(queryset, models.QuerySet) and search_field in queryset.query.annotations:\n                continue\n            parts = search_field.split(LOOKUP_SEP)\n            for part in parts:\n                field = opts.get_field(part)\n                if hasattr(field, 'get_path_info'):\n                    # This field is a relation, update opts to follow the relation\n                    path_info = field.get_path_info()\n                    opts = path_info[-1].to_opts\n                    if any(path.m2m for path in path_info):\n                        # This field is a m2m relation so we know we need to call distinct\n                        return True\n                else:\n                    # This field has a custom __ query transform but is not a relational field.\n                    break\n        return False\n\n    def filter_queryset(self, request, queryset, view):\n        search_fields = self.get_search_fields(view, request)\n        search_terms = self.get_search_terms(request)\n\n        if not search_fields or not search_terms:\n            return queryset\n\n        orm_lookups = [\n            self.construct_search(str(search_field), queryset)\n            for search_field in search_fields\n        ]\n\n        base = queryset\n        # generator which for each term builds the corresponding search\n        conditions = (\n            reduce(\n                operator.or_,\n                (models.Q(**{orm_lookup: term}) for orm_lookup in orm_lookups)\n            ) for term in search_terms\n        )\n        queryset = queryset.filter(reduce(operator.and_, conditions))\n\n        # Remove duplicates from results, if necessary\n        if self.must_call_distinct(queryset, search_fields):\n            # inspired by django.contrib.admin\n            # this is more accurate than .distinct form M2M relationship\n            # also is cross-database\n            queryset = queryset.filter(pk=models.OuterRef('pk'))\n            queryset = base.filter(models.Exists(queryset))\n        return queryset\n\n    def to_html(self, request, queryset, view):\n        if not getattr(view, 'search_fields', None):\n            return ''\n\n        context = {\n            'param': self.search_param,\n            'term': request.query_params.get(self.search_param, ''),\n        }\n        template = loader.get_template(self.template)\n        return template.render(context)\n\n    def get_schema_operation_parameters(self, view):\n        return [\n            {\n                'name': self.search_param,\n                'required': False,\n                'in': 'query',\n                'description': force_str(self.search_description),\n                'schema': {\n                    'type': 'string',\n                },\n            },\n        ]\n\n\nclass OrderingFilter(BaseFilterBackend):\n    # The URL query parameter used for the ordering.\n    ordering_param = api_settings.ORDERING_PARAM\n    ordering_fields = None\n    ordering_title = _('Ordering')\n    ordering_description = _('Which field to use when ordering the results.')\n    template = 'rest_framework/filters/ordering.html'\n\n    def get_ordering(self, request, queryset, view):\n        \"\"\"\n        Ordering is set by a comma delimited ?ordering=... query parameter.\n\n        The `ordering` query parameter can be overridden by setting\n        the `ordering_param` value on the OrderingFilter or by\n        specifying an `ORDERING_PARAM` value in the API settings.\n        \"\"\"\n        params = request.query_params.get(self.ordering_param)\n        if params:\n            fields = [param.strip() for param in params.split(',')]\n            ordering = self.remove_invalid_fields(queryset, fields, view, request)\n            if ordering:\n                return ordering\n\n        # No ordering was included, or all the ordering fields were invalid\n        return self.get_default_ordering(view)\n\n    def get_default_ordering(self, view):\n        ordering = getattr(view, 'ordering', None)\n        if isinstance(ordering, str):\n            return (ordering,)\n        return ordering\n\n    def get_default_valid_fields(self, queryset, view, context=None):\n        if context is None:\n            context = {}\n        # If `ordering_fields` is not specified, then we determine a default\n        # based on the serializer class, if one exists on the view.\n        if hasattr(view, 'get_serializer_class'):\n            try:\n                serializer_class = view.get_serializer_class()\n            except AssertionError:\n                # Raised by the default implementation if\n                # no serializer_class was found\n                serializer_class = None\n        else:\n            serializer_class = getattr(view, 'serializer_class', None)\n\n        if serializer_class is None:\n            msg = (\n                \"Cannot use %s on a view which does not have either a \"\n                \"'serializer_class', an overriding 'get_serializer_class' \"\n                \"or 'ordering_fields' attribute.\"\n            )\n            raise ImproperlyConfigured(msg % self.__class__.__name__)\n\n        model_class = queryset.model\n        model_property_names = [\n            # 'pk' is a property added in Django's Model class, however it is valid for ordering.\n            attr for attr in dir(model_class) if isinstance(getattr(model_class, attr), property) and attr != 'pk'\n        ]\n\n        return [\n            (field.source.replace('.', '__') or field_name, field.label)\n            for field_name, field in serializer_class(context=context).fields.items()\n            if (\n                not getattr(field, 'write_only', False) and\n                not field.source == '*' and\n                field.source not in model_property_names\n            )\n        ]\n\n    def get_valid_fields(self, queryset, view, context=None):\n        if context is None:\n            context = {}\n        valid_fields = getattr(view, 'ordering_fields', self.ordering_fields)\n\n        if valid_fields is None:\n            # Default to allowing filtering on serializer fields\n            return self.get_default_valid_fields(queryset, view, context)\n\n        elif valid_fields == '__all__':\n            # View explicitly allows filtering on any model field\n            valid_fields = [\n                (field.name, field.verbose_name) for field in queryset.model._meta.fields\n            ]\n            valid_fields += [\n                (key, key.title().split('__'))\n                for key in queryset.query.annotations\n            ]\n        else:\n            valid_fields = [\n                (item, item) if isinstance(item, str) else item\n                for item in valid_fields\n            ]\n\n        return valid_fields\n\n    def remove_invalid_fields(self, queryset, fields, view, request):\n        valid_fields = [item[0] for item in self.get_valid_fields(queryset, view, {'request': request})]\n\n        def term_valid(term):\n            if term.startswith(\"-\"):\n                term = term[1:]\n            return term in valid_fields\n\n        return [term for term in fields if term_valid(term)]\n\n    def filter_queryset(self, request, queryset, view):\n        ordering = self.get_ordering(request, queryset, view)\n\n        if ordering:\n            return queryset.order_by(*ordering)\n\n        return queryset\n\n    def get_template_context(self, request, queryset, view):\n        current = self.get_ordering(request, queryset, view)\n        current = None if not current else current[0]\n        options = []\n        context = {\n            'request': request,\n            'current': current,\n            'param': self.ordering_param,\n        }\n        for key, label in self.get_valid_fields(queryset, view, context):\n            options.append((key, '%s - %s' % (label, _('ascending'))))\n            options.append(('-' + key, '%s - %s' % (label, _('descending'))))\n        context['options'] = options\n        return context\n\n    def to_html(self, request, queryset, view):\n        template = loader.get_template(self.template)\n        context = self.get_template_context(request, queryset, view)\n        return template.render(context)\n\n    def get_schema_operation_parameters(self, view):\n        return [\n            {\n                'name': self.ordering_param,\n                'required': False,\n                'in': 'query',\n                'description': force_str(self.ordering_description),\n                'schema': {\n                    'type': 'string',\n                },\n            },\n        ]\n"
  },
  {
    "path": "rest_framework/generics.py",
    "content": "\"\"\"\nGeneric views that provide commonly needed behavior.\n\"\"\"\nfrom django.core.exceptions import ValidationError\nfrom django.db.models.query import QuerySet\nfrom django.http import Http404\nfrom django.shortcuts import get_object_or_404 as _get_object_or_404\n\nfrom rest_framework import mixins, views\nfrom rest_framework.settings import api_settings\n\n\ndef get_object_or_404(queryset, *filter_args, **filter_kwargs):\n    \"\"\"\n    Same as Django's standard shortcut, but make sure to also raise 404\n    if the filter_kwargs don't match the required types.\n    \"\"\"\n    try:\n        return _get_object_or_404(queryset, *filter_args, **filter_kwargs)\n    except (TypeError, ValueError, ValidationError):\n        raise Http404\n\n\nclass GenericAPIView(views.APIView):\n    \"\"\"\n    Base class for all other generic views.\n    \"\"\"\n    # You'll need to either set these attributes,\n    # or override `get_queryset()`/`get_serializer_class()`.\n    # If you are overriding a view method, it is important that you call\n    # `get_queryset()` instead of accessing the `queryset` property directly,\n    # as `queryset` will get evaluated only once, and those results are cached\n    # for all subsequent requests.\n    queryset = None\n    serializer_class = None\n\n    # If you want to use object lookups other than pk, set 'lookup_field'.\n    # For more complex lookup requirements override `get_object()`.\n    lookup_field = 'pk'\n    lookup_url_kwarg = None\n\n    # The filter backend classes to use for queryset filtering\n    filter_backends = api_settings.DEFAULT_FILTER_BACKENDS\n\n    # The style to use for queryset pagination.\n    pagination_class = api_settings.DEFAULT_PAGINATION_CLASS\n\n    # Allow generic typing checking for generic views.\n    def __class_getitem__(cls, *args, **kwargs):\n        return cls\n\n    def get_queryset(self):\n        \"\"\"\n        Get the list of items for this view.\n        This must be an iterable, and may be a queryset.\n        Defaults to using `self.queryset`.\n\n        This method should always be used rather than accessing `self.queryset`\n        directly, as `self.queryset` gets evaluated only once, and those results\n        are cached for all subsequent requests.\n\n        You may want to override this if you need to provide different\n        querysets depending on the incoming request.\n\n        (Eg. return a list of items that is specific to the user)\n        \"\"\"\n        assert self.queryset is not None, (\n            \"'%s' should either include a `queryset` attribute, \"\n            \"or override the `get_queryset()` method.\"\n            % self.__class__.__name__\n        )\n\n        queryset = self.queryset\n        if isinstance(queryset, QuerySet):\n            # Ensure queryset is re-evaluated on each request.\n            queryset = queryset.all()\n        return queryset\n\n    def get_object(self):\n        \"\"\"\n        Returns the object the view is displaying.\n\n        You may want to override this if you need to provide non-standard\n        queryset lookups.  Eg if objects are referenced using multiple\n        keyword arguments in the url conf.\n        \"\"\"\n        queryset = self.filter_queryset(self.get_queryset())\n\n        # Perform the lookup filtering.\n        lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field\n\n        assert lookup_url_kwarg in self.kwargs, (\n            'Expected view %s to be called with a URL keyword argument '\n            'named \"%s\". Fix your URL conf, or set the `.lookup_field` '\n            'attribute on the view correctly.' %\n            (self.__class__.__name__, lookup_url_kwarg)\n        )\n\n        filter_kwargs = {self.lookup_field: self.kwargs[lookup_url_kwarg]}\n        obj = get_object_or_404(queryset, **filter_kwargs)\n\n        # May raise a permission denied\n        self.check_object_permissions(self.request, obj)\n\n        return obj\n\n    def get_serializer(self, *args, **kwargs):\n        \"\"\"\n        Return the serializer instance that should be used for validating and\n        deserializing input, and for serializing output.\n        \"\"\"\n        serializer_class = self.get_serializer_class()\n        kwargs.setdefault('context', self.get_serializer_context())\n        return serializer_class(*args, **kwargs)\n\n    def get_serializer_class(self):\n        \"\"\"\n        Return the class to use for the serializer.\n        Defaults to using `self.serializer_class`.\n\n        You may want to override this if you need to provide different\n        serializations depending on the incoming request.\n\n        (Eg. admins get full serialization, others get basic serialization)\n        \"\"\"\n        assert self.serializer_class is not None, (\n            \"'%s' should either include a `serializer_class` attribute, \"\n            \"or override the `get_serializer_class()` method.\"\n            % self.__class__.__name__\n        )\n\n        return self.serializer_class\n\n    def get_serializer_context(self):\n        \"\"\"\n        Extra context provided to the serializer class.\n        \"\"\"\n        return {\n            'request': self.request,\n            'format': self.format_kwarg,\n            'view': self\n        }\n\n    def filter_queryset(self, queryset):\n        \"\"\"\n        Given a queryset, filter it with whichever filter backend is in use.\n\n        You are unlikely to want to override this method, although you may need\n        to call it either from a list view, or from a custom `get_object`\n        method if you want to apply the configured filtering backend to the\n        default queryset.\n        \"\"\"\n        for backend in list(self.filter_backends):\n            queryset = backend().filter_queryset(self.request, queryset, self)\n        return queryset\n\n    @property\n    def paginator(self):\n        \"\"\"\n        The paginator instance associated with the view, or `None`.\n        \"\"\"\n        if not hasattr(self, '_paginator'):\n            if self.pagination_class is None:\n                self._paginator = None\n            else:\n                self._paginator = self.pagination_class()\n        return self._paginator\n\n    def paginate_queryset(self, queryset):\n        \"\"\"\n        Return a single page of results, or `None` if pagination is disabled.\n        \"\"\"\n        if self.paginator is None:\n            return None\n        return self.paginator.paginate_queryset(queryset, self.request, view=self)\n\n    def get_paginated_response(self, data):\n        \"\"\"\n        Return a paginated style `Response` object for the given output data.\n        \"\"\"\n        assert self.paginator is not None\n        return self.paginator.get_paginated_response(data)\n\n\n# Concrete view classes that provide method handlers\n# by composing the mixin classes with the base view.\n\nclass CreateAPIView(mixins.CreateModelMixin,\n                    GenericAPIView):\n    \"\"\"\n    Concrete view for creating a model instance.\n    \"\"\"\n    def post(self, request, *args, **kwargs):\n        return self.create(request, *args, **kwargs)\n\n\nclass ListAPIView(mixins.ListModelMixin,\n                  GenericAPIView):\n    \"\"\"\n    Concrete view for listing a queryset.\n    \"\"\"\n    def get(self, request, *args, **kwargs):\n        return self.list(request, *args, **kwargs)\n\n\nclass RetrieveAPIView(mixins.RetrieveModelMixin,\n                      GenericAPIView):\n    \"\"\"\n    Concrete view for retrieving a model instance.\n    \"\"\"\n    def get(self, request, *args, **kwargs):\n        return self.retrieve(request, *args, **kwargs)\n\n\nclass DestroyAPIView(mixins.DestroyModelMixin,\n                     GenericAPIView):\n    \"\"\"\n    Concrete view for deleting a model instance.\n    \"\"\"\n    def delete(self, request, *args, **kwargs):\n        return self.destroy(request, *args, **kwargs)\n\n\nclass UpdateAPIView(mixins.UpdateModelMixin,\n                    GenericAPIView):\n    \"\"\"\n    Concrete view for updating a model instance.\n    \"\"\"\n    def put(self, request, *args, **kwargs):\n        return self.update(request, *args, **kwargs)\n\n    def patch(self, request, *args, **kwargs):\n        return self.partial_update(request, *args, **kwargs)\n\n\nclass ListCreateAPIView(mixins.ListModelMixin,\n                        mixins.CreateModelMixin,\n                        GenericAPIView):\n    \"\"\"\n    Concrete view for listing a queryset or creating a model instance.\n    \"\"\"\n    def get(self, request, *args, **kwargs):\n        return self.list(request, *args, **kwargs)\n\n    def post(self, request, *args, **kwargs):\n        return self.create(request, *args, **kwargs)\n\n\nclass RetrieveUpdateAPIView(mixins.RetrieveModelMixin,\n                            mixins.UpdateModelMixin,\n                            GenericAPIView):\n    \"\"\"\n    Concrete view for retrieving, updating a model instance.\n    \"\"\"\n    def get(self, request, *args, **kwargs):\n        return self.retrieve(request, *args, **kwargs)\n\n    def put(self, request, *args, **kwargs):\n        return self.update(request, *args, **kwargs)\n\n    def patch(self, request, *args, **kwargs):\n        return self.partial_update(request, *args, **kwargs)\n\n\nclass RetrieveDestroyAPIView(mixins.RetrieveModelMixin,\n                             mixins.DestroyModelMixin,\n                             GenericAPIView):\n    \"\"\"\n    Concrete view for retrieving or deleting a model instance.\n    \"\"\"\n    def get(self, request, *args, **kwargs):\n        return self.retrieve(request, *args, **kwargs)\n\n    def delete(self, request, *args, **kwargs):\n        return self.destroy(request, *args, **kwargs)\n\n\nclass RetrieveUpdateDestroyAPIView(mixins.RetrieveModelMixin,\n                                   mixins.UpdateModelMixin,\n                                   mixins.DestroyModelMixin,\n                                   GenericAPIView):\n    \"\"\"\n    Concrete view for retrieving, updating or deleting a model instance.\n    \"\"\"\n    def get(self, request, *args, **kwargs):\n        return self.retrieve(request, *args, **kwargs)\n\n    def put(self, request, *args, **kwargs):\n        return self.update(request, *args, **kwargs)\n\n    def patch(self, request, *args, **kwargs):\n        return self.partial_update(request, *args, **kwargs)\n\n    def delete(self, request, *args, **kwargs):\n        return self.destroy(request, *args, **kwargs)\n"
  },
  {
    "path": "rest_framework/locale/ach/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Acoli (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ach/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: ach\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/ar/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Andrew Ayoub <andrew.ayoub@connectads.com>, 2017\n# aymen chaieb <chaieb.aymen1992@gmail.com>, 2017\n# Bashar Al-Abdulhadi, 2016-2017\n# Eyad Toma <d.eyad.t@gmail.com>, 2015,2017\n# zak zak <zakaria.bendifallah@gmail.com>, 2020\n# Salman Saeed Albukhaitan <ssyb2014@gmail.com>, 2024\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Arabic (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ar/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: ar\\n\"\n\"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"ترويسة أساسية غير صالحة. لم تقدم أي بيانات تفويض.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"ترويسة أساسية غير صالحة. يجب أن لا تحتوي سلسلة بيانات التفويض على مسافات.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"ترويسة أساسية غير صالحة. بيانات التفويض لم تُشفر بشكل صحيح بنظام أساس64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"اسم المستخدم/كلمة المرور غير صحيحة.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"المستخدم غير مفعل او تم حذفه.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"رمز الراْس المميّز غير صالح, لم تقدم أي بيانات.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"رمز الراْس المميّز غير صالح, سلسلة الرمز المميّز لا يجب أن تحتوي على أي أحرف مسافات.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"رمز الراْس المميّز غير صالح, سلسلة الرمز المميّز لا يجب أن تحتوي على أي أحرف غير صالحة.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"رمز غير صحيح.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"رمز التفويض\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"المفتاح\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"المستخدم\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"أنشئ\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"الرمز\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"الرموز\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"اسم المستخدم\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"كلمة المرور\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"تعذر تسجيل الدخول بالبيانات المدخلة.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"يجب أن تتضمن \\\"اسم المستخدم\\\" و \\\"كلمة المرور\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"حدث خطأ في الخادم.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"مدخل غير صالح.\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"الطلب صيغ بشكل سيء.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"بيانات الدخول غير صحيحة.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"لم يتم تزويد بيانات الدخول.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"ليس لديك صلاحية للقيام بهذا الإجراء.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"غير موجود.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"طريقة \\\"{method}\\\" غير مسموح بها.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"تعذر تلبية ترويسة Accept في الطلب.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"الوسيط \\\"{media_type}\\\" الموجود في الطلب غير معتمد.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"تم حد الطلب.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"متوقع التوفر خلال {wait} ثانية.\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"متوقع التوفر خلال {wait} ثواني.\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"هذا الحقل مطلوب.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"لا يمكن لهذا الحقل ان يكون فارغاً null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"يجب أن يكون قيمة منطقية صالحة.\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"ليس نصاً صالحاً.\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"لا يمكن لهذا الحقل ان يكون فارغاً.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"تأكد ان عدد الحروف في هذا الحقل لا تتجاوز {max_length}.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"تأكد ان عدد الحروف في هذا الحقل لا يقل عن {min_length}.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"يرجى إدخال عنوان بريد إلكتروني صحيح.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"هذه القيمة لا تطابق النمط المطلوب.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"أدخل \\\"slug\\\" صالح يحتوي على حروف، أرقام، شُرط سفلية أو واصلات.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"أدخل \\\"slug\\\" صالح يحتوي على حروف يونيكود، أرقام، شُرط سفلية أو واصلات.\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"الرجاء إدخال رابط إلكتروني صالح.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"يجب أن يكون معرف UUID صالح.\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"أدخِل عنوان IPV4 أو IPV6 صحيح.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"الرجاء إدخال رقم صحيح صالح.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"تأكد ان القيمة أقل من أو تساوي {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"تأكد ان القيمة أكبر من أو تساوي {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"النص طويل جداً.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"الرجاء إدخال رقم صالح.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"تأكد ان القيمة لا تحوي أكثر من {max_digits} رقم.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"تأكد انه لا يوجد اكثر من {max_decimal_places} أرقام عشرية.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"تأكد انه لا يوجد اكثر من {max_whole_digits} أرقام قبل النقطة العشرية.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"صيغة التاريخ و الوقت غير صحيحة. عليك أن تستخدم احد الصيغ التالية: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"متوقع تاريخ و وقت و وجد تاريخ فقط\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"تاريخ و وقت غير صالح للمنطقة الزمنية \\\"{timezone}\\\".\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"قيمة التاريخ و الوقت خارج النطاق.\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"صيغة التاريخ غير صحيحة. عليك أن تستخدم واحدة من هذه الصيغ التالية: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"متوقع تاريخ  فقط و وجد تاريخ ووقت\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"صيغة الوقت غير صحيحة. عليك أن تستخدم واحدة من هذه الصيغ التالية: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"صيغة المدة غير صحيحة. يرجى استخدام احد الصيغ التالية: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" ليس خياراً صالحاً.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"أكثر من {count} عنصر...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"المتوقع وجود قائمة عناصر لكن وجد النوع \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"هذا التحديد لا يجب أن يكون فارغا.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"{input} ليس خيار مسار صالح.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"لم يتم إرسال أي ملف.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"البيانات المرسلة ليست ملف. تأكد من نوع الترميز في النموذج.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"تعذر تحديد اسم الملف.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"الملف المرسل فارغ.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"تأكد ان طول إسم الملف لا يتجاوز {max_length} حرف (عدد الحروف الحالي {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"يرجى رفع صورة صالحة. الملف الذي قمت برفعه ليس صورة أو أنه ملف تالف.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"يجب أن لا تكون القائمة فارغة.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"تأكد ان عدد العناصر في هذا الحقل لا يقل عن {min_length}.\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"تأكد ان عدد العناصر في هذا الحقل لا يتجاوز {max_length}.\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"المتوقع كان قاموس عناصر و لكن النوع المتحصل عليه هو \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"يجب أن لا يكون القاموس فارغاً.\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"القيمة يجب أن تكون JSON صالح.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"بحث\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"مصطلح البحث.\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"الترتيب\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"أي حقل يجب استخدامه عند ترتيب النتائج.\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"تصاعدي\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"تنازلي\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"رقم الصفحة ضمن النتائج المقسمة.\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"عدد النتائج التي يجب إرجاعها في كل صفحة.\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"صفحة غير صحيحة.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"الفهرس الأولي الذي يجب البدء منه لإرجاع النتائج.\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"قيمة المؤشر للتقسيم.\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"مؤشر غير صالح\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"معرف العنصر \\\"{pk_value}\\\" غير صالح -  العنصر غير موجود.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"نوع غير صحيح. يتوقع قيمة معرف العنصر، بينما حصل على {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"رابط تشعبي غير صالح - لا يوجد تطابق URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"رابط تشعبي غير صالح - تطابق URL غير صحيح.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"رابط تشعبي غير صالح - العنصر غير موجود.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"نوع غير صحيح. المتوقع هو رابط URL، ولكن تم الحصول على {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"عنصر ب {slug_name}={value} غير موجود.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"قيمة غير صالحة.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"رقم صحيح فريد\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"نص UUID\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"قيمة فريدة\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"نوع {value_type} يحدد هذا {name}.\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"معطيات غير صالحة. المتوقع هو قاموس، لكن المتحصل عليه {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"إجراءات إضافية\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"مرشحات\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"شريط التنقل\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"المحتوى\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"نموذج الطلب\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"المحتوى الرئيسي\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"معلومات الطلب\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"معلومات الرد\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"لا شيء\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"لا يوجد عناصر لتحديدها.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"هذا الحقل يجب أن يكون فريد\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"الحقول {field_names} يجب أن تشكل مجموعة فريدة.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"لا يُسمح بالحروف البديلة: U+{code_point:X}.\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"الحقل يجب ان يكون فريد للتاريخ {date_field}.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"الحقل يجب ان يكون فريد للشهر {date_field}.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"الحقل يجب ان يكون فريد للعام {date_field}.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"إصدار غير صالح في ترويسة \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"نسخة غير صالحة في مسار URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \" إصدار غير صالح في المسار URL. لا يطابق أي إصدار من مساحة الإسم.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"إصدار غير صالح في اسم المضيف.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"إصدار غير صالح في معلمة الإستعلام.\"\n"
  },
  {
    "path": "rest_framework/locale/az/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Emin Mastizada <emin@linux.com>, 2020\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Azerbaijani (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/az/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: az\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Xətalı sadə başlıq. İstifadəçi məlumatları təchiz edilməyib.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Xətalı sadə başlıq. İstifadəçi məlumatlarında boşluq olmamalıdır.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Xətalı sadə başlıq. İstifadəçi məlumatları base64 ilə düzgün şifrələnməyib.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Xətalı istifadəçi adı/parol.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"İstifadəçi aktiv deyil və ya silinib.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Xətalı token başlığı. İstifadəçi məlumatları təchiz edilməyib.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Xətalı token başlığı. Token mətnində boşluqlar olmamalıdır.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Xətalı token başlığı. Token mətnində xətalı simvollar olmamalıdır.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Xətalı token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Təsdiqləmə Tokeni\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Açar\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"İstifadəçi\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Yaradılıb\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokenlər\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"İstifadəçi adı\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Parol\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Təchiz edilən istifadəçi məlumatları ilə daxil olmaq mümkün olmadı.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Mütləq \\\"username\\\" və \\\"password\\\" olmalıdır.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Server xətası yaşandı.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Qüsurlu istək.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Səhv təsdiqləmə məlumatları.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Təsdiqləmə məlumatları təchiz edilməyib.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Bu əməliyyat üçün icazəniz yoxdur.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Tapılmadı.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\\\"{method}\\\" yöntəminə icazə verilmir.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"İstəyin Accept başlığını qane etmək mümkün olmadı.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"İstəkdə dəstəklənməyən \\\"{media_type}\\\" mediya növü.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"İstək nəzərə alınmadı.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Bu sahə tələb edilir.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Bu sahə null ola bilməz.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Bu sahə boş ola bilməz.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Bu sahənin ən çox {max_length} simvolu olduğuna əmin olun.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Bu sahənin ən az {min_length} simvolu olduğuna əmin olun.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Keçərli e-poçt ünvanı daxil edin.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Bu dəyər tələb edilən formaya uyğun gəlmir.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Hərf, rəqəm, alt xətt və defislərdən ibarət keçərli \\\"slug\\\" daxil edin.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Keçərli URL daxil edin.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Keçərli IPv4 və ya IPv6 ünvanı daxil edin.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Keçərli tam ədəd tələb edilir.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Bu dəyərin uzunluğunun ən çox {max_value} olduğuna əmin olun.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Bu dəyərin uzunluğunun ən az {min_value} olduğuna əmin olun.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Yazı dəyəri çox uzundur.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Keçərli rəqəm tələb edilir.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Ən çox {max_digits} rəqəm olduğuna əmin olun.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Ən çox {max_decimal_places} onluq kəsr hissəsi olduğuna əmin olun.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Onluq kərsdən əvvəl ən çox {max_whole_digits} rəqəm olduğuna əmin olun.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datetime dəyəri səhvdir. Əvəzinə bu formatlardan birini işlədin: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Datetime gözlənirdi amma date gəldi.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Date dəyəri səhvdir. Əvəzinə bu formatlardan birini işlədin: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Date gözlənirdi amma datetime gəldi.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Vaxt formatı səhvdir. Əvəzinə bu formatlardan birini işlədin: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Müddət formatı səhvdir. Əvəzinə bu formatlardan birini işlədin: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" keçərli seçim deyil.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"{count} elementdən daha çoxdur...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Elementlər siyahısı gözlənirdi, amma \\\"{input_type}\\\" növü gəldi.\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Bu seçim boş ola bilməz.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" keçərli yol seçimi deyil.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Heç bir fayl göndərilmədi.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Göndərilən məlumat fayl deyildi. Anketin şifrələmə (encoding) növünü yoxlayın.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Faylın adı təyin edilə bilmədi.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Göndərilən fayl boşdur.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Fayl adının ən çox {max_length} simvoldan ibarət olduğuna əmin olun (hazırki: {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Keçərli şəkil yükləyin. Yüklədiyiniz fayl ya şəkil deyil, ya da ola bilsin zədələnib.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Bu siyahı boş ola bilməz.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Elementlərin kitabçası (dictionary) gözlənirdi amma \\\"{input_type}\\\" növü gəldi.\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Dəyər keçərli JSON olmalıdır.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Axtarış\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Sıralama\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"artan\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"azalan\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Xətalı səhifə.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Xətalı kursor\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Xətalı pk \\\"{pk_value}\\\" - obyekt mövcud deyil.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Xətalı növ. PK dəyəri gözlənirdi, {data_type} alındı.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Xətalı hiperkeçid - Heç bir URL uyğun gəlmir.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Xətalı hiperkeçid - Xətalı URL uyğunluğu.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Xətalı hiperkeçid - Obyekt mövcud deyil.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Xətalı növ. URL yazısı gözlənirdi, {data_type} gəldi.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"{slug_name}={value} üçün uyğun obyekt mövcud deyil.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Xətalı dəyər.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Xətalı məlumat. Kitabça (dictionary) gözlənirdi, {datatype} gəldi.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filterlər\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Heç nə\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Seçiləcək element yoxdur.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Bu sahə unikal olmalıdır.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"{field_names} sahələri birlikdə unikal dəst olmalıdırlar.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Bu sahə \\\"{date_field}\\\" günü üçün unikal olmalıdır.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Bu sahə \\\"{date_field}\\\" ayı üçün unikal olmalıdır.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Bu sahə \\\"{date_field}\\\" ili üçün unikal olmalıdır.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\\\"Accept\\\" başlığında xətalı versiya.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"URL yolunda xətalı versiya.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"URL yolunda xətalı versiya. Heç bir versiya namespace-inə uyğun gəlmir.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Hostname-də xətalı versiya.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Sorğu parametrində xətalı versiya.\"\n"
  },
  {
    "path": "rest_framework/locale/be/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Belarusian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/be/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: be\\n\"\n\"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/bg/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Bulgarian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/bg/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: bg\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Невалиден header за базово удостоверение (basic authentication). Не се предоставени удостоверения.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Невалиден header за базово удостоверение (basic authentication). Носителите на удостоверение не трябва да съдържат интервали.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Невалиден header за базово удостоверение (basic authentication). Носителите на удостоверение не са кодирани в base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Невалидни потребителско име/парола.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Потребителят е неактивен или изтрит.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Невалиден token header. Не са предоставени носители на удостоверение.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Невалиден token header. Жетона (token-a) не трябва да съдържа интервали.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Невалиден token header. Жетона (token-a) не трябва да съдържа невалидни символи.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Невалиден жетон.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Жетон за удостоверение\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Ключ\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Потребител\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Създаден\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Жетон\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Жетони\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Потребителско име\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Парола\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Не е възможен вход с предоставените удостоверения.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Трябва да съдържа \\\"username\\\" (потребителско име) и \\\"password\\\" (парола).\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Сървърна грешка.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Неправилно оформена заявка.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Невалидни носители на удостоверение.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Носители на удостоверение не са предоставени.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Нямате права да се направи това действие.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Обектът не е намерен.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Метод \\\"{method}\\\" не е позволен.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Не може да бъде удовлетворен Accept header.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Неподдържан тип на документа \\\"{media_type}\\\" в заявката.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Заявката е ограничена.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Това поле е задължително.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Това поле не може да има празна стойност.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Това поле не може да е празно.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Това поле не трябва да съдържа повече от {max_length} символа.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Това поле трябва да съдържа поде {min_length} символа.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Въведете валиден имейл адрес.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Тази стойност не съответства на изисквания шаблон.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Въведете валиден \\\"slug\\\" съдържащ латински букви, цифри, долни черти или тирета.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Въведете валиден URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Въведете валиден IPv4 или IPv6 адрес.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Необходимо е валидно цяло число.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Тази стойност трябва да е не повече от {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Тази стойност трябва да е поне {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Низът е прекалено голям.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Необходимо е валидно число.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Допустими са не повече от {max_digits} цифри.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Допустими са не повече от {max_decimal_places} цифри след десетичната запетая.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Допустими са не повече от {max_whole_digits} цифри преди десетичната запетая.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Датата и часът са в невалиден формат. Валидни са следните формати: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Очаква се дата и час, но е намерена само дата.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Дата е в невалиден формат. Валидни са следните формати: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Очаква се дата, но са подадени дата и час.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Времето е в невалиден формат. Валидни са следните формати: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Отрязъкът от време е в невалиден формат. Валидни са следните формати: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" не е валиден избор.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Повече от {count} неща...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Очаква се списък от неща, но е получен тип \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Този избор не може да е празен.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" не е валиден избор за път.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Не е подаден файл.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Подадените данни не са файл. Проверете кодировката на формата.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Не може да бъде определено името на файла.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Подадения файл е празен.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Името на файла може да е до {max_length} символа (то е {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Невалидно изображение. Подадения файл не е изображение или е повредено изображение.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Този списък не може да е празен.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Очаква се асоциативен масив, но е получен \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Стойността трябва да е валиден JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Търсене\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Подредба\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"в нарастващ ред\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"в намаляващ ред\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Невалидна страница.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Невалиден курсор\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Невалиден идентификатор \\\"{pk_value}\\\" - обектът не съществува.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Неправилен тип. Очакван е тип за основен ключ, получен е {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Невалидна връзка (hyperlink) - няма намерен URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Невалидна връзка (hyperlink) - неправилно съвпадение на URL.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Невалидна връзка (hyperlink) - обектът не съществува.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Невалиден тип. Очаква се URL низ, получен е {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Обект с {slug_name}={value} не съществува.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Невалидна стойност.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Невалидни данни. Очаква се асоциативен масив, но е получен {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Филтри\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Нищо\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Няма неща за избиране.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Това поле трябва да е уникално.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Полетата {field_names} трябва да образуват уникална комбинация.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Това поле трябва да е уникално за \\\"{date_field}\\\" дата.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Това поле трябва да е уникално за \\\"{date_field}\\\" месец.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Това поле трябва да е уникално за \\\"{date_field}\\\" година.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Невалидна версия в \\\"Accept\\\" header.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Невалидна версия в URL пътя.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Невалидна версия в URL пътя. Няма съвпадение с пространството от имена на версии.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Невалидна версия в името на сървъра (hostname).\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Невалидна версия в GET параметър.\"\n"
  },
  {
    "path": "rest_framework/locale/ca/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Catalan (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ca/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: ca\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Header Basic invàlid. No hi ha disponibles les credencials.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Header Basic invàlid. Les credencials no poden contenir espais.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Header Basic invàlid. Les credencials no estan codificades correctament en base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Usuari/Contrasenya incorrectes.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Usuari inactiu o esborrat.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Token header invàlid. No s'han indicat les credencials.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Token header invàlid. El token no ha de contenir espais.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Token header invàlid. El token no pot contenir caràcters invàlids.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Token invàlid.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"No es possible loguejar-se amb les credencials introduïdes.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"S'ha d'incloure \\\"username\\\" i \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"S'ha produït un error en el servidor.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Request amb format incorrecte.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Credencials d'autenticació incorrectes.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Credencials d'autenticació no disponibles.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"No té permisos per realitzar aquesta acció.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"No trobat.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Mètode \\\"{method}\\\" no permès.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"No s'ha pogut satisfer l'Accept header de la petició.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Media type \\\"{media_type}\\\" no suportat.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"La petició ha estat limitada pel número màxim de peticions definit.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Aquest camp és obligatori.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Aquest camp no pot ser nul.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Aquest camp no pot estar en blanc.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Aquest camp no pot tenir més de {max_length} caràcters.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Aquest camp ha de tenir un mínim de {min_length} caràcters.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Introdueixi una adreça de correu vàlida.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Aquest valor no compleix el patró requerit.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Introdueix un \\\"slug\\\" vàlid consistent en lletres, números, guions o guions baixos.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Introdueixi una URL vàlida.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Introdueixi una adreça IPv4 o IPv6 vàlida.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Es requereix un nombre enter vàlid.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Aquest valor ha de ser menor o igual a {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Aquest valor ha de ser més gran o igual a {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Valor del text massa gran.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Es requereix un nombre vàlid.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"No pot haver-hi més de {max_digits} dígits en total.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"No pot haver-hi més de {max_decimal_places} decimals.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"No pot haver-hi més de {max_whole_digits} dígits abans del punt decimal.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"El Datetime té un format incorrecte. Utilitzi un d'aquests formats: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"S'espera un Datetime però s'ha rebut un Date.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"El Date té un format incorrecte. Utilitzi un d'aquests formats: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"S'espera un Date però s'ha rebut un Datetime.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"El Time té un format incorrecte. Utilitzi un d'aquests formats: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"La durada té un format incorrecte. Utilitzi un d'aquests formats: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" no és una opció vàlida.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"S'espera una llista d'ítems però s'ha rebut el tipus \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Aquesta selecció no pot estar buida.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" no és un path vàlid.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"No s'ha enviat cap fitxer.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Les dades enviades no són un fitxer. Comproveu l'encoding type del formulari.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"No s'ha pogut determinar el nom del fitxer.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"El fitxer enviat està buit.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"El nom del fitxer ha de tenir com a màxim {max_length} caràcters (en té {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Envieu una imatge vàlida. El fitxer enviat no és una imatge o és una imatge corrompuda.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Aquesta llista no pot estar buida.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"S'espera un diccionari però s'ha rebut el tipus \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Cursor invàlid.\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"PK invàlida \\\"{pk_value}\\\" - l'objecte no existeix.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Tipus incorrecte. S'espera el valor d'una PK, s'ha rebut {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Hyperlink invàlid - Cap match d'URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Hyperlink invàlid - Match d'URL incorrecta.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Hyperlink invàlid - L'objecte no existeix.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Tipus incorrecte. S'espera una URL, s'ha rebut {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"L'objecte amb {slug_name}={value} no existeix.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Valor invàlid.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Dades invàlides. S'espera un diccionari però s'ha rebut {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Cap\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Cap opció seleccionada.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Aquest camp ha de ser únic.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Aquests camps {field_names} han de constituir un conjunt únic.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Aquest camp ha de ser únic per a la data \\\"{date_field}\\\".\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Aquest camp ha de ser únic per al mes \\\"{date_field}\\\".\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Aquest camp ha de ser únic per a l'any \\\"{date_field}\\\".\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Versió invàlida al header \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Versió invàlida a la URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Versió invàlida al hostname.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Versió invàlida al paràmetre de consulta.\"\n"
  },
  {
    "path": "rest_framework/locale/ca_ES/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Catalan (Spain) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ca_ES/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: ca_ES\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/cs/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Jirka Vejrazka <Jirka.Vejrazka@gmail.com>, 2015\n# Tomáš Ehrlich <tomas.ehrlich@gmail.com>, 2015\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Czech (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/cs/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: cs\\n\"\n\"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Chybná hlavička. Nebyly poskytnuty přihlašovací údaje.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Chybná hlavička. Přihlašovací údaje by neměly obsahovat mezery.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Chybná hlavička. Přihlašovací údaje nebyly správně zakódovány pomocí base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Chybné uživatelské jméno nebo heslo.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Uživatelský účet je neaktivní nebo byl smazán.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Chybná hlavička tokenu. Nebyly zadány přihlašovací údaje.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Chybná hlavička tokenu. Přihlašovací údaje by neměly obsahovat mezery.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Chybná hlavička s tokenem. Token nesmí obsahovat nevalidní znaky.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Chybný token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Autentizační token\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Klíč\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Uživatel\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Vytvořeno\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokeny\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Uživatelské jméno\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Heslo\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Zadanými údaji se nebylo možné přihlásit.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Musí obsahovat \\\"uživatelské jméno\\\" a \\\"heslo\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Chyba na straně serveru.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Neplatný formát požadavku.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Chybné přihlašovací údaje.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Nebyly zadány přihlašovací údaje.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"K této akci nemáte oprávnění.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Nenalezeno.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metoda \\\"{method}\\\" není povolena.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Nelze vyhovět požadavku v hlavičce Accept.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Nepodporovaný media type \\\"{media_type}\\\" v požadavku.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Požadavek byl limitován kvůli omezení počtu požadavků za časovou periodu.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Toto pole je vyžadováno.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Toto pole nesmí být prázdné (null).\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Toto pole nesmí být prázdné.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Zkontrolujte, že toto pole není delší než {max_length} znaků.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Zkontrolujte, že toto pole obsahuje alespoň {min_length} znaků.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Vložte platnou e-mailovou adresu.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Hodnota v tomto poli neodpovídá požadovanému formátu.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Vložte platnou \\\"zkrácenou formu\\\" obsahující pouze malá písmena, čísla, spojovník nebo podtržítko.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Vložte platný odkaz.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Vložte platnou IPv4 nebo IPv6 adresu.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Je vyžadováno celé číslo.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Zkontrolujte, že hodnota je menší nebo rovna {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Zkontrolujte, že hodnota je větší nebo rovna {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Řetězec je příliš dlouhý.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Je vyžadováno číslo.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Zkontrolujte, že číslo neobsahuje více než {max_digits} čislic.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Zkontrolujte, že číslo nemá více než {max_decimal_places} desetinných míst.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Zkontrolujte, že číslo neobsahuje více než {max_whole_digits} čislic před desetinnou čárkou.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Chybný formát data a času. Použijte jeden z těchto formátů: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Bylo zadáno pouze datum bez času.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Chybný formát data. Použijte jeden z těchto formátů: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Bylo zadáno datum a čas, místo samotného data.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Chybný formát času. Použijte jeden z těchto formátů: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Trvání má nesprávný formát. Použijte jeden z následujících: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" není platnou možností.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Více než {count} položek...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Byl očekáván seznam položek ale nalezen \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Tento výběr by neměl být prázdný.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" není validní cesta k souboru.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Nebyl zaslán žádný soubor.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Zaslaná data neobsahují soubor. Zkontrolujte typ kódování ve formuláři.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Nebylo možné zjistit jméno souboru.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Zaslaný soubor je prázdný.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Zajistěte, aby jméno souboru obsahovalo maximálně {max_length} znaků (teď má {length} znaků).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Nahrajte platný obrázek. Nahraný soubor buď není obrázkem nebo je poškozen.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Tento list by neměl být prázdný.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Byl očekáván slovník položek ale nalezen \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Hodnota musí být platná hodnota JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Hledat\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Řazení\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"vzestupně\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"sestupně\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Nevalidní strana.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Chybný kurzor\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Chybný primární klíč \\\"{pk_value}\\\" - objekt neexistuje.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Chybný typ. Byl přijat typ {data_type} místo hodnoty primárního klíče.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Chybný odkaz - nebyla nalezena žádní shoda.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Chybný odkaz - byla nalezena neplatná shoda.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Chybný odkaz - objekt neexistuje.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Chybný typ. Byl přijat typ {data_type} místo očekávaného odkazu.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objekt s {slug_name}={value} neexistuje.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Chybná hodnota.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Chybná data. Byl přijat typ {datatype} místo očekávaného slovníku.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtry\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Neuvedeno\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Žádné položky k výběru.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Tato položka musí být unikátní.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Položka {field_names} musí tvořit unikátní množinu.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Tato položka musí být pro datum \\\"{date_field}\\\" unikátní.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Tato položka musí být pro měsíc \\\"{date_field}\\\" unikátní.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Tato položka musí být pro rok \\\"{date_field}\\\" unikátní.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Chybné číslo verze v hlavičce Accept.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Chybné číslo verze v odkazu.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Nevalidní verze v URL cestě. Neodpovídá žádnému z jmenných prostorů pro verze.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Chybné číslo verze v hostname.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Chybné čislo verze v URL parametru.\"\n"
  },
  {
    "path": "rest_framework/locale/da/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Mads Jensen <mje@inducks.org>, 2015-2017\n# Mikkel Munch Mortensen <3xm@detfalskested.dk>, 2015\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Danish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/da/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: da\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Ugyldig basic header. Ingen legitimation angivet.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Ugyldig basic header. Legitimationsstrenge må ikke indeholde mellemrum.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Ugyldig basic header. Legitimationen er ikke base64 encoded på korrekt vis.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Ugyldigt brugernavn/kodeord.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Inaktiv eller slettet bruger.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Ugyldig token header.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Ugyldig token header. Token-strenge må ikke indeholde mellemrum.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Ugyldig token header. Token streng bør ikke indeholde ugyldige karakterer.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Ugyldigt token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Nøgle\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Bruger\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Oprettet\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokens\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Brugernavn\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Kodeord\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Kunne ikke logge ind med den angivne legitimation.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Skal indeholde \\\"username\\\" og \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Der er sket en serverfejl.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Misdannet forespørgsel.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Ugyldig legitimation til autentificering.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Legitimation til autentificering blev ikke angivet.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Du har ikke lov til at udføre denne handling.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Ikke fundet.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metoden \\\"{method}\\\" er ikke tilladt.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Kunne ikke efterkomme forespørgslens Accept header.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Forespørgslens media type, \\\"{media_type}\\\", er ikke understøttet.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Forespørgslen blev neddroslet.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Dette felt er påkrævet.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Dette felt må ikke være null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Dette felt må ikke være tomt.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Tjek at dette felt ikke indeholder flere end {max_length} tegn.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Tjek at dette felt indeholder mindst {min_length} tegn.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Angiv en gyldig e-mailadresse.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Denne værdi passer ikke med det påkrævede mønster.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Indtast en gyldig \\\"slug\\\", bestående af bogstaver, tal, bund- og bindestreger.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Indtast en gyldig URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Indtast en gyldig IPv4 eller IPv6 adresse.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Et gyldigt heltal er påkrævet.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Tjek at værdien er mindre end eller lig med {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Tjek at værdien er større end eller lig med {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Strengværdien er for stor.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Et gyldigt tal er påkrævet.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Tjek at der ikke er flere end {max_digits} cifre i alt.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Tjek at der ikke er flere end {max_decimal_places} cifre efter kommaet.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Tjek at der ikke er flere end {max_whole_digits} cifre før kommaet.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datotid har et forkert format. Brug i stedet et af disse formater: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Forventede en datotid, men fik en dato.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Dato har et forkert format. Brug i stedet et af disse formater: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Forventede en dato men fik en datotid.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Klokkeslæt har forkert format. Brug i stedet et af disse formater: {format}. \"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Varighed har forkert format. Brug istedet et af følgende formater: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" er ikke et gyldigt valg.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Flere end {count} objekter...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Forventede en liste, men fik noget af typen \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Dette valg kan være tomt.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" er ikke et gyldigt valg af adresse.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Ingen medsendt fil.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Det medsendte data var ikke en fil. Tjek typen af indkodning på formularen.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Filnavnet kunne ikke afgøres.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Den medsendte fil er tom.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Sørg for at filnavnet er højst {max_length} langt (det er {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Medsend et gyldigt billede. Den medsendte fil var enten ikke et billede eller billedfilen var ødelagt.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Denne liste er muligvis ikke tom.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Forventede en dictionary, men fik noget af typen \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Værdi skal være gyldig JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Søg\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Sortering\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"stigende\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"faldende\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Ugyldig side\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Ugyldig cursor\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Ugyldig primærnøgle \\\"{pk_value}\\\" - objektet findes ikke.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Ugyldig type. Forventet værdi er primærnøgle, fik {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Ugyldigt hyperlink - intet URL match.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Ugyldigt hyperlink - forkert URL match.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Ugyldigt hyperlink - objektet findes ikke.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Forkert type. Forventede en URL-streng, fik {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Object med {slug_name}={value} findes ikke.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Ugyldig værdi.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Ugyldig data. Forventede en dictionary, men fik {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtre\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Ingen\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Intet at vælge.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Dette felt skal være unikt.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Felterne {field_names} skal udgøre et unikt sæt.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Dette felt skal være unikt for \\\"{date_field}\\\"-datoen.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Dette felt skal være unikt for \\\"{date_field}\\\"-måneden.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Dette felt skal være unikt for \\\"{date_field}\\\"-året.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Ugyldig version i \\\"Accept\\\" headeren.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Ugyldig version i URL-stien.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Ugyldig version in URLen. Den stemmer ikke overens med nogen versionsnumre.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Ugyldig version i hostname.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Ugyldig version i forespørgselsparameteren.\"\n"
  },
  {
    "path": "rest_framework/locale/de/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Fabian Büchler <fabian@buechler.io>, 2015\n# 5a85a00218ad0559ac6870a4179f4dbc, 2017\n# Lukas Bischofberger <me@worx.li>, 2017\n# Mads Jensen <mje@inducks.org>, 2015\n# Niklas P <contact@niklasplessing.net>, 2015-2016\n# Thomas Tanner, 2015\n# Tom Jaster <futur3.tom@googlemail.com>, 2015\n# Xavier Ordoquy <xordoquy@linovia.com>, 2015\n# stefan6419846, 2025\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: German (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/de/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: de\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Ungültiger Basic Header. Keine Zugangsdaten angegeben.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Ungültiger Basic Header. Zugangsdaten sollen keine Leerzeichen enthalten.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Ungültiger Basic Header. Zugangsdaten sind nicht korrekt mit base64 kodiert.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Ungültiger Benutzername/Passwort.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Benutzer inaktiv oder gelöscht.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Ungültiger Token Header. Keine Zugangsdaten angegeben.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Ungültiger Token Header. Zugangsdaten sollen keine Leerzeichen enthalten.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Ungültiger Token Header. Zugangsdaten dürfen keine ungültigen Zeichen enthalten.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Ungültiges Token\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Auth Token\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Schlüssel\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Benutzer\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Erzeugt\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokens\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Benutzername\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Passwort\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Die angegebenen Zugangsdaten stimmen nicht.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\\\"username\\\" und \\\"password\\\" sind erforderlich.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Ein Serverfehler ist aufgetreten.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"Ungültige Eingabe.\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Fehlerhafte Anfrage.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Falsche Anmeldedaten.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Anmeldedaten fehlen.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Sie sind nicht berechtigt, diese Aktion durchzuführen.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Nicht gefunden.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Methode \\\"{method}\\\" nicht erlaubt.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Kann die Accept Kopfzeile der Anfrage nicht erfüllen.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Nicht unterstützter Medientyp \\\"{media_type}\\\" in der Anfrage.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Die Anfrage wurde gedrosselt.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"Erwarte Verfügbarkeit in {wait} Sekunde.\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"Erwarte Verfügbarkeit in {wait} Sekunden.\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Dieses Feld ist zwingend erforderlich.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Dieses Feld darf nicht null sein.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"Muss ein gültiger Wahrheitswert sein.\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"Kein gültiger String.\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Dieses Feld darf nicht leer sein.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Stelle sicher, dass dieses Feld nicht mehr als {max_length} Zeichen lang ist.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Stelle sicher, dass dieses Feld mindestens {min_length} Zeichen lang ist.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Gib eine gültige E-Mail Adresse an.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Dieser Wert passt nicht zu dem erforderlichen Muster.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Gib ein gültiges \\\"slug\\\" aus Buchstaben, Ziffern, Unterstrichen und Minuszeichen ein.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"Gib ein gültiges \\\"slug\\\" aus Unicode-Buchstaben, Ziffern, Unterstrichen und Minuszeichen ein.\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Gib eine gültige URL ein.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"Muss eine gültige UUID sein.\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Geben Sie eine gültige IPv4 oder IPv6 Adresse an.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Eine gültige Ganzzahl ist erforderlich.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Stelle sicher, dass dieser Wert kleiner oder gleich {max_value} ist.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Stelle sicher, dass dieser Wert größer oder gleich {min_value} ist.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Zeichenkette zu lang.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Eine gültige Zahl ist erforderlich.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Stelle sicher, dass es insgesamt nicht mehr als {max_digits} Ziffern lang ist.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Stelle sicher, dass es nicht mehr als {max_decimal_places} Nachkommastellen lang ist.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Stelle sicher, dass es nicht mehr als {max_whole_digits} Stellen vor dem Komma lang ist.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datums- und Zeitangabe hat das falsche Format. Nutze stattdessen eines dieser Formate: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Erwarte eine Datums- und Zeitangabe, erhielt aber ein Datum.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"Ungültige Datumsangabe für die Zeitzone \\\"{timezone}\\\".\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"Datumsangabe außerhalb des Bereichs.\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datum hat das falsche Format. Nutze stattdessen eines dieser Formate: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Erwarte ein Datum, erhielt aber eine Datums- und Zeitangabe.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Zeitangabe hat das falsche Format. Nutze stattdessen eines dieser Formate: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Laufzeit hat das falsche Format. Benutze stattdessen eines dieser  Formate {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" ist keine gültige Option.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Mehr als {count} Ergebnisse\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Erwarte eine Liste von Elementen, erhielt aber den Typ \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Diese Auswahl darf nicht leer sein\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" ist ein ungültiger Pfad.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Es wurde keine Datei übermittelt.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Die übermittelten Daten stellen keine Datei dar. Prüfe den Kodierungstyp im Formular.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Der Dateiname konnte nicht ermittelt werden.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Die übermittelte Datei ist leer.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Stelle sicher, dass dieser Dateiname höchstens {max_length} Zeichen lang ist (er hat {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Lade ein gültiges Bild hoch. Die hochgeladene Datei ist entweder kein Bild oder ein beschädigtes Bild.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Diese Liste darf nicht leer sein.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"Dieses Feld muss mindestens {min_length} Einträge enthalten.\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"Dieses Feld darf nicht mehr als {max_length} Einträge enthalten.\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Erwartete ein Dictionary mit Elementen, erhielt aber den Typ \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"Dieses Dictionary darf nicht leer sein.\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Wert muss gültiges JSON sein.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Suche\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"Ein Suchbegriff.\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Sortierung\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"Feld, das zum Sortieren der Ergebnisse verwendet werden soll.\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"Aufsteigend\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"Absteigend\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"Eine Seitenzahl in der paginierten Ergebnismenge.\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"Anzahl der pro Seite zurückzugebenden Ergebnisse.\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Ungültige Seite.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"Der initiale Index, von dem die Ergebnisse zurückgegeben werden sollen.\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"Der Zeigerwert für die Paginierung\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Ungültiger Zeiger\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Ungültiger pk \\\"{pk_value}\\\" - Object existiert nicht.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Falscher Typ. Erwarte pk-Wert, erhielt aber {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Ungültiger Hyperlink - entspricht keiner URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Ungültiger Hyperlink - URL stimmt nicht überein.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Ungültiger Hyperlink - Objekt existiert nicht.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Falscher Typ. Erwarte URL-Zeichenkette, erhielt aber {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objekt mit {slug_name}={value} existiert nicht.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Ungültiger Wert.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"eindeutiger Ganzzahl-Wert\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"UUID-String\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"eindeutiger Wert\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"Ein {value_type}, der {name} identifiziert.\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Ungültige Daten. Dictionary erwartet, aber {datatype} erhalten.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"Zusätzliche Aktionen\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filter\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"Navigation\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"Inhalt\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"Anfrage-Formular\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"Hauptteil\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"Anfrage-Informationen\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"Antwort-Informationen\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Nichts\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Keine Elemente zum Auswählen.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Dieses Feld muss eindeutig sein.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Die Felder {field_names} müssen eine eindeutige Menge bilden.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"Ersatzzeichen sind nicht erlaubt: U+{code_point:X}.\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Dieses Feld muss bezüglich des \\\"{date_field}\\\" Datums eindeutig sein.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Dieses Feld muss bezüglich des \\\"{date_field}\\\" Monats eindeutig sein.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Dieses Feld muss bezüglich des \\\"{date_field}\\\" Jahrs eindeutig sein.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Ungültige Version in der \\\"Accept\\\" Kopfzeile.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Ungültige Version im URL-Pfad.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Ungültige Version im URL-Pfad. Entspricht keinem Versions-Namensraum.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Ungültige Version im Hostname.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Ungültige Version im Anfrageparameter.\"\n"
  },
  {
    "path": "rest_framework/locale/el/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Christos Barkonikos <xristosbarko@hotmail.com>, 2020\n# Panagiotis Pavlidis <panpavlid@gmail.com>, 2019\n# Serafeim Papastefanos <spapas@gmail.com>, 2016\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Greek (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/el/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: el\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Λανθασμένη επικεφαλίδα basic. Δεν υπάρχουν διαπιστευτήρια.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Λανθασμένη επικεφαλίδα basic. Τα διαπιστευτήρια δεν πρέπει να περιέχουν κενά.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Λανθασμένη επικεφαλίδα basic. Τα διαπιστευτήρια δεν είναι κωδικοποιημένα κατά base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Λανθασμένο όνομα χρήστη/κωδικός.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Ο χρήστης είναι ανενεργός ή διεγραμμένος.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Λανθασμένη επικεφαλίδα token. Δεν υπάρχουν διαπιστευτήρια.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Λανθασμένη επικεφαλίδα token. Το token δεν πρέπει να περιέχει κενά.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Λανθασμένη επικεφαλίδα token. Το token περιέχει μη επιτρεπτούς χαρακτήρες.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Λανθασμένο token\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Token πιστοποίησης\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Κλειδί\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Χρήστης\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Δημιουργήθηκε\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokens\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Όνομα χρήστη\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Κωδικός\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Δεν είναι δυνατή η σύνδεση με τα διαπιστευτήρια.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Πρέπει να περιέχει \\\"όνομα χρήστη\\\" και \\\"κωδικό\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Σφάλμα διακομιστή.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Λανθασμένο αίτημα.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Λάθος διαπιστευτήρια.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Δεν δόθηκαν διαπιστευτήρια.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Δεν έχετε δικαίωματα για αυτή την ενέργεια.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Δε βρέθηκε.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Η μέθοδος \\\"{method}\\\" δεν επιτρέπεται.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Δεν ήταν δυνατή η ικανοποίηση της επικεφαλίδας Accept της αίτησης.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Δεν υποστηρίζεται το media type \\\"{media_type}\\\" της αίτησης.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Το αίτημα έγινε throttle.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Το πεδίο είναι απαραίτητο.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Το πεδίο δε μπορεί να είναι null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Το πεδίο δε μπορεί να είναι κενό.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Επιβεβαιώσατε ότι το πεδίο δεν έχει περισσότερους από {max_length} χαρακτήρες.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Επιβεβαιώσατε ότι το πεδίο έχει τουλάχιστον {min_length} χαρακτήρες.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Συμπληρώσατε μια έγκυρη διεύθυνση e-mail.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Η τιμή δε ταιριάζει με το pattern.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Εισάγετε ένα έγκυρο \\\"slug\\\" που αποτελείται από γράμματα, αριθμούς παύλες και κάτω παύλες.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Εισάγετε έγκυρο URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Εισάγετε μια έγκυρη διεύθυνση IPv4 ή IPv6.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Ένας έγκυρος ακέραιος είναι απαραίτητος.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Επιβεβαιώσατε ότι η τιμή είναι μικρότερη ή ίση του {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Επιβεβαιώσατε ότι η τιμή είναι μεγαλύτερη ή ίση του {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Το κείμενο είναι πολύ μεγάλο.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Ένας έγκυρος αριθμός είναι απαραίτητος.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Επιβεβαιώσατε ότι δεν υπάρχουν παραπάνω από {max_digits} ψηφία.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Επιβεβαιώσατε ότι δεν υπάρχουν παραπάνω από {max_decimal_places} δεκαδικά ψηφία.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Επιβεβαιώσατε ότι δεν υπάρχουν παραπάνω από {max_whole_digits} ακέραια ψηφία.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Η ημερομηνία έχεi λάθος μορφή. Χρησιμοποιήστε μια από τις ακόλουθες μορφές: {format}\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Αναμένεται ημερομηνία και ώρα αλλά δόθηκε μόνο ημερομηνία.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Η ημερομηνία έχεi λάθος μορφή. Χρησιμοποιήστε μια από τις ακόλουθες μορφές: {format}\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Αναμένεται ημερομηνία αλλά δόθηκε ημερομηνία και ώρα.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Η ώρα έχει λάθος μορφή. Χρησιμοποιήστε μια από τις ακόλουθες μορφές: {format}\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Η διάρκεια έχει λάθος μορφή. Χρησιμοποιήστε μια από τις ακόλουθες μορφές: {format}\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"Το \\\"{input}\\\" δεν είναι έγκυρη επιλογή.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Περισσότερα από {count} αντικείμενα...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Αναμένεται μια λίστα αντικειμένον αλλά δόθηκε ο τύπος \\\"{input_type}\\\"\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Η επιλογή δε μπορεί να είναι κενή.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"Το \\\"{input}\\\" δεν είναι έγκυρη επιλογή διαδρομής.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Δεν υποβλήθηκε αρχείο.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Τα δεδομένα που υποβλήθηκαν δεν ήταν αρχείο. Ελέγξατε την κωδικοποίηση της φόρμας.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Δε βρέθηκε όνομα αρχείου.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Το αρχείο που υποβλήθηκε είναι κενό.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Επιβεβαιώσατε ότι το όνομα αρχείου έχει ως {max_length} χαρακτήρες (έχει {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Ανεβάστε μια έγκυρη εικόνα. Το αρχείο που ανεβάσατε είτε δεν είναι εικόνα είτε έχει καταστραφεί.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Η λίστα δε μπορεί να είναι κενή.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Αναμένεται ένα λεξικό αντικείμενων αλλά δόθηκε ο τύπος \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Η τιμή πρέπει να είναι μορφής JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Αναζήτηση\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Ταξινόμηση\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Λάθος σελίδα.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Λάθος cursor.\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Λάθος κλειδί \\\"{pk_value}\\\" - το αντικείμενο δεν υπάρχει.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Λάθος τύπος. Αναμένεται τιμή κλειδιού, δόθηκε {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Λάθος σύνδεση - δε ταιριάζει κάποιο URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Λάθος σύνδεση - δε ταιριάζει κάποιο URL.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Λάθος σύνδεση - το αντικείμενο δεν υπάρχει.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Λάθος τύπος. Αναμένεται URL, δόθηκε {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Το αντικείμενο {slug_name}={value} δεν υπάρχει.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Λάθος τιμή.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Λάθος δεδομένα. Αναμένεται λεξικό αλλά δόθηκε {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Φίλτρα\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"None\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Δεν υπάρχουν αντικείμενα προς επιλογή.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Το πεδίο πρέπει να είναι μοναδικό\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Τα πεδία {field_names} πρέπει να αποτελούν ένα μοναδικό σύνολο.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Το πεδίο πρέπει να είναι μοναδικό για την ημερομηνία \\\"{date_field}\\\".\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Το πεδίο πρέπει να είναι μοναδικό για το μήνα \\\"{date_field}\\\".\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Το πεδίο πρέπει να είναι μοναδικό για το έτος  \\\"{date_field}\\\".\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Λάθος έκδοση στην επικεφαλίδα \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Λάθος έκδοση στη διαδρομή URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Λάθος έκδοση στο hostname.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Λάθος έκδοση στην παράμετρο\"\n"
  },
  {
    "path": "rest_framework/locale/el_GR/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Greek (Greece) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/el_GR/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: el_GR\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/en/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: English (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/en/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: en\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Invalid basic header. No credentials provided.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Invalid basic header. Credentials string should not contain spaces.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Invalid basic header. Credentials not correctly base64 encoded.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Invalid username/password.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"User inactive or deleted.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Invalid token header. No credentials provided.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Invalid token header. Token string should not contain spaces.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Invalid token header. Token string should not contain invalid characters.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Invalid token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Auth Token\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Key\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"User\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Created\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokens\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Username\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Password\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Unable to log in with provided credentials.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Must include \\\"username\\\" and \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"A server error occurred.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"Invalid input.\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Malformed request.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Incorrect authentication credentials.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Authentication credentials were not provided.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"You do not have permission to perform this action.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Not found.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Method \\\"{method}\\\" not allowed.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Could not satisfy the request Accept header.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Unsupported media type \\\"{media_type}\\\" in request.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Request was throttled.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"Expected available in {wait} second.\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"Expected available in {wait} seconds.\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"This field is required.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"This field may not be null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"Must be a valid boolean.\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"Not a valid string.\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"This field may not be blank.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Ensure this field has no more than {max_length} characters.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Ensure this field has at least {min_length} characters.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Enter a valid email address.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"This value does not match the required pattern.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or hyphens.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, or hyphens.\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Enter a valid URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"Must be a valid UUID.\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Enter a valid IPv4 or IPv6 address.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"A valid integer is required.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Ensure this value is less than or equal to {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Ensure this value is greater than or equal to {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"String value too large.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"A valid number is required.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Ensure that there are no more than {max_digits} digits in total.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Ensure that there are no more than {max_decimal_places} decimal places.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Ensure that there are no more than {max_whole_digits} digits before the decimal point.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datetime has wrong format. Use one of these formats instead: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Expected a datetime but got a date.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"Datetime value out of range.\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Date has wrong format. Use one of these formats instead: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Expected a date but got a datetime.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Time has wrong format. Use one of these formats instead: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Duration has wrong format. Use one of these formats instead: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" is not a valid choice.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"More than {count} items...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Expected a list of items but got type \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"This selection may not be empty.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" is not a valid path choice.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"No file was submitted.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"The submitted data was not a file. Check the encoding type on the form.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"No filename could be determined.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"The submitted file is empty.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Ensure this filename has at most {max_length} characters (it has {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Upload a valid image. The file you uploaded was either not an image or a corrupted image.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"This list may not be empty.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"Ensure this field has at least {min_length} elements.\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"Ensure this field has no more than {max_length} elements.\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"This dictionary may not be empty.\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Value must be valid JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Search\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"A search term.\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Ordering\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"Which field to use when ordering the results.\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"ascending\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"descending\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"A page number within the paginated result set.\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"Number of results to return per page.\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Invalid page.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"The initial index from which to return the results.\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"The pagination cursor value.\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Invalid cursor\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Incorrect type. Expected pk value, received {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Invalid hyperlink - No URL match.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Invalid hyperlink - Incorrect URL match.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Invalid hyperlink - Object does not exist.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Incorrect type. Expected URL string, received {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Object with {slug_name}={value} does not exist.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Invalid value.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"unique integer value\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"UUID string\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"unique value\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"A {value_type} identifying this {name}.\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Invalid data. Expected a dictionary, but got {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"Extra Actions\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filters\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"navbar\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"content\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"request form\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"main content\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"request info\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"response info\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"None\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"No items to select.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"This field must be unique.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"The fields {field_names} must make a unique set.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"Surrogate characters are not allowed: U+{code_point:X}.\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"This field must be unique for the \\\"{date_field}\\\" date.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"This field must be unique for the \\\"{date_field}\\\" month.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"This field must be unique for the \\\"{date_field}\\\" year.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Invalid version in \\\"Accept\\\" header.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Invalid version in URL path.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Invalid version in URL path. Does not match any version namespace.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Invalid version in hostname.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Invalid version in query parameter.\"\n"
  },
  {
    "path": "rest_framework/locale/en_AU/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: English (Australia) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/en_AU/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: en_AU\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/en_CA/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: English (Canada) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/en_CA/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: en_CA\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/en_US/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n#\n#, fuzzy\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: PACKAGE VERSION\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"\n\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n\"Language-Team: LANGUAGE <LL@li.org>\\n\"\n\"Language: \\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1515\nmsgid \"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/es/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Ernesto Rico Schmidt <e.rico.schmidt@gmail.com>, 2015\n# José Padilla <jpadilla@webapplicate.com>, 2015\n# Leo Prada <leo.prada90@gmail.com>, 2019\n# Miguel Gonzalez <migonzalvar@gmail.com>, 2015\n# Miguel Gonzalez <migonzalvar@gmail.com>, 2016\n# Miguel Gonzalez <migonzalvar@gmail.com>, 2015-2016\n# Sergio Infante <rsinfante@gmail.com>, 2015\n# Federico Bond <federicobond@gmail.com>, 2025\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2025-05-19 00:05+1000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Spanish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/es/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: es\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Cabecera básica inválida. Las credenciales no fueron suministradas.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Cabecera básica inválida. La cadena con las credenciales no debe contener espacios.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Cabecera básica inválida. Las credenciales no fueron codificadas correctamente en base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Nombre de usuario/contraseña inválidos.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Usuario inactivo o borrado.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Cabecera token inválida. Las credenciales no fueron suministradas.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Cabecera token inválida. La cadena token no debe contener espacios.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Cabecera token inválida. La cadena token no debe contener caracteres inválidos.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Token inválido.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Token de autenticación\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Clave\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Usuario\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Fecha de creación\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokens\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Nombre de usuario\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Contraseña\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"No puede iniciar sesión con las credenciales proporcionadas.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Debe incluir \\\"username\\\" y \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Se ha producido un error en el servidor.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"Entrada inválida.\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Solicitud con formato incorrecto.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Credenciales de autenticación incorrectas.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Las credenciales de autenticación no se proveyeron.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Usted no tiene permiso para realizar esta acción.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"No encontrado.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Método \\\"{method}\\\" no permitido.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"No se ha podido satisfacer la solicitud de cabecera de Accept.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Tipo de medio \\\"{media_type}\\\" incompatible en la solicitud.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Solicitud fue regulada (throttled).\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"Se espera que esté disponible en {wait} segundo.\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"Se espera que esté disponible en {wait} segundos.\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Este campo es requerido.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Este campo no puede ser nulo.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"Debe ser un booleano válido.\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"No es una cadena válida.\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Este campo no puede estar en blanco.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Asegúrese de que este campo no tenga más de {max_length} caracteres.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Asegúrese de que este campo tenga al menos {min_length} caracteres.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Introduzca una dirección de correo electrónico válida.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Este valor no coincide con el patrón requerido.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Introduzca un \\\"slug\\\" válido consistente en letras, números, guiones o guiones bajos.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, or hyphens.\"\nmsgstr \"Introduzca un “slug” válido compuesto por letras Unicode, números, guiones bajos o medios.\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Introduzca una URL válida.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"Debe ser un UUID válido.\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Introduzca una dirección IPv4 o IPv6 válida.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Introduzca un número entero válido.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Asegúrese de que este valor es menor o igual a {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Asegúrese de que este valor es mayor o igual a {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Cadena demasiado larga.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Se requiere un número válido.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Asegúrese de que no haya más de {max_digits} dígitos en total.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Asegúrese de que no haya más de {max_decimal_places} decimales.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Asegúrese de que no haya más de {max_whole_digits} dígitos en la parte entera.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Fecha/hora con formato erróneo. Use uno de los siguientes formatos en su lugar: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Se esperaba un fecha/hora en vez de una fecha.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"Fecha y hora inválida para la zona horaria \\\"{timezone}\\\".\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"Valor de fecha y hora fuera de rango.\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Fecha con formato erróneo. Use uno de los siguientes formatos en su lugar: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Se esperaba una fecha en vez de una fecha/hora.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Hora con formato erróneo. Use uno de los siguientes formatos en su lugar: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Duración con formato erróneo. Use uno de los siguientes formatos en su lugar: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" no es una elección válida.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Más de {count} elementos...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Se esperaba una lista de elementos en vez del tipo \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Esta selección no puede estar vacía.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" no es una elección de ruta válida.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"No se envió ningún archivo.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"La información enviada no era un archivo. Compruebe el tipo de codificación del formulario.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"No se pudo determinar un nombre de archivo.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"El archivo enviado está vació.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Asegúrese de que el nombre de archivo no tenga más de {max_length} caracteres (tiene {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Adjunte una imagen válida. El archivo adjunto o bien no es una imagen o bien está dañado.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Esta lista no puede estar vacía.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"Asegúrese de que este campo tiene al menos {min_length} elementos.\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"Asegúrese de que este campo no tiene más de {max_length} elementos.\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Se esperaba un diccionario de elementos en vez del tipo \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"Este diccionario no debe estar vacío.\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"El valor debe ser JSON válido.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Buscar\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"Un término de búsqueda.\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Ordenamiento\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"Qué campo usar para ordenar los resultados.\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"ascendiente\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"descendiente\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"Un número de página dentro del conjunto de resultados paginado.\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"Número de resultados a devolver por página.\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Página inválida.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"El índice inicial a partir del cual devolver los resultados.\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"El valor del cursor de paginación.\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Cursor inválido\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Clave primaria \\\"{pk_value}\\\" inválida - objeto no existe.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Tipo incorrecto. Se esperaba valor de clave primaria y se recibió {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Hiperenlace inválido - No hay URL coincidentes.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Hiperenlace inválido - Coincidencia incorrecta de la URL.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Hiperenlace inválido - Objeto no existe.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Tipo incorrecto. Se esperaba una URL y se recibió {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objeto con {slug_name}={value} no existe.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Valor inválido.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"valor de entero único\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"Cadena UUID\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"valor único\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"Un {value_type} que identifique este {name}.\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Datos inválidos. Se esperaba un diccionario pero es un {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"Acciones extras\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtros\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Ninguno\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"No hay elementos para seleccionar.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Este campo debe ser único.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Los campos {field_names} deben formar un conjunto único.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Este campo debe ser único para el día \\\"{date_field}\\\".\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Este campo debe ser único para el mes \\\"{date_field}\\\".\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Este campo debe ser único para el año \\\"{date_field}\\\".\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Versión inválida en la cabecera \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Versión inválida en la ruta de la URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"La versión especificada en la ruta de la URL no es válida. No coincide con ninguna del espacio de nombres de versiones.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Versión inválida en el nombre de host.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Versión inválida en el parámetro de consulta.\"\n"
  },
  {
    "path": "rest_framework/locale/et/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Erlend Eelmets <debcf78e@opayq.com>, 2020\n# Tõnis Kärdi <tonis.kardi@gmail.com>, 2015,2019\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Estonian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/et/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: et\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Sobimatu lihtpäis. Kasutajatunnus on esitamata.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Sobimatu lihtpäis. Kasutajatunnus ei tohi sisaldada tühikuid.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Sobimatu lihtpäis. Kasutajatunnus pole korrektselt base64-kodeeritud.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Sobimatu kasutajatunnus/salasõna.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Kasutaja on inaktiivne või kustutatud.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Sobimatu lubakaardi päis. Kasutajatunnus on esitamata.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Sobimatu lubakaardi päis. Loa sõne ei tohi sisaldada tühikuid.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Sobimatu lubakaardi päis. Loa sõne ei tohi sisaldada sobimatuid märke.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Sobimatu lubakaart.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Autentimistähis\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Võti\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Kasutaja\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Loodud\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Tähis\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tähised\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Kasutajanimi\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Salasõna\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Sisselogimine antud tunnusega ebaõnnestus.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Peab sisaldama \\\"kasutajatunnust\\\" ja \\\"slasõna\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Viga serveril.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Väändunud päring.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Ebakorrektne autentimistunnus.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Autentimistunnus on esitamata.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Teil puuduvad piisavad õigused selle tegevuse teostamiseks.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Ei leidnud.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Meetod \\\"{method}\\\" pole lubatud.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Päringu Accept-päist ei suutnud täita.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Meedia tüüpi {media_type} päringus ei toetata.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Liiga palju päringuid.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Väli on kohustuslik.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Väli ei tohi olla tühi.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"See väli ei tohi olla tühi.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Veendu, et see väli poleks pikem kui {max_length} tähemärki.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Veendu, et see väli oleks vähemalt {min_length} tähemärki pikk.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Sisestage kehtiv e-posti aadress.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Väärtus ei ühti etteantud mustriga.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Sisestage kehtiv \\\"slug\\\", mis koosneks tähtedest, numbritest, ala- või sidekriipsudest.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Sisestage korrektne URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Sisesta valiidne IPv4 või IPv6 aadress\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Sisendiks peab olema täisarv.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Veenduge, et väärtus on väiksem kui või võrdne väärtusega {max_value}. \"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Veenduge, et väärtus on suurem kui või võrdne väärtusega {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Sõne on liiga pikk.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Sisendiks peab olema arv.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Veenduge, et kokku pole rohkem kui {max_digits} numbit.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Veenduge, et komakohti pole rohkem kui {max_decimal_places}. \"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Veenduge, et täiskohti poleks rohkem kui {max_whole_digits}.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Valesti formaaditud kuupäev-kellaaeg. Kasutage mõnda neist: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Ootasin kuupäev-kellaaeg andmetüüpi, kuid sain hoopis kuupäeva.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Valesti formaaditud kuupäev. Kasutage mõnda neist: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Ootasin kuupäeva andmetüüpi, kuid sain hoopis kuupäev-kellaaja.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Valesti formaaditud kellaaeg. Kasutage mõnda neist: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Valesti formaaditud kestvus. Kasutage mõnda neist: {format}\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" on sobimatu valik.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Kirjeid on rohkem kui {count} ... \"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Ootasin kirjete järjendit, kuid sain \\\"{input_type}\\\" - tüübi.\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Valik ei tohi olla määramata.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" on sobimatu valik.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Ühtegi faili ei esitatud.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Esitatud andmetes ei olnud faili. Kontrollige vormi kodeeringut.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Ei suutnud tuvastada failinime.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Esitatud fail oli tühi.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Veenduge, et failinimi oleks maksimaalselt {max_length} tähemärki pikk (praegu on {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Laadige üles kehtiv pildifail. Üles laetud fail ei olnud pilt või oli see katki.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Loetelu ei tohi olla määramata.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Ootasin kirjete sõnastikku, kuid sain \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Väärtus peab olema valiidne JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Otsing\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Järjestus\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"kasvav\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"kahanev\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Sobimatu lehekülg.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Sobimatu kursor\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Sobimatu primaarvõti \\\"{pk_value}\\\" - objekti pole olemas.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Sobimatu andmetüüp. Ootasin primaarvõtit, sain {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Sobimatu hüperlink - ei leidnud URLi vastet.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Sobimatu hüperlink - vale URLi vaste.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Sobimatu hüperlink - objekti ei eksisteeri.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Sobimatu andmetüüp. Ootasin URLi sõne, sain {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objekti {slug_name}={value} ei eksisteeri.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Sobimatu väärtus.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Sobimatud andmed. Ootasin sõnastikku, kuid sain {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtrid\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Puudub\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Pole midagi valida.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Selle välja väärtus peab olema unikaalne.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Veerud {field_names} peavad moodustama unikaalse hulga.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Selle välja väärtus peab olema unikaalne veerus \\\"{date_field}\\\" märgitud kuupäeval.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Selle välja väärtus peab olema unikaalneveerus \\\"{date_field}\\\" märgitud kuul.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Selle välja väärtus peab olema unikaalneveerus \\\"{date_field}\\\" märgitud aastal.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Sobimatu versioon \\\"Accept\\\" päises.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Sobimatu versioon URLi rajas.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Sobimatu versioon URLis - see ei vasta ühelegi teadaolevale.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Sobimatu versioon hostinimes.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Sobimatu versioon päringu parameetris.\"\n"
  },
  {
    "path": "rest_framework/locale/fa/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Ali Mahdiyar <alimahdiyar77@gmail.com>, 2020\n# Aryan Baghi <ar.baghi.ce@gmail.com>, 2020\n# Omid Zarin <zarinpy@gmail.com>, 2019\n# Xavier Ordoquy <xordoquy@linovia.com>, 2020\n# Sina Amini <general.sina.amini.20@gmail.com>, 2024\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:58+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Persian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/fa/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: fa\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"هدر اولیه نامعتبر است. اطلاعات هویتی ارائه نشده است.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"هدر اولیه نامعتبر است. رشته ی اطلاعات هویتی نباید شامل فاصله باشد.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"هدر اولیه نامعتبر است. اطلاعات هویتی با متد base64 به درستی رمزنگاری نشده است.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"نام کاربری/رمز‌عبور نامعتبر است.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"کاربر غیر فعال یا حذف شده است.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"توکن هدر نامعتبر است. اطلاعات هویتی ارائه نشده است. \"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"توکن هدر نامعتبر است. توکن نباید شامل فضای خالی باشد.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"توکن هدر نامعتبر است. توکن شامل کاراکتر‌های نامعتبر است.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"توکن هدر نامعتبر است. \"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"توکن اعتبار‌سنجی\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"کلید\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"کاربر\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"ایجاد‌شد\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"توکن\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"توکن‌ها\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"نام‌کاربری\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"رمز‌عبور\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"با اطلاعات ارسال شده نمیتوان وارد شد.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"باید شامل نام‌کاربری و رمز‌عبود باشد.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"خطای سمت سرور رخ داده است.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"ورودی نامعتبر\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"درخواست ناقص.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"اطلاعات احراز هویت صحیح نیست.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"اطلاعات برای اعتبارسنجی ارسال نشده است.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"شما اجازه انجام این دستور را ندارید.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"یافت نشد.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"متد {method} مجاز نیست.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"نوع محتوای درخواستی در هدر قابل قبول نیست.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"نوع رسانه {media_type} در درخواست پشتیبانی نمیشود.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"تعداد درخواست‌های شما محدود شده است.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"انتظار می‌رود در {wait} ثانیه در دسترس باشد.\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"انتظار می‌رود در {wait} ثانیه در دسترس باشد.\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"این مقدار لازم است.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"این مقدار نباید توهی باشد.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"باید یک مقدار منطقی(بولی) معتبر باشد.\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"یک رشته معتبر نیست.\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"این مقدار نباید خالی باشد.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"مطمعن شوید طول این مقدار بیشتر از {max_length} نیست.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"مطمعن شوید طول این مقدار حداقل {min_length} است.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"پست الکترونیکی صحیح وارد کنید.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"مقدار وارد شده با الگو مطابقت ندارد.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"یک \\\"slug\\\" معتبر شامل حروف، اعداد، آندرلاین یا خط فاصله وارد کنید\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"یک URL معتبر وارد کنید\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"باید یک UUID معتبر باشد.\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"یک آدرس IPv4 یا IPv6 معتبر وارد کنید.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"یک مقدار عددی معتبر لازم است.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"این مقدار باید کوچکتر یا مساوی با {max_value} باشد.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"این مقدار باید بزرگتر یا مساوی با {min_value} باشد.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"رشته بسیار طولانی است.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"یک عدد معتبر نیاز است.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"بیشتر از {max_digits} رقم نباید وجود داشته باشد.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"بیشتر از {max_decimal_places} ممیز اعشار نباید وجود داشته باشد\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"بیشتر از {max_whole_digits} رقم نباید قبل از ممیز اعشار باشد.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"فرمت Datetime اشتباه است. از یکی از این فرمت ها استفاده کنید: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"باید datetime باشد اما date دریافت شد.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"تاریخ و زمان برای منطقه زمانی \\\"{timezone}\\\" نامعتبر است.\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"مقدار تاریخ و زمان خارج از محدوده است.\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"فرمت تاریخ اشتباه است. از یکی از این فرمت ها استفاده کنید: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"باید date باشد اما datetime دریافت شد.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"فرمت Time اشتباه است. از یکی از این فرمت ها استفاده کنید: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"فرمت Duration اشتباه است. از یکی از این فرمت ها استفاده کنید: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" یک انتخاب معتبر نیست.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"بیشتر از {count} آیتم...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"باید یک لیست از مقادیر ارسال شود اما یک «{input_type}» دریافت شد.\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"این بخش نمی‌تواند خالی باشد.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" یک مسیر انتخاب معتبر نیست.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"فایلی ارسال نشده است.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"دیتای ارسال شده فایل نیست. encoding type فرم را چک کنید.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"اسم فایل مشخص نیست.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"فایل ارسال شده خالی است.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"نام این فایل باید حداکثر {max_length} کاراکتر باشد ({length} کاراکتر دارد).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"یک عکس معتبر آپلود کنید. فایلی که ارسال کردید عکس یا عکس خراب شده نیست\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"این لیست نمی تواند خالی باشد\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"اطمینان حاصل کنید که این فیلد حداقل {min_length} عنصر دارد.\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"اطمینان حاصل کنید که این فیلد بیش از {max_length} عنصر ندارد.\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"باید دیکشنری از آیتم ها ارسال می شد، اما \\\"{input_type}\\\" ارسال شده است.\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"این دیکشنری نمی‌تواند خالی باشد.\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"مقدار باید JSON معتبر باشد.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"جستجو\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"یک عبارت جستجو.\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"ترتیب\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"کدام فیلد باید هنگام مرتب‌سازی نتایج استفاده شود.\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"صعودی\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"نزولی\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"یک شماره صفحه‌ در مجموعه نتایج صفحه‌بندی شده.\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"تعداد نتایج برای نمایش در هر صفحه.\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"صفحه نامعتبر\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"ایندکس اولیه‌ای که از آن نتایج بازگردانده می‌شود.\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"مقدار نشانگر صفحه‌بندی.\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"مکان نمای نامعتبر\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"pk نامعتبر \\\"{pk_value}\\\" - این Object وجود ندارد\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"تایپ نامعتبر. باید pk ارسال می شد اما {data_type} ارسال شده است.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"هایپرلینک نامعتبر - URL مطابق وجود ندارد\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"هایپرلینک نامعتبر - خطا در تطابق URL\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"هایپرلینک نامعبتر - Object وجود ندارد.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"داده نامعتبر. باید رشته ی URL باشد، اما {data_type} دریافت شد.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Object با {slug_name}={value} وجود ندارد.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"مقدار نامعتبر.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"مقداد عدد یکتا\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"رشته UUID\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"مقدار یکتا\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"یک {value_type} که این {name} را شناسایی میکند.\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"داده نامعتبر. باید دیکشنری ارسال می شد، اما {datatype} ارسال شده است.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"اقدامات اضافی\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"فیلترها\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"نوار ناوبری\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"محتوا\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"فرم درخواست\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"محتوای اصلی\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"اطلاعات درخواست\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"اطلاعات پاسخ\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"None\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"آیتمی برای انتخاب وجود ندارد\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"این فیلد باید یکتا باشد\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"فیلدهای {field_names} باید یک مجموعه یکتا باشند.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"کاراکترهای جایگزین مجاز نیستند: U+{code_point:X}.\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"این فیلد باید برای تاریخ \\\"{date_field}\\\" یکتا باشد.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"این فیلد باید برای ماه \\\"{date_field}\\\" یکتا باشد.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"این فیلد باید برای سال \\\"{date_field}\\\" یکتا باشد.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"ورژن نامعتبر در هدر \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"ورژن نامعتبر در مسیر URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"ورژن نامعتبر در مسیر URL. با هیچ نام گذاری ورژنی تطابق ندارد.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"نسخه نامعتبر در نام هاست\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"ورژن نامعتبر در پارامتر کوئری.\"\n"
  },
  {
    "path": "rest_framework/locale/fa_IR/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Ali Mahdiyar <alimahdiyar77@gmail.com>, 2020\n# Aryan Baghi <ar.baghi.ce@gmail.com>, 2020\n# Omid Zarin <zarinpy@gmail.com>, 2019\n# Xavier Ordoquy <xordoquy@linovia.com>, 2020\n# Sina Amini <general.sina.amini.20@gmail.com>, 2024\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:59+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Persian (Iran) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/fa_IR/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: fa_IR\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"هدر اولیه نامعتبر است. اطلاعات هویتی ارائه نشده است.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"هدر اولیه نامعتبر است. رشته ی اطلاعات هویتی نباید شامل فاصله باشد.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"هدر اولیه نامعتبر است. اطلاعات هویتی با متد base64 به درستی رمزنگاری نشده است.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"نام کاربری/رمز‌عبور نامعتبر است.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"کاربر غیر فعال یا حذف شده است.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"توکن هدر نامعتبر است. اطلاعات هویتی ارائه نشده است. \"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"توکن هدر نامعتبر است. توکن نباید شامل فضای خالی باشد.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"توکن هدر نامعتبر است. توکن شامل کاراکتر‌های نامعتبر است.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"توکن هدر نامعتبر است. \"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"توکن اعتبار‌سنجی\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"کلید\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"کاربر\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"ایجاد‌شد\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"توکن\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"توکن‌ها\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"نام‌کاربری\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"رمز‌عبور\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"با اطلاعات ارسال شده نمیتوان وارد شد.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"باید شامل نام‌کاربری و رمز‌عبود باشد.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"خطای سمت سرور رخ داده است.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"درخواست ناقص.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"اطلاعات احراز هویت صحیح نیست.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"اطلاعات برای اعتبارسنجی ارسال نشده است.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"شما اجازه انجام این دستور را ندارید.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"یافت نشد.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"متد {method} مجاز نیست.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"نوع محتوای درخواستی در هدر قابل قبول نیست.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"نوع رسانه {media_type} در درخواست پشتیبانی نمیشود.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"تعداد درخواست‌های شما محدود شده است.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"این مقدار لازم است.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"این مقدار نباید توهی باشد.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"این مقدار نباید خالی باشد.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"مطمعن شوید طول این مقدار بیشتر از {max_length} نیست.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"مطمعن شوید طول این مقدار حداقل {min_length} است.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"پست الکترونیکی صحیح وارد کنید.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"مقدار وارد شده با الگو مطابقت ندارد.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"یک \\\"slug\\\" معتبر شامل حروف، اعداد، آندرلاین یا خط فاصله وارد کنید\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"یک URL معتبر وارد کنید\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"یک آدرس IPv4 یا IPv6 معتبر وارد کنید.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"یک مقدار عددی معتبر لازم است.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"این مقدار باید کوچکتر یا مساوی با {max_value} باشد.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"این مقدار باید بزرگتر یا مساوی با {min_value} باشد.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"رشته بسیار طولانی است.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"یک عدد معتبر نیاز است.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"بیشتر از {max_digits} رقم نباید وجود داشته باشد.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"بیشتر از {max_decimal_places} ممیز اعشار نباید وجود داشته باشد\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"بیشتر از {max_whole_digits} رقم نباید قبل از ممیز اعشار باشد.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"فرمت Datetime اشتباه است. از یکی از این فرمت ها استفاده کنید: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"باید datetime باشد اما date دریافت شد.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"فرمت تاریخ اشتباه است. از یکی از این فرمت ها استفاده کنید: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"باید date باشد اما datetime دریافت شد.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"فرمت Time اشتباه است. از یکی از این فرمت ها استفاده کنید: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"فرمت Duration اشتباه است. از یکی از این فرمت ها استفاده کنید: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" یک انتخاب معتبر نیست.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"بیشتر از {count} آیتم...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"باید یک لیست از مقادیر ارسال شود اما یک «{input_type}» دریافت شد.\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"این بخش نمی‌تواند خالی باشد.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" یک مسیر انتخاب معتبر نیست.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"فایلی ارسال نشده است.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"دیتای ارسال شده فایل نیست. encoding type فرم را چک کنید.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"اسم فایل مشخص نیست.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"فایل ارسال شده خالی است.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"نام این فایل باید حداکثر {max_length} کاراکتر باشد ({length} کاراکتر دارد).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"یک عکس معتبر آپلود کنید. فایلی که ارسال کردید عکس یا عکس خراب شده نیست\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"این لیست نمی تواند خالی باشد\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"باید دیکشنری از آیتم ها ارسال می شد، اما \\\"{input_type}\\\" ارسال شده است.\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"مقدار باید JSON معتبر باشد.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"جستجو\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"ترتیب\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"صعودی\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"نزولی\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"صفحه نامعتبر\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"مکان نمای نامعتبر\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"pk نامعتبر \\\"{pk_value}\\\" - این Object وجود ندارد\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"تایپ نامعتبر. باید pk ارسال می شد اما {data_type} ارسال شده است.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"هایپرلینک نامعتبر - URL مطابق وجود ندارد\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"هایپرلینک نامعتبر - خطا در تطابق URL\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"هایپرلینک نامعبتر - Object وجود ندارد.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"داده نامعتبر. باید رشته ی URL باشد، اما {data_type} دریافت شد.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Object با {slug_name}={value} وجود ندارد.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"مقدار نامعتبر.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"داده نامعتبر. باید دیکشنری ارسال می شد، اما {datatype} ارسال شده است.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"فیلترها\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"None\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"آیتمی برای انتخاب وجود ندارد\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"این فیلد باید یکتا باشد\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"فیلدهای {field_names} باید یک مجموعه یکتا باشند.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"این فیلد باید برای تاریخ \\\"{date_field}\\\" یکتا باشد.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"این فیلد باید برای ماه \\\"{date_field}\\\" یکتا باشد.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"این فیلد باید برای سال \\\"{date_field}\\\" یکتا باشد.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"ورژن نامعتبر در هدر \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"ورژن نامعتبر در مسیر URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"ورژن نامعتبر در مسیر URL. با هیچ نام گذاری ورژنی تطابق ندارد.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"نسخه نامعتبر در نام هاست\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"ورژن نامعتبر در پارامتر کوئری.\"\n"
  },
  {
    "path": "rest_framework/locale/fi/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Aarni Koskela, 2015\n# Aarni Koskela, 2015-2016\n# Kimmo Huoman <kipenroskaposti+transifex@gmail.com>, 2020\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Finnish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/fi/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: fi\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Epäkelpo \\\"basic\\\" -otsake. Ei annettuja tunnuksia.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Epäkelpo \\\"basic\\\" -otsake. Tunnusmerkkijono ei saa sisältää välilyöntejä.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Epäkelpo \\\"basic\\\" -otsake. Tunnukset eivät ole base64-koodattu.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Epäkelpo käyttäjänimi tai salasana.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Käyttäjä ei-aktiivinen tai poistettu.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Epäkelpo \\\"token\\\" -otsake. Ei annettuja tunnuksia.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Epäkelpo \\\"token\\\" -otsake. Tunnusmerkkijono ei saa sisältää välilyöntejä.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Epäkelpo \\\"token\\\" -otsake. Tunnusmerkkijono ei saa sisältää epäkelpoja merkkejä.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Epäkelpo token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Autentikaatiotunniste\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Avain\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Käyttäjä\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Luotu\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Tunniste\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tunnisteet\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Käyttäjänimi\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Salasana\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Kirjautuminen epäonnistui annetuilla tunnuksilla.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Pitää sisältää \\\"username\\\" ja \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Sattui palvelinvirhe.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Pyyntö on virheellisen muotoinen.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Väärät autentikaatiotunnukset.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Autentikaatiotunnuksia ei annettu.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Sinulla ei ole oikeutta suorittaa tätä toimintoa.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Ei löydy.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metodi \\\"{method}\\\" ei ole sallittu.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Ei voitu vastata pyynnön Accept-otsakkeen mukaisesti.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Pyynnön mediatyyppiä \\\"{media_type}\\\" ei tueta.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Pyyntö hidastettu.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Tämä kenttä vaaditaan.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Tämän kentän arvo ei voi olla \\\"null\\\".\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Tämä kenttä ei voi olla tyhjä.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Arvo saa olla enintään {max_length} merkkiä pitkä.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Arvo tulee olla vähintään {min_length} merkkiä pitkä.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Syötä kelvollinen sähköpostiosoite.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Arvo ei täsmää vaadittuun kuvioon.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Tässä voidaan käyttää vain kirjaimia (a-z), numeroita (0-9) sekä ala- ja tavuviivoja (_ -).\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Syötä oikea URL-osoite.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Syötä kelvollinen IPv4- tai IPv6-osoite.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Syötä kelvollinen kokonaisluku.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Tämän arvon on oltava pienempi tai yhtä suuri kuin {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Tämän luvun on oltava suurempi tai yhtä suuri kuin {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Liian suuri merkkijonoarvo.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Kelvollinen luku vaaditaan.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Tässä luvussa voi olla yhteensä enintään {max_digits} numeroa.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Tässä luvussa voi olla enintään {max_decimal_places} desimaalia.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Tässä luvussa voi olla enintään {max_whole_digits} numeroa ennen desimaalipilkkua.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Virheellinen päivämäärän/ajan muotoilu. Käytä jotain näistä muodoista: {format}\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Odotettiin päivämäärää ja aikaa, saatiin vain päivämäärä.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Virheellinen päivämäärän muotoilu. Käytä jotain näistä muodoista: {format}\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Odotettiin päivämäärää, saatiin päivämäärä ja aika.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Virheellinen kellonajan muotoilu. Käytä jotain näistä muodoista: {format}\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Virheellinen keston muotoilu. Käytä jotain näistä muodoista: {format}\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" ei ole kelvollinen valinta.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Enemmän kuin {count} kappaletta...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Odotettiin listaa, saatiin tyyppi {input_type}.\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Valinta ei saa olla tyhjä.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" ei ole kelvollinen polku.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Yhtään tiedostoa ei ole lähetetty.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Tiedostoa ei lähetetty. Tarkista lomakkeen koodaus (encoding).\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Tiedostonimeä ei voitu päätellä.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Lähetetty tiedosto on tyhjä.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Varmista että tiedostonimi on enintään {max_length} merkkiä pitkä (nyt {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Kuva ei kelpaa. Lähettämäsi tiedosto ei ole kuva, tai tiedosto on vioittunut.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Lista ei saa olla tyhjä.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Odotettiin sanakirjaa, saatiin tyyppi {input_type}.\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Arvon pitää olla kelvollista JSONia.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Haku\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Järjestys\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"nouseva\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"laskeva\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Epäkelpo sivu.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Epäkelpo kursori\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Epäkelpo pääavain {pk_value} - objektia ei ole olemassa.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Väärä tyyppi. Odotettiin pääavainarvoa, saatiin {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Epäkelpo linkki - URL ei täsmää.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Epäkelpo linkki - epäkelpo URL-osuma.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Epäkelpo linkki - objektia ei ole.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Epäkelpo tyyppi. Odotettiin URL-merkkijonoa, saatiin {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objektia ({slug_name}={value}) ei ole.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Epäkelpo arvo.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Odotettiin sanakirjaa, saatiin tyyppi {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Suotimet\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Ei mitään\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Ei valittavia kohteita.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Arvon tulee olla uniikki.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Kenttien {field_names} tulee muodostaa uniikki joukko.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Kentän tulee olla uniikki päivämäärän {date_field} suhteen.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Kentän tulee olla uniikki kuukauden {date_field} suhteen.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Kentän tulee olla uniikki vuoden {date_field} suhteen.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Epäkelpo versio Accept-otsakkeessa.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Epäkelpo versio URL-polussa.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"URL-polun versio ei täsmää mihinkään versionimiavaruuteen.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Epäkelpo versio palvelinosoitteessa.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Epäkelpo versio kyselyparametrissa.\"\n"
  },
  {
    "path": "rest_framework/locale/fr/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n#\n# Translators:\n# Erwann Mest <m+transifex@kud.io>, 2019\n# Etienne Desgagné <etienne.desgagne@evimbec.ca>, 2015\n# Martin Maillard <martin.maillard@gmail.com>, 2015\n# Stéphane Raimbault <stephane.raimbault@gmail.com>, 2019\n# Xavier Ordoquy <xordoquy@linovia.com>, 2015-2016\n# Sébastien Corbin <seb.corbin@gmail.com>, 2025\n# Mathieu Dupuy <deronnax@gmail.com>, 2026\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2025-08-17 20:30+0200\\n\"\n\"Last-Translator: Mathieu Dupuy <deronnax@gmail.com>\\n\"\n\"Language-Team: French (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/fr/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: fr\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"En-tête « basic » non valide. Informations d'identification non fournies.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"En-tête « basic » non valide. Les informations d'identification ne doivent pas contenir d'espaces.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"En-tête « basic » non valide. Encodage base64 des informations d'identification incorrect.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Nom d'utilisateur et/ou mot de passe non valide(s).\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Utilisateur inactif ou supprimé.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"En-tête « token » non valide. Informations d'identification non fournies.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"En-tête « token » non valide. Un token ne doit pas contenir d'espaces.\"\n\n#: authentication.py:193\nmsgid \"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"En-tête « token » non valide. Un token ne doit pas contenir de caractères invalides.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Token non valide.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Jeton d'authentification\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Clef\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Utilisateur\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Création\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Jeton\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Jetons\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Nom de l'utilisateur\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Mot de passe\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Impossible de se connecter avec les informations d'identification fournies.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"« username » et « password » doivent être inclus.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Une erreur du serveur est survenue.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"Saisie invalide.\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Requête malformée.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Informations d'authentification incorrectes.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Informations d'authentification non fournies.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Vous n'avez pas la permission d'effectuer cette action.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Non trouvé.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Méthode « {method} » non autorisée.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"L'en-tête « Accept » n'a pas pu être satisfaite.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Type de média « {media_type} » non supporté.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Requête ralentie.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"Disponible à nouveau dans {wait} seconde.\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"Disponible à nouveau dans {wait} secondes.\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Ce champ est obligatoire.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Ce champ ne peut être nul.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"Doit être un booléen valide.\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"Chaîne de caractère invalide.\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Ce champ ne peut être vide.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Assurez-vous que ce champ comporte au plus {max_length} caractères.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Assurez-vous que ce champ comporte au moins {min_length} caractères.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Saisissez une adresse e-mail valide.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Cette valeur ne satisfait pas le motif imposé.\"\n\n#: fields.py:838\nmsgid \"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or hyphens.\"\nmsgstr \"Ce champ ne doit contenir que des lettres, des nombres, des tirets bas _ et des traits d'union.\"\n\n#: fields.py:839\nmsgid \"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, or hyphens.\"\nmsgstr \"Ce champ ne doit contenir que des lettres Unicode, des nombres, des tirets bas _ et des traits d'union.\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Saisissez une URL valide.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"Doit être un UUID valide.\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Saisissez une adresse IPv4 ou IPv6 valide.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Un nombre entier valide est requis.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Assurez-vous que cette valeur est inférieure ou égale à {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Assurez-vous que cette valeur est supérieure ou égale à {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Chaîne de caractères trop longue.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Un nombre valide est requis.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Assurez-vous qu'il n'y a pas plus de {max_digits} chiffres au total.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Assurez-vous qu'il n'y a pas plus de {max_decimal_places} chiffres après la virgule.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_whole_digits} digits before the decimal point.\"\nmsgstr \"Assurez-vous qu'il n'y a pas plus de {max_whole_digits} chiffres avant la virgule.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"La date + heure n'a pas le bon format. Utilisez un des formats suivants : {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Attendait une date + heure mais a reçu une date.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"Date et heure non valides pour le fuseau horaire \\\"{timezone}\\\".\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"Valeur de date et heure hors de l'intervalle.\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"La date n'a pas le bon format. Utilisez un des formats suivants : {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Attendait une date mais a reçu une date + heure.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"L'heure n'a pas le bon format. Utilisez un des formats suivants : {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"La durée n'a pas le bon format. Utilisez l'un des formats suivants : {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"« {input} » n'est pas un choix valide.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Plus de {count} éléments...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Attendait une liste d'éléments mais a reçu « {input_type} ».\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Cette sélection ne peut être vide.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"« {input} » n'est pas un choix de chemin valide.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Aucun fichier n'a été soumis.\"\n\n#: fields.py:1515\nmsgid \"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"La donnée soumise n'est pas un fichier. Vérifiez le type d'encodage du formulaire.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Le nom de fichier n'a pu être déterminé.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Le fichier soumis est vide.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Assurez-vous que le nom de fichier comporte au plus {max_length} caractères (il en comporte {length}).\"\n\n#: fields.py:1566\nmsgid \"Upload a valid image. The file you uploaded was either not an image or a corrupted image.\"\nmsgstr \"Transférez une image valide. Le fichier que vous avez transféré n'est pas une image, ou il est corrompu.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Cette liste ne peut pas être vide.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"Assurez-vous que ce champ a au moins {min_length} éléments.\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"Assurez-vous que ce champ n'a pas plus de {max_length} éléments.\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Attendait un dictionnaire d'éléments mais a reçu « {input_type} ».\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"Ce dictionnaire ne peut être vide.\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"La valeur doit être un JSON valide.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Recherche\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"Un terme de recherche.\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Ordre\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"Quel champ utiliser pour classer les résultats.\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"croissant\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"décroissant\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"Un numéro de page de l'ensemble des résultats.\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"Nombre de résultats à retourner par page.\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Page non valide.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"L'index initial depuis lequel retourner les résultats.\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"La valeur du curseur de pagination.\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Curseur non valide\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Clé primaire « {pk_value} » non valide - l'objet n'existe pas.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Type incorrect. Attendait une clé primaire, a reçu {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Lien non valide : pas d'URL correspondante.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Lien non valide : URL correspondante incorrecte.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Lien non valide : l'objet n'existe pas.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Type incorrect. Attendait une URL, a reçu {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"L'objet avec {slug_name}={value} n'existe pas.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Valeur non valide.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"valeur entière unique\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"Chaîne UUID\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"valeur unique\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"Un(une) {value_type} identifiant ce(cette) {name}.\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Donnée non valide. Attendait un dictionnaire, a reçu {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"Actions supplémentaires\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtres\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"barre de navigation\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"contenu\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"formulaire de requête\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"contenu principal\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"information de la requête\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"information de la réponse\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Aucune\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Aucun élément à sélectionner.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Ce champ doit être unique.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Les champs {field_names} doivent former un ensemble unique.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"Les caractères de substitution ne sont pas autorisés : U+{code_point:X}.\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Ce champ doit être unique pour la date « {date_field} ».\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Ce champ doit être unique pour le mois « {date_field} ».\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Ce champ doit être unique pour l'année « {date_field} ».\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Version non valide dans l'en-tête « Accept ».\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Version non valide dans l'URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Version invalide dans l'URL. Ne correspond à aucune version de l'espace de nommage.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Version non valide dans le nom d'hôte.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Version non valide dans le paramètre de requête.\"\n"
  },
  {
    "path": "rest_framework/locale/fr_CA/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: French (Canada) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/fr_CA/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: fr_CA\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/gl/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Galician (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/gl/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: gl\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/gl_ES/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Carlos Goce <carlosgoce@gmail.com>, 2015\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Galician (Spain) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/gl_ES/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: gl_ES\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"Valor non válido.\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"Ningún\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"Permiso denegado.\"\n"
  },
  {
    "path": "rest_framework/locale/he_IL/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Hebrew (Israel) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/he_IL/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: he_IL\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/hu/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Zoltan Szalai <defaultdict@gmail.com>, 2015,2018-2019\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Hungarian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/hu/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: hu\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Érvénytelen basic fejléc. Nem voltak megadva azonosítók.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Érvénytelen basic fejléc. Az azonosító karakterlánc nem tartalmazhat szóközöket.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Érvénytelen basic fejléc. Az azonosítók base64 kódolása nem megfelelő.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Érvénytelen felhasználónév/jelszó.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"A felhasználó nincs aktiválva vagy törölve lett.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Érvénytelen token fejléc. Nem voltak megadva azonosítók.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Érvénytelen token fejléc. A token karakterlánc nem tartalmazhat szóközöket.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Érvénytelen token fejléc. A token karakterlánc nem tartalmazhat érvénytelen karaktereket.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Érvénytelen token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Auth token\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Kulcs\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Felhasználó\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Létrehozva\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokenek\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Felhasználónév\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Jelszó\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"A megadott azonosítókkal nem lehet bejelentkezni.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Tartalmaznia kell a \\\"felhasználónevet\\\" és a \\\"jelszót\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Szerver oldali hiba történt.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Hibás kérés.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Hibás azonosítók.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Nem voltak megadva azonosítók.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Nincs jogosultsága a művelet végrehajtásához.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Nem található.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"A \\\"{method}\\\" metódus nem megengedett.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"A kérés Accept fejlécét nem lehetett teljesíteni.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Nem támogatott média típus \\\"{media_type}\\\" a kérésben.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"A kérés korlátozva lett.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Ennek a mezőnek a megadása kötelező.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Ez a mező nem lehet null értékű.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Ez a mező nem lehet üres.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Bizonyosodjon meg arról, hogy ez a mező legfeljebb {max_length} karakterből áll.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Bizonyosodjon meg arról, hogy ez a mező legalább {min_length} karakterből áll.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Adjon meg egy érvényes e-mail címet!\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Ez az érték nem illeszkedik a szükséges mintázatra.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Az URL barát cím csak betűket, számokat, aláhúzásokat és kötőjeleket tartalmazhat.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Adjon meg egy érvényes URL-t!\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Adjon meg egy érvényes IPv4 vagy IPv6 címet!\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Egy érvényes egész szám megadása szükséges.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Bizonyosodjon meg arról, hogy ez az érték legfeljebb {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Bizonyosodjon meg arról, hogy ez az érték legalább {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"A karakterlánc túl hosszú.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Egy érvényes szám megadása szükséges.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Bizonyosodjon meg arról, hogy a számjegyek száma összesen legfeljebb {max_digits}.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Bizonyosodjon meg arról, hogy a tizedes tört törtrészében levő számjegyek száma összesen legfeljebb {max_decimal_places}.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Bizonyosodjon meg arról, hogy a tizedes tört egész részében levő számjegyek száma összesen legfeljebb {max_whole_digits}.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"A dátum formátuma hibás. Használja ezek valamelyikét helyette: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Időt is tartalmazó dátum helyett egy időt nem tartalmazó dátum lett elküldve.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"A dátum formátuma hibás. Használja ezek valamelyikét helyette: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Időt nem tartalmazó dátum helyett egy időt is tartalmazó dátum lett elküldve.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Az idő formátuma hibás. Használja ezek valamelyikét helyette: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Az időtartam formátuma hibás. Használja ezek valamelyikét helyette: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"Érvénytelen választási lehetőség: \\\"{input}\\\"\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Több, mint {count} elem  ...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Elemek listája helyett \\\"{input_type}\\\" lett elküldve.\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Választania kell egy elemet.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"Érvénytelen választási lehetőség: \\\"{input}\\\"\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Semmilyen fájl sem került feltöltésre.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Az elküldött adat nem egy fájl volt. Ellenőrizze a kódolás típusát az űrlapon!\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"A fájlnév nem megállapítható.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"A küldött fájl üres.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Bizonyosodjon meg arról, hogy a fájlnév legfeljebb {max_length} karakterből áll (jelenlegi hossza: {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Töltsön fel egy érvényes képfájlt! A feltöltött fájl nem kép volt, vagy megsérült.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Nem lehet üres a lista.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Dictionary elemek helyett \\\"{input_type}\\\" lett megadva.\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Az értéknek érvényes JSON-nek lennie.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Keresés\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Rendezés\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"növekvő\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"csökkenő\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Érvénytelen oldal.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Érvénytelen kurzor\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Érvénytelen pk \\\"{pk_value}\\\" - az objektum nem létezik.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Helytelen típus. pk érték helyett {data_type} lett elküldve.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Érvénytelen link - Nem illeszkedő URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Érvénytelen link. - Eltérő URL illeszkedés.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Érvénytelen link - Az objektum nem létezik.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Helytelen típus. URL karakterlánc helyett {data_type} lett elküldve.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Nem létezik olyan objektum, amelynél {slug_name}={value}.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Érvénytelen érték.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Érvénytelen adat. Egy dictionary helyett {datatype} lett elküldve.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Szűrők\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Semmi\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Nincsenek kiválasztható elemek.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Ennek a mezőnek egyedinek kell lennie.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"A {field_names} mezőnevek nem tartalmazhatnak duplikátumot.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"A mezőnek egyedinek kell lennie a \\\"{date_field}\\\" dátumra.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"A mezőnek egyedinek kell lennie a \\\"{date_field}\\\" hónapra.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"A mezőnek egyedinek kell lennie a \\\"{date_field}\\\" évre.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Érvénytelen verzió az \\\"Accept\\\" fejlécben.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Érvénytelen verzió az URL elérési útban.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Érvénytelen verzió az URL elérési útban. Nem illeszkedik egyetlen verzió névtérre sem.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Érvénytelen verzió a hosztnévben.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Érvénytelen verzió a lekérdezési paraméterben.\"\n"
  },
  {
    "path": "rest_framework/locale/hy/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Arnak Melikyan <arnak@melikyan.am>, 2019\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Armenian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/hy/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: hy\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Անվավեր վերնագիր: Նույնականացման տվյալները տրամադրված չեն:\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Անվավեր վերնագիր: Նույնականացման տողը չպետք է պարունակի բացատներ:\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Անվավեր վերնագիր: Նույնականացման տվյալները սխալ են ձեւակերպված base64-ում:\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Անվավեր օգտանուն / գաղտնաբառ:\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Օգտատերը ջնջված է կամ ոչ ակտիվ:\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Անվավեր տոկենի վերնագիր: Նույնականացման տվյալները տրամադրված չեն:\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Անվավեր տոկենի վերնագիր: Տոկենի տողը չպետք է պարունակի բացատներ:\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Անվավեր տոկենի վերնագիր: Տոկենի տողը չպետք է պարունակի անթույլատրելի նիշեր:\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Անվավեր տոկեն։\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Վավերացման Տոկեն։\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Բանալի\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Օգտատեր\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Ստեղծված է\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Տոկեն\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Տոկեններ\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Օգտանուն\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Գաղտնաբառ\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Անհնար է մուտք գործել տրամադրված նույնականացման տվյալներով:\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Պետք է ներառի «օգտանուն» եւ «գաղտնաբառ»:\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Տեղի ունեցել սերվերի սխալ:\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Սխալ հարցում:\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Սխալ նույնականացման տվյալներ։\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Նույնականացման տվյալները տրամադրված չեն:\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Այս գործողությունը կատարելու թույլտվություն չունեք:\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Չի գտնվել։\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\\\"{method}\\\" մեթոդը թույլատրված չէ:\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Չհաջողվեց բավարարել հարցման Ընդունել վերնագիրը:\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Անհամապատասխան մեդիա տիպ \\\"{media_type}\\\":\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Հարցումն ընդհատվել է:\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Այս դաշտը պարտադիր է:\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Այս դաշտը չի կարող զրոյական լինել:\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Այս դաշտը չի կարող դատարկ լինել:\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Համոզվեք, որ այս դաշտը լինի ոչ ավել, քան {max_length} նիշ:\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Համոզվեք, որ այս դաշտը ունի առնվազն {min_length} նիշ:\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Մուտքագրեք վավեր էլ.փոստի հասցե:\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Այս արժեքը չի համապատասխանում պահանջվող օրինակին:\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Մուտքագրեք վավեր \\\"slug\\\", որը բաղկացած է տառերից, թվերից, ընդգծումից կամ դեֆիսից:\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Մուտքագրեք վավեր հղում:\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Մուտքագրեք վավեր IPv4 կամ IPv6 հասցե:\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Պահանջվում է լիարժեք ամբողջական թիվ:\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Համոզվեք, որ արժեքը փոքր է կամ հավասար {max_value} -ին։\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Համոզվեք, որ արժեքը մեծ է կամ հավասար {min_value} -ին։\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Տողը ունի չափազանց մեծ արժեք:\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Պահանջվում է վավեր համար:\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Համոզվեք, որ {max_digits} -ից ավել թվանշան չկա:\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Համոզվեք, որ {max_decimal_places} -ից ավել տասնորդական նշան չկա:\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Համոզվեք, որ տասնորդական կետից առաջ չկա {max_whole_digits} -ից ավել թվանշան:\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datetime -ը սխալ ձեւաչափ ունի: Փոխարենը օգտագործեք այս ձեւաչափերից մեկը. {format} ։\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Ակնկալվում է օրվա ժամը, սակայն ամսաթիվ է ստացել:\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Ամսաթիվն ունի սխալ ձեւաչափ: Փոխարենը օգտագործեք այս ձեւաչափերից մեկը. {format} ։\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Ակնկալվում է ամսաթիվ, սակայն ստացել է օրվա ժամը:\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Ժամանակը սխալ ձեւաչափ ունի: Փոխարենը օգտագործեք այս ձեւաչափերից մեկը. {format} ։\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Տեւողությունը սխալ ձեւաչափ ունի: Փոխարենը օգտագործեք այս ձեւաչափերից մեկը. {format} ։\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" -ը վավեր ընտրություն չէ:\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Ավելի քան {count} առարկա...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Ակնկալվում է տարրերի ցանկ, բայց ստացել է \\\"{input_type}\\\" -ի տիպ:\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Այս ընտրությունը չի կարող դատարկ լինել:\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" -ը վավեր ճանապարհի ընտրություն չէ:\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Ոչ մի ֆայլ չի ուղարկվել:\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Ուղարկված տվյալը ֆայլ չէ: Ստուգեք կոդավորման տիպը:\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Ֆայլի անունը հնարավոր չէ որոշվել:\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Ուղարկված ֆայլը դատարկ է:\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Համոզվեք, որ այս ֆայլի անունը ունի առավելագույնը {max_length} նիշ, (այն ունի {length})։\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Վերբեռնեք վավեր նկար: Ձեր բեռնած ֆայլը կամ նկար չէ կամ վնասված նկար է:\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Այս ցանկը չի կարող դատարկ լինել:\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Ակնկալվում է տարրերի բառարան, բայց ստացել է \\\"{input_type}\\\" տիպ։\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Արժեքը պետք է լինի JSON:\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Որոնում\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Պատվիրել\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"աճման կարգով\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"նվազման կարգով\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Անվավեր էջ:\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Սխալ կուրսոր\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Անվավեր pk \\\"{pk_value}\\\" օբյեկտը գոյություն չունի:\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Անհայտ տիպ: Ակնկալվում է pk արժեք, ստացված է {data_type}։\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Անվավեր հղում - Ոչ մի հղման համընկնում:\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Անվավեր հղում - սխալ հղման համընկնում:\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Անվավեր հղում - տվյալ օբյեկտը գոյություն չունի:\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Անվավեր տիպ: Սպասվում է հղման տողը, ստացել է {data_type}։\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"{slug_name}={value} տվյալ պարունակությամբ օբյեկտ գոյություն չունի:\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Անվավեր արժեք:\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Անվավեր տվյալներ: Սպասվում է բառարան, բայց ստացվել է {datatype}։\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Ֆիլտրեր\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Ոչ մեկը\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Ոչ մի տարր ընտրված չէ։\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Այս դաշտը պետք է լինի եզակի:\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"{field_names} դաշտերը պետք է կազմեն եզակի հավաքածու:\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Այս դաշտը պետք է եզակի լինի \\\"{date_field}\\\" ամսաթվի համար:\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Այս դաշտը պետք է եզակի լինի \\\"{date_field}\\\" ամսվա համար:\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Այս դաշտը պետք է եզակի լինի \\\"{date_field}\\\" տարվա համար:\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\\\"Accept\\\" վերնագրի անվավեր տարբերակ:\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Անվավեր տարբերակ հղման ճանապարհի մեջ:\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Անվավեր տարբերակ հղման ճանապարհի մեջ: Չի համապատասխանում որեւէ անվանման տարբերակի:\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Անվավեր տարբերակ անվանման մեջ:\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Անվավեր տարբերակ `հարցման պարամետրում:\"\n"
  },
  {
    "path": "rest_framework/locale/id/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Aldiantoro Nugroho <kriwil@gmail.com>, 2017\n# aslam hadi <aslamhadi@gmail.com>, 2017\n# Joseph Aditya P G, 2019\n# Xavier Ordoquy <xordoquy@linovia.com>, 2020\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 20:03+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Indonesian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/id/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: id\\n\"\n\"Plural-Forms: nplurals=1; plural=0;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Nama pengguna atau kata sandi salah.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Pengguna tidak akfif atau telah dihapus.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Token Autentikasi\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Pengguna\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Token\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Nama pengguna\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Kata sandi\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Tidak dapat masuk dengan data pengguna ini.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Nama pengguna dan password harus diisi.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Terjadi galat di server.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Data autentikasi salah.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Data autentikasi tidak diberikan.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Anda tidak memiliki izin untuk melakukan tindakan ini.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Data tidak ditemukan.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Permintaan dengan header Accept ini tidak dapat dipenuhi.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Jenis media \\\"{media_type}\\\" dalam permintaan ini tidak didukung.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Permintaan ini telah dibatasi.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Bidang ini harus diisi.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Bidang ini tidak boleh diisi dengan \\\"null\\\".\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Bidang ini tidak boleh kosong.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Isi bidang ini tidak boleh melebihi {max_length} karakter.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Isi bidang ini minimal {min_length} karakter.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Masukkan alamat email dengan format yang benar.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Karakter \\\"slug\\\" hanya dapat terdiri dari huruf, angka, underscore dan tanda hubung.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Masukkan URL dengan format yang benar.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Masukkan alamat IPv4 atau IPv6 dengan format yang benar.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Nilai bidang ini harus berupa bilangan bulat.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Isi bidang ini harus kurang atau sama dengan {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Isi bidang ini harus lebih atau sama dengan {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Panjang angka tidak boleh lebih dari {max_digits}.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Panjang angka di belakang koma tidak boleh lebih dari {max_decimal_places}.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Panjang angka bulat tidak boleh lebih dari {max_whole_digits}.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Format tanggal dan waktu salah. Gunakan salah satu format berikut: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Format tanggal salah. Gunakan salah satu format berikut: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Format waktu salah. Gunakan salah satu format berikut: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Format durasi salah. Gunakan salah satu format berikut: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" tidak ada dalam daftar pilihan.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Pilihan tidak boleh kosong.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Pilih berkas terlebih dahulu.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Berkas kosong.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Panjang nama berkas tidak boleh lebih dari {max_length}. Panjang nama berkas ini {length} karakter.\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Isi bidang ini harus berupa dictionary, bukan \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Isi bidang ini harus berupa JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Objek dengan primary key \\\"{pk_value}\\\" tidak ditemukan.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/it/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Antonio Mancina <antomicx@gmail.com>, 2015\n# Marco Ventura, 2019\n# Mattia Procopio <promat85@gmail.com>, 2015\n# Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>, 2019\n# Sergio Morstabilini <mosta.pb@gmail.com>, 2015\n# Xavier Ordoquy <xordoquy@linovia.com>, 2015\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Italian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/it/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: it\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Header di base invalido. Credenziali non fornite.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Header di base invalido. Le credenziali non dovrebbero contenere spazi.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Credenziali non correttamente codificate in base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Nome utente/password non validi\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Utente inattivo o eliminato.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Header del token non valido. Credenziali non fornite.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Header del token non valido. Il contenuto del token non dovrebbe contenere spazi.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Header del token invalido. La stringa del token non dovrebbe contenere caratteri illegali.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Token invalido.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Auth Token\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Key\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"User\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Creato\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"I Token\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Username\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Password\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Impossibile eseguire il login con le credenziali immesse.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Deve includere \\\"nome utente\\\" e \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Errore del server.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Richiesta malformata.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Credenziali di autenticazione incorrette.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Non sono state immesse le credenziali di autenticazione.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Non hai l'autorizzazione per eseguire questa azione.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Non trovato.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metodo \\\"{method}\\\" non consentito\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Impossibile soddisfare l'header \\\"Accept\\\" presente nella richiesta.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Tipo di media \\\"{media_type}\\\"non supportato.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"La richiesta è stata limitata (throttled).\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Campo obbligatorio.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Il campo non può essere nullo.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Questo campo non può essere omesso.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Assicurati che questo campo non abbia più di {max_length} caratteri.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Assicurati che questo campo abbia almeno {min_length} caratteri.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Inserisci un indirizzo email valido.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Questo valore non corrisponde alla sequenza richiesta.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Immetti uno \\\"slug\\\" valido che consista di lettere, numeri, underscore o trattini.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Inserisci un URL valido\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Inserisci un indirizzo IPv4 o IPv6 valido.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"È richiesto un numero intero valido.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Assicurati che il valore sia minore o uguale a {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Assicurati che il valore sia maggiore o uguale a {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Stringa troppo lunga.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"È richiesto un numero valido.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Assicurati che non ci siano più di {max_digits} cifre in totale.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Assicurati che non ci siano più di {max_decimal_places} cifre decimali.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Assicurati che non ci siano più di {max_whole_digits} cifre prima del separatore decimale.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"L'oggetto di tipo datetime è in un formato errato. Usa uno dei seguenti formati: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Atteso un oggetto di tipo datetime ma l'oggetto ricevuto è di tipo date.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"La data è in un formato errato. Usa uno dei seguenti formati: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Atteso un oggetto di tipo date ma l'oggetto ricevuto è di tipo datetime.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"L'orario ha un formato errato. Usa uno dei seguenti formati: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"La durata è in un formato errato. Usa uno dei seguenti formati: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" non è una scelta valida.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Più di {count} oggetti...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Attesa una lista di oggetti ma l'oggetto ricevuto è di tipo \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Questa selezione non può essere vuota.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" non è un percorso valido.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Non è stato inviato alcun file.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"I dati inviati non corrispondono ad un file. Si prega di controllare il tipo di codifica nel form.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Il nome del file non può essere determinato.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Il file inviato è vuoto.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Assicurati che il nome del file abbia, al più, {max_length} caratteri (attualmente ne ha {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Invia un'immagine valida. Il file che hai inviato non era un'immagine o era corrotto.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Questa lista non può essere vuota.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Era atteso un dizionario di oggetti ma il dato ricevuto è di tipo \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Il valore deve essere un JSON valido.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Cerca\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Ordinamento\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"ascendente\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"discendente\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Pagina non valida.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Cursore non valido\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Pk \\\"{pk_value}\\\" non valido - l'oggetto non esiste.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Tipo non corretto. Era atteso un valore pk, ma è stato ricevuto {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Collegamento non valido - Nessuna corrispondenza di URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Collegamento non valido - Corrispondenza di URL non corretta.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Collegamento non valido - L'oggetto non esiste.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Tipo non corretto. Era attesa una stringa URL, ma è stato ricevuto {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"L'oggetto con {slug_name}={value} non esiste.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Valore non valido.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Dati non validi. Era atteso un dizionario, ma si è ricevuto {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtri\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Nessuno\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Nessun elemento da selezionare.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Questo campo deve essere unico.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"I campi {field_names} devono costituire un insieme unico.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Questo campo deve essere unico per la data \\\"{date_field}\\\".\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Questo campo deve essere unico per il mese \\\"{date_field}\\\".\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Questo campo deve essere unico per l'anno \\\"{date_field}\\\".\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Versione non valida nell'header \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Versione non valida nella sequenza URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Versione non valida nell'URL path. Non corrisponde con nessun namespace di versione.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Versione non valida nel nome dell'host.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Versione non valida nel parametro della query.\"\n"
  },
  {
    "path": "rest_framework/locale/ja/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Hiroaki Nakamura <hnakamur@gmail.com>, 2016\n# Kouichi Nishizawa <kouichi.nishizawa@gmail.com>, 2017\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Japanese (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ja/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: ja\\n\"\n\"Plural-Forms: nplurals=1; plural=0;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"不正な基本ヘッダです。認証情報が含まれていません。\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"不正な基本ヘッダです。認証情報文字列に空白を含めてはいけません。\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"不正な基本ヘッダです。認証情報がBASE64で正しくエンコードされていません。\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"ユーザ名かパスワードが違います。\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"ユーザが無効か削除されています。\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"不正なトークンヘッダです。認証情報が含まれていません。\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"不正なトークンヘッダです。トークン文字列に空白を含めてはいけません。\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"不正なトークンヘッダです。トークン文字列に不正な文字を含めてはいけません。\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"不正なトークンです。\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"認証トークン\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"キー\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"ユーザ\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"作成された\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"トークン\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"トークン\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"ユーザ名\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"パスワード\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"提供された認証情報でログインできません。\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\\\"username\\\"と\\\"password\\\"を含まなければなりません。\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"サーバエラーが発生しました。\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"不正な形式のリクエストです。\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"認証情報が正しくありません。\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"認証情報が含まれていません。\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"このアクションを実行する権限がありません。\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"見つかりませんでした。\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"メソッド \\\"{method}\\\" は許されていません。\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"リクエストのAcceptヘッダを満たすことができませんでした。\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"リクエストのメディアタイプ \\\"{media_type}\\\" はサポートされていません。\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"リクエストの処理は絞られました。\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"この項目は必須です。\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"この項目はnullにできません。\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"この項目は空にできません。\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"この項目が{max_length}文字より長くならないようにしてください。\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"この項目は少なくとも{min_length}文字以上にしてください。\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"有効なメールアドレスを入力してください。\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"この値は所要のパターンにマッチしません。\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"文字、数字、アンダースコア、またはハイフンから成る有効な \\\"slug\\\" を入力してください。\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"有効なURLを入力してください。\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"有効なIPv4またはIPv6アドレスを入力してください。\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"有効な整数を入力してください。\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"この値は{max_value}以下にしてください。\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"この値は{min_value}以上にしてください。\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"文字列が長過ぎます。\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"有効な数値を入力してください。\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"合計で最大{max_digits}桁以下になるようにしてください。\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"小数点以下の桁数を{max_decimal_places}を超えないようにしてください。\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"整数部の桁数を{max_whole_digits}を超えないようにしてください。\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"日時の形式が違います。以下のどれかの形式にしてください: {format}。\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"日付ではなく日時を入力してください。\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"日付の形式が違います。以下のどれかの形式にしてください: {format}。\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"日時ではなく日付を入力してください。\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"時刻の形式が違います。以下のどれかの形式にしてください: {format}。\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"機関の形式が違います。以下のどれかの形式にしてください: {format}。\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\"は有効な選択肢ではありません。\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \" {count} 個より多い...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\\\"{input_type}\\\" 型のデータではなく項目のリストを入力してください。\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"空でない項目を選択してください。\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\"は有効なパスの選択肢ではありません。\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"ファイルが添付されていません。\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"添付されたデータはファイルではありません。フォームのエンコーディングタイプを確認してください。\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"ファイル名が取得できませんでした。\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"添付ファイルの中身が空でした。\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"ファイル名は最大{max_length}文字にしてください({length}文字でした)。\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"有効な画像をアップロードしてください。アップロードされたファイルは画像でないか壊れた画像です。\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"リストは空ではいけません。\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\\\"{input_type}\\\" 型のデータではなく項目の辞書を入力してください。\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"値は有効なJSONでなければなりません。\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"検索\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"順序\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"昇順\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"降順\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"不正なページです。\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"カーソルが不正です。\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"主キー \\\"{pk_value}\\\" は不正です - データが存在しません。\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"不正な型です。{data_type} 型ではなく主キーの値を入力してください。\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"ハイパーリンクが不正です - URLにマッチしません。\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"ハイパーリンクが不正です - 不正なURLにマッチします。\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"ハイパーリンクが不正です - リンク先が存在しません。\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"不正なデータ型です。{data_type} 型ではなくURL文字列を入力してください。\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"{slug_name}={value} のデータが存在しません。\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"不正な値です。\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"不正なデータです。{datatype} 型ではなく辞書を入力してください。\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"フィルタ\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"なし\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"選択する項目がありません。\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"この項目は一意でなければなりません。\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"項目 {field_names} は一意な組でなければなりません。\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"この項目は \\\"{date_field}\\\" の日に対して一意でなければなりません。\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"この項目は \\\"{date_field}\\\" の月に対して一意でなければなりません。\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"この項目は \\\"{date_field}\\\" の年に対して一意でなければなりません。\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\\\"Accept\\\" 内のバージョンが不正です。\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"URLパス内のバージョンが不正です。\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"不正なバージョンのURLのパスです。どのバージョンの名前空間にも一致しません。\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"ホスト名内のバージョンが不正です。\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"クエリパラメータ内のバージョンが不正です。\"\n"
  },
  {
    "path": "rest_framework/locale/kk/LC_MESSAGES/django.po",
    "content": "# This file is distributed under the same license as the Django REST framework package.\n# Translators:\n# Dulat Kushibayev <kushibayev@gmail.com>, 2025\n#\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2025-06-01 23:03+0300\\n\"\n\"PO-Revision-Date: 2025-06-01 20:03+0000\\n\"\n\"Last-Translator: Dulat Kushibayev <kushibayev@gmail.com>\\n\"\n\"Language-Team: \\n\"\n\"Language: kk\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Plural-Forms: nplurals=2; plural=(n!=1);\\n\"\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Негізгі тақырыптама дұрыс емес. Тіркелгі деректері берілмеген.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Негізгі тақырыптама дұрыс емес. Тіркелгі деректері бос орындарсыз болуы керек.\"\n\n#: authentication.py:84\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Негізгі тақырыптама дұрыс емес. Тіркелгі деректері base64 форматында дұрыс кодталмаған.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Қате пайдаланушы аты немесе құпиясөз.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Пайдаланушы өшірулі немесе жойылған.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Токен тақырыптамасы дұрыс емес. Тіркелгі деректері берілмеген.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Токен тақырыптамасы дұрыс емес. Токен жолында бос орын болмауы керек.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Токен тақырыптамасы дұрыс емес. Токен құрамында жарамсыз таңбалар болмауы керек.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Жарамсыз токен.\"\n\n#: authtoken/admin.py:28 authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Пайдаланушы аты\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Аутентификация токені\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Кілт\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Пайдаланушы\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Құрылған\"\n\n#: authtoken/models.py:27 authtoken/models.py:54 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Токен\"\n\n#: authtoken/models.py:28 authtoken/models.py:55\nmsgid \"Tokens\"\nmsgstr \"Токендер\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Құпиясөз\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Берілген тіркелгі деректерімен кіру мүмкін емес.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\\\"username\\\" мен \\\"password\\\" енгізілуі керек.\"\n\n#: exceptions.py:105\nmsgid \"A server error occurred.\"\nmsgstr \"Серверде қате орын алды.\"\n\n#: exceptions.py:145\nmsgid \"Invalid input.\"\nmsgstr \"Қате енгізу деректері.\"\n\n#: exceptions.py:166\nmsgid \"Malformed request.\"\nmsgstr \"Сұраныс дұрыс құрылмаған.\"\n\n#: exceptions.py:172\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Аутентификация деректері қате.\"\n\n#: exceptions.py:178\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Аутентификация деректері берілмеген.\"\n\n#: exceptions.py:184\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Бұл әрекетті орындауға рұқсатыңыз жоқ.\"\n\n#: exceptions.py:190\nmsgid \"Not found.\"\nmsgstr \"Табылмады.\"\n\n#: exceptions.py:196\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\\\"{method}\\\" әдісіне рұқсат етілмейді.\"\n\n#: exceptions.py:207\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Сұраныстағы Accept тақырыбын қанағаттандыру мүмкін емес.\"\n\n#: exceptions.py:217\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Сұраныстағы \\\"{media_type}\\\" медиа түрі қолдау көрсетілмейді.\"\n\n#: exceptions.py:228\nmsgid \"Request was throttled.\"\nmsgstr \"Сұраныс жиілігі шектелді.\"\n\n#: exceptions.py:229\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"{wait} секундтан кейін қайта қолжетімді болады.\"\n\n#: exceptions.py:230\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"{wait} секундтан кейін қайта қолжетімді болады.\"\n\n#: fields.py:292 relations.py:240 relations.py:276 validators.py:112\n#: validators.py:238\nmsgid \"This field is required.\"\nmsgstr \"Бұл мән міндетті.\"\n\n#: fields.py:293\nmsgid \"This field may not be null.\"\nmsgstr \"Бұл мән null болмауы керек.\"\n\n#: fields.py:661\nmsgid \"Must be a valid boolean.\"\nmsgstr \"Дұрыс логикалық мән болуы керек.\"\n\n#: fields.py:724\nmsgid \"Not a valid string.\"\nmsgstr \"Мәтін дұрыс емес.\"\n\n#: fields.py:725\nmsgid \"This field may not be blank.\"\nmsgstr \"Бұл мән бос болмауы керек.\"\n\n#: fields.py:726 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Бұл мән ең көбі {max_length} таңбадан аспауы керек.\"\n\n#: fields.py:727\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Бұл мән кемінде {min_length} таңба болуы керек.\"\n\n#: fields.py:774\nmsgid \"Enter a valid email address.\"\nmsgstr \"Дұрыс электрондық пошта енгізіңіз.\"\n\n#: fields.py:785\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Бұл мән қажетті үлгіге сәйкес келмейді.\"\n\n#: fields.py:796\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Әріптерден, сандардан, астын сызу және сызықшалардан тұратын дұрыс \\\"slug\\\" енгізіңіз.\"\n\n#: fields.py:797\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"Юникод әріптері, сандар, астын сызу және сызықшалардан тұратын дұрыс \\\"slug\\\" енгізіңіз.\"\n\n#: fields.py:812\nmsgid \"Enter a valid URL.\"\nmsgstr \"Дұрыс URL енгізіңіз.\"\n\n#: fields.py:825\nmsgid \"Must be a valid UUID.\"\nmsgstr \"Дұрыс UUID болуы керек.\"\n\n#: fields.py:861\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Дұрыс IPv4 немесе IPv6 адрес енгізіңіз.\"\n\n#: fields.py:889\nmsgid \"A valid integer is required.\"\nmsgstr \"Дұрыс бүтін сан енгізілуі қажет.\"\n\n#: fields.py:890 fields.py:927 fields.py:966 fields.py:1349\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Бұл мән {max_value} немесе одан аз болуы керек.\"\n\n#: fields.py:891 fields.py:928 fields.py:967 fields.py:1350\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Бұл мән кемінде {min_value} болуы керек.\"\n\n#: fields.py:892 fields.py:929 fields.py:971\nmsgid \"String value too large.\"\nmsgstr \"Жолдың мәні тым үлкен.\"\n\n#: fields.py:926 fields.py:965\nmsgid \"A valid number is required.\"\nmsgstr \"Дұрыс сан енгізілуі керек.\"\n\n#: fields.py:930\nmsgid \"Integer value too large to convert to float\"\nmsgstr \"Бүтін сан тым үлкен - қалқымалы санға айналдыру мүмкін емес.\"\n\n#: fields.py:968\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Барлығы {max_digits} саннан аспауы керек.\"\n\n#: fields.py:969\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Ондық бөлшектер саны ең көбі {max_decimal_places} болуы керек.\"\n\n#: fields.py:970\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Ондық нүктеге дейінгі сандар саны ең көбі {max_whole_digits} болуы керек.\"\n\n#: fields.py:1129\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datetime пішімі дұрыс емес. Осы пішімдердің бірін пайдаланыңыз: {format}.\"\n\n#: fields.py:1130\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Күтілгені - datetime, берілгені - date.\"\n\n#: fields.py:1131\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\\\"{timezone}\\\" уақыт белдеуі үшін күн мен уақыт дұрыс емес.\"\n\n#: fields.py:1132\nmsgid \"Datetime value out of range.\"\nmsgstr \"Datetime мәні рұқсат етілген ауқымнан тыс.\"\n\n#: fields.py:1219\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Date пішімі дұрыс емес. Осы пішімдердің бірін пайдаланыңыз: {format}.\"\n\n#: fields.py:1220\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Күтілгені - date, берілгені - datetime.\"\n\n#: fields.py:1286\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Уақыт пішімі дұрыс емес. Осы пішімдердің бірін пайдаланыңыз: {format}.\"\n\n#: fields.py:1348\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Ұзақтық пішімі дұрыс емес. Осы пішімдердің бірін пайдаланыңыз: {format}.\"\n\n#: fields.py:1351\n#, python-brace-format\nmsgid \"The number of days must be between {min_days} and {max_days}.\"\nmsgstr \"Күндер саны {min_days} бен {max_days} аралығында болуы керек.\"\n\n#: fields.py:1386 fields.py:1446\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" - дұрыс таңдау емес.\"\n\n#: fields.py:1389\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"{count} элементтен артық...\"\n\n#: fields.py:1447 fields.py:1596 relations.py:486 serializers.py:595\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Элементтер тізімі күтілді, бірақ \\\"{input_type}\\\" түрі берілген.\"\n\n#: fields.py:1448\nmsgid \"This selection may not be empty.\"\nmsgstr \"Бұл таңдау бос болмауы керек.\"\n\n#: fields.py:1487\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" - дұрыс жол таңдауы емес.\"\n\n#: fields.py:1507\nmsgid \"No file was submitted.\"\nmsgstr \"Файл жіберілмеді.\"\n\n#: fields.py:1508\nmsgid \"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Жіберілген деректер файл емес. Формадағы кодтау түрін тексеріңіз.\"\n\n#: fields.py:1509\nmsgid \"No filename could be determined.\"\nmsgstr \"Файл атауы анықталмады.\"\n\n#: fields.py:1510\nmsgid \"The submitted file is empty.\"\nmsgstr \"Жіберілген файл бос.\"\n\n#: fields.py:1511\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Файл атауы {max_length} таңбадан аспауы керек (қазір - {length}).\"\n\n#: fields.py:1559\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Дұрыс кескін жүктеңіз. Жүктелген файл кескін емес немесе бүлінген.\"\n\n#: fields.py:1597 relations.py:487 serializers.py:596\nmsgid \"This list may not be empty.\"\nmsgstr \"Бұл тізім бос болмауы керек.\"\n\n#: fields.py:1598 serializers.py:598\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"Бұл мәнде кемінде {min_length} элемент болуы керек.\"\n\n#: fields.py:1599 serializers.py:597\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"Бұл мәнде {max_length} элементтен көп болмауы керек.\"\n\n#: fields.py:1677\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Элементтер жиыны ретінде сөздік күтілді, бірақ \\\"{input_type}\\\" түрі берілген.\"\n\n#: fields.py:1678\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"Бұл сөздік бос болмауы керек.\"\n\n#: fields.py:1750\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Мән дұрыс JSON пішімінде болуы керек.\"\n\n#: filters.py:72 templates/rest_framework/filters/search.html:2\n#: templates/rest_framework/filters/search.html:8\nmsgid \"Search\"\nmsgstr \"Іздеу\"\n\n#: filters.py:73\nmsgid \"A search term.\"\nmsgstr \"Іздеу сөзі.\"\n\n#: filters.py:224 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Реттеу\"\n\n#: filters.py:225\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"Нәтижелерді реттеу үшін қай мән пайдалану керектігін көрсетеді.\"\n\n#: filters.py:341\nmsgid \"ascending\"\nmsgstr \"өсу ретімен\"\n\n#: filters.py:342\nmsgid \"descending\"\nmsgstr \"кему ретімен\"\n\n#: pagination.py:180\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"Беттелген нәтиже жиынындағы бет нөмірі.\"\n\n#: pagination.py:185 pagination.py:382 pagination.py:599\nmsgid \"Number of results to return per page.\"\nmsgstr \"Әр бетте қайтарылатын нәтиже саны.\"\n\n#: pagination.py:195\nmsgid \"Invalid page.\"\nmsgstr \"Қате бет нөмірі.\"\n\n#: pagination.py:384\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"Нәтижелер қайтарылатын бастапқы индекс.\"\n\n#: pagination.py:590\nmsgid \"The pagination cursor value.\"\nmsgstr \"Нәтижелерді беттеуге арналған курсор мәні.\"\n\n#: pagination.py:592\nmsgid \"Invalid cursor\"\nmsgstr \"Қате курсор\"\n\n#: relations.py:241\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Қате pk \\\"{pk_value}\\\" - нысан табылмады.\"\n\n#: relations.py:242\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Дерек түрі дұрыс емес. Күтілгені - pk мәні, берілгені - {data_type}.\"\n\n#: relations.py:277\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Қате гиперсілтеме - URL сәйкестігі жоқ.\"\n\n#: relations.py:278\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Қате гиперсілтеме - URL сәйкестігі дұрыс емес.\"\n\n#: relations.py:279\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Қате гиперсілтеме - нысан табылмады.\"\n\n#: relations.py:280\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Дерек түрі дұрыс емес. Күтілгені - URL жолы, берілгені - {data_type}\"\n\n#: relations.py:445\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"{slug_name}={value} параметрі бар нысан табылмады.\"\n\n#: relations.py:446\nmsgid \"Invalid value.\"\nmsgstr \"Қате мән.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"бірегей бүтін сан мәні\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"UUID жолы\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"бірегей мән\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"{name} нысанын анықтайтын {value_type}.\"\n\n#: serializers.py:342\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Деректер қате. Күтілгені - сөздік түрі, берілгені - {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"Қосымша әрекеттер\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Сүзгілер\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"навигация панелі\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"мазмұн\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"сұрау формасы\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"негізгі бөлім\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"сұрау ақпараты\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"жауап ақпараты\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Ешқайсысы\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Таңдайтын элементтер жоқ.\"\n\n#: validators.py:52\nmsgid \"This field must be unique.\"\nmsgstr \"Бұл енгізу жолы бірегей болуы керек.\"\n\n#: validators.py:111\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"{field_names} енгізу жолдары бірегей жинақ құрауы тиіс.\"\n\n#: validators.py:219\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"Суррогат таңбалар рұқсат етілмейді: U+{code_point:X}.\"\n\n#: validators.py:309\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\\\"{date_field}\\\" күніне бұл енгізу жолы бірегей болуы керек.\"\n\n#: validators.py:324\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\\\"{date_field}\\\" айына бұл енгізу жолы бірегей болуы керек.\"\n\n#: validators.py:337\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\\\"{date_field}\\\" жылына бұл енгізу жолы бірегей болуы керек.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\\\"Accept\\\" тақырыбында нұсқа дұрыс көрсетілмеген.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"URL жолында нұсқа қате көрсетілген.\"\n\n#: versioning.py:118\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"URL жолында нұсқа дұрыс көрсетілмеген. Ешбір нұсқа кеңістігімен сәйкес келмейді.\"\n\n#: versioning.py:150\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Хост атауында нұсқа қате көрсетілген.\"\n\n#: versioning.py:172\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Сұраныс параметрінде нұсқа қате көрсетілген.\"\n"
  },
  {
    "path": "rest_framework/locale/ko_KR/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n#\n# Translators:\n# JAEGYUN JUNG <twicegoddessana1229@gmail.com>, 2024\n# Hochul Kwak <rhkrghcjf@gmail.com>, 2018\n# GarakdongBigBoy <novelview9@gmail.com>, 2017\n# Joon Hwan 김준환 <xncbf12@gmail.com>, 2017\n# SUN CHOI <best2378@gmail.com>, 2015\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2024-10-22 16:13+0900\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: JAEGYUN JUNG <twicegoddessana1229@gmail.com>\\n\"\n\"Language: ko_KR\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Plural-Forms: nplurals=1; plural=0;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"기본 헤더가 유효하지 않습니다. 인증 데이터가 제공되지 않았습니다.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"기본 헤더가 유효하지 않습니다. 인증 데이터 문자열은 공백을 포함하지 않아야 합니다.\"\n\n#: authentication.py:84\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"기본 헤더가 유효하지 않습니다. 인증 데이터가 올바르게 base64 인코딩되지 않았습니다.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"아이디/비밀번호가 유효하지 않습니다.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"계정이 중지되었거나 삭제되었습니다.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"토큰 헤더가 유효하지 않습니다. 인증 데이터가 제공되지 않았습니다.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"토큰 헤더가 유효하지 않습니다. 토큰 문자열은 공백을 포함하지 않아야 합니다.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"토큰 헤더가 유효하지 않습니다. 토큰 문자열은 유효하지 않은 문자를 포함하지 않아야 합니다.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"토큰이 유효하지 않습니다.\"\n\n#: authtoken/admin.py:28 authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"사용자 이름\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"인증 토큰\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"키\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"사용자\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"생성일시\"\n\n#: authtoken/models.py:27 authtoken/models.py:54 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"토큰\"\n\n#: authtoken/models.py:28 authtoken/models.py:55\nmsgid \"Tokens\"\nmsgstr \"토큰(들)\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"비밀번호\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"제공된 인증 데이터로는 로그인할 수 없습니다.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\\\"아이디\\\"와 \\\"비밀번호\\\"를 포함해야 합니다.\"\n\n#: exceptions.py:105\nmsgid \"A server error occurred.\"\nmsgstr \"서버 장애가 발생했습니다.\"\n\n#: exceptions.py:145\nmsgid \"Invalid input.\"\nmsgstr \"유효하지 않은 입력입니다.\"\n\n#: exceptions.py:166\nmsgid \"Malformed request.\"\nmsgstr \"잘못된 요청입니다.\"\n\n#: exceptions.py:172\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"자격 인증 데이터가 올바르지 않습니다.\"\n\n#: exceptions.py:178\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"자격 인증 데이터가 제공되지 않았습니다.\"\n\n#: exceptions.py:184\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"이 작업을 수행할 권한이 없습니다.\"\n\n#: exceptions.py:190\nmsgid \"Not found.\"\nmsgstr \"찾을 수 없습니다.\"\n\n#: exceptions.py:196\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"메서드 \\\"{method}\\\"는 허용되지 않습니다.\"\n\n#: exceptions.py:207\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"요청 Accept 헤더를 만족시킬 수 없습니다.\"\n\n#: exceptions.py:217\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"요청된 \\\"{media_type}\\\"가 지원되지 않는 미디어 형태입니다.\"\n\n#: exceptions.py:228\nmsgid \"Request was throttled.\"\nmsgstr \"요청이 제한되었습니다.\"\n\n#: exceptions.py:229\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"{wait} 초 후에 사용 가능합니다.\"\n\n#: exceptions.py:230\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"{wait} 초 후에 사용 가능합니다.\"\n\n#: fields.py:292 relations.py:240 relations.py:276 validators.py:99\n#: validators.py:219\nmsgid \"This field is required.\"\nmsgstr \"이 필드는 필수 항목입니다.\"\n\n#: fields.py:293\nmsgid \"This field may not be null.\"\nmsgstr \"이 필드는 null일 수 없습니다.\"\n\n#: fields.py:661\nmsgid \"Must be a valid boolean.\"\nmsgstr \"유효한 불리언이어야 합니다.\"\n\n#: fields.py:724\nmsgid \"Not a valid string.\"\nmsgstr \"유효한 문자열이 아닙니다.\"\n\n#: fields.py:725\nmsgid \"This field may not be blank.\"\nmsgstr \"이 필드는 blank일 수 없습니다.\"\n\n#: fields.py:726 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"이 필드의 글자 수가 {max_length} 이하인지 확인하세요.\"\n\n#: fields.py:727\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"이 필드의 글자 수가 적어도 {min_length} 이상인지 확인하세요.\"\n\n#: fields.py:774\nmsgid \"Enter a valid email address.\"\nmsgstr \"유효한 이메일 주소를 입력하세요.\"\n\n#: fields.py:785\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"이 값은 요구되는 패턴과 일치하지 않습니다.\"\n\n#: fields.py:796\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"문자, 숫자, 밑줄( _ ) 또는 하이픈( - )으로 이루어진 유효한 \\\"slug\\\"를 입력하세요.\"\n\n#: fields.py:797\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"유니코드 문자, 숫자, 밑줄( _ ) 또는 하이픈( - )으로 이루어진 유효한 \\\"slug\\\"를 입력하세요.\"\n\n#: fields.py:812\nmsgid \"Enter a valid URL.\"\nmsgstr \"유효한 URL을 입력하세요.\"\n\n#: fields.py:825\nmsgid \"Must be a valid UUID.\"\nmsgstr \"유효한 UUID 이어야 합니다.\"\n\n#: fields.py:861\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"유효한 IPv4 또는 IPv6 주소를 입력하세요.\"\n\n#: fields.py:889\nmsgid \"A valid integer is required.\"\nmsgstr \"유효한 정수를 입력하세요.\"\n\n#: fields.py:890 fields.py:927 fields.py:966 fields.py:1349\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"이 값이 {max_value}보다 작거나 같은지 확인하세요.\"\n\n#: fields.py:891 fields.py:928 fields.py:967 fields.py:1350\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"이 값이 {min_value}보다 크거나 같은지 확인하세요.\"\n\n#: fields.py:892 fields.py:929 fields.py:971\nmsgid \"String value too large.\"\nmsgstr \"문자열 값이 너무 깁니다.\"\n\n#: fields.py:926 fields.py:965\nmsgid \"A valid number is required.\"\nmsgstr \"유효한 숫자를 입력하세요.\"\n\n#: fields.py:930\nmsgid \"Integer value too large to convert to float\"\nmsgstr \"정수 값이 너무 커서 부동 소수점으로 변환할 수 없습니다.\"\n\n#: fields.py:968\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"총 자릿수가 {max_digits}을(를) 초과하지 않는지 확인하세요.\"\n\n#: fields.py:969\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"소수점 이하 자릿수가 {max_decimal_places}을(를) 초과하지 않는지 확인하세요.\"\n\n#: fields.py:970\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"소수점 앞 자릿수가 {max_whole_digits}을(를) 초과하지 않는지 확인하세요.\"\n\n#: fields.py:1129\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datetime의 포멧이 잘못되었습니다. 이 형식들 중 한가지를 사용하세요: {format}.\"\n\n#: fields.py:1130\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"datatime이 예상되었지만 date를 받았습니다.\"\n\n#: fields.py:1131\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\\\"{timezone}\\\" 시간대에 대한 유효하지 않은 datetime 입니다.\"\n\n#: fields.py:1132\nmsgid \"Datetime value out of range.\"\nmsgstr \"Datetime 값이 범위를 벗어났습니다.\"\n\n#: fields.py:1219\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Date의 포멧이 잘못되었습니다. 이 형식들 중 한가지를 사용하세요: {format}.\"\n\n#: fields.py:1220\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"예상된 date 대신 datetime을 받았습니다.\"\n\n#: fields.py:1286\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Time의 포멧이 잘못되었습니다. 이 형식들 중 한가지를 사용하세요: {format}.\"\n\n#: fields.py:1348\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Duration의 포멧이 잘못되었습니다. 이 형식들 중 한가지를 사용하세요: {format}.\"\n\n#: fields.py:1351\n#, python-brace-format\nmsgid \"The number of days must be between {min_days} and {max_days}.\"\nmsgstr \"일수는 {min_days} 이상 {max_days} 이하이어야 합니다.\"\n\n#: fields.py:1386 fields.py:1446\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\"은 유효하지 않은 선택입니다.\"\n\n#: fields.py:1389\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"{count}개 이상의 아이템이 있습니다...\"\n\n#: fields.py:1447 fields.py:1596 relations.py:486 serializers.py:593\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"아이템 리스트가 예상되었으나 \\\"{input_type}\\\"를 받았습니다.\"\n\n#: fields.py:1448\nmsgid \"This selection may not be empty.\"\nmsgstr \"이 선택 항목은 비워 둘 수 없습니다.\"\n\n#: fields.py:1487\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\"은 유효하지 않은 경로 선택입니다.\"\n\n#: fields.py:1507\nmsgid \"No file was submitted.\"\nmsgstr \"파일이 제출되지 않았습니다.\"\n\n#: fields.py:1508\nmsgid \"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"제출된 데이터는 파일이 아닙니다. 제출된 서식의 인코딩 형식을 확인하세요.\"\n\n#: fields.py:1509\nmsgid \"No filename could be determined.\"\nmsgstr \"파일명을 알 수 없습니다.\"\n\n#: fields.py:1510\nmsgid \"The submitted file is empty.\"\nmsgstr \"제출한 파일이 비어있습니다.\"\n\n#: fields.py:1511\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"이 파일명의 글자수가 최대 {max_length}자를 넘지 않는지 확인하세요. (현재 {length}자입니다).\"\n\n#: fields.py:1559\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"유효한 이미지 파일을 업로드하세요. 업로드하신 파일은 이미지 파일이 아니거나 손상된 이미지 파일입니다.\"\n\n#: fields.py:1597 relations.py:487 serializers.py:594\nmsgid \"This list may not be empty.\"\nmsgstr \"이 리스트는 비워 둘 수 없습니다.\"\n\n#: fields.py:1598 serializers.py:596\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"이 필드가 최소 {min_length} 개의 요소를 가지는지 확인하세요.\"\n\n#: fields.py:1599 serializers.py:595\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"이 필드가 최대 {max_length} 개의 요소를 가지는지 확인하세요.\"\n\n#: fields.py:1677\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"아이템 딕셔너리가 예상되었으나 \\\"{input_type}\\\" 타입을 받았습니다.\"\n\n#: fields.py:1678\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"이 딕셔너리는 비어있을 수 없습니다.\"\n\n#: fields.py:1750\nmsgid \"Value must be valid JSON.\"\nmsgstr \"유효한 JSON 값이어야 합니다.\"\n\n#: filters.py:72 templates/rest_framework/filters/search.html:2\n#: templates/rest_framework/filters/search.html:8\nmsgid \"Search\"\nmsgstr \"검색\"\n\n#: filters.py:73\nmsgid \"A search term.\"\nmsgstr \"검색어.\"\n\n#: filters.py:224 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"순서\"\n\n#: filters.py:225\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"결과 정렬 시 사용할 필드.\"\n\n#: filters.py:341\nmsgid \"ascending\"\nmsgstr \"오름차순\"\n\n#: filters.py:342\nmsgid \"descending\"\nmsgstr \"내림차순\"\n\n#: pagination.py:180\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"페이지네이션된 결과 집합 내의 페이지 번호.\"\n\n#: pagination.py:185 pagination.py:382 pagination.py:599\nmsgid \"Number of results to return per page.\"\nmsgstr \"페이지당 반환할 결과 수.\"\n\n#: pagination.py:195\nmsgid \"Invalid page.\"\nmsgstr \"페이지가 유효하지 않습니다.\"\n\n#: pagination.py:384\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"결과를 반환할 초기 인덱스.\"\n\n#: pagination.py:590\nmsgid \"The pagination cursor value.\"\nmsgstr \"페이지네이션 커서 값.\"\n\n#: pagination.py:592\nmsgid \"Invalid cursor\"\nmsgstr \"커서가 유효하지 않습니다.\"\n\n#: relations.py:241\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"유효하지 않은 pk \\\"{pk_value}\\\" - 객체가 존재하지 않습니다.\"\n\n#: relations.py:242\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"잘못된 형식입니다. pk 값이 예상되었지만, {data_type}을(를) 받았습니다.\"\n\n#: relations.py:277\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"유효하지 않은 하이퍼링크 - 일치하는 URL이 없습니다.\"\n\n#: relations.py:278\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"유효하지 않은 하이퍼링크 - URL이 일치하지 않습니다.\"\n\n#: relations.py:279\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"유효하지 않은 하이퍼링크 - 객체가 존재하지 않습니다.\"\n\n#: relations.py:280\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"잘못된 형식입니다. URL 문자열을 예상했으나 {data_type}을 받았습니다.\"\n\n#: relations.py:445\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"{slug_name}={value} 객체가 존재하지 않습니다.\"\n\n#: relations.py:446\nmsgid \"Invalid value.\"\nmsgstr \"값이 유효하지 않습니다.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"고유한 정수 값\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"UUID 문자열\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"고유한 값\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"{name}을 식별하는 {value_type}.\"\n\n#: serializers.py:340\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"유효하지 않은 데이터. 딕셔너리(dictionary)대신 {datatype}를 받았습니다.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"추가 Action들\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"필터\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"네비게이션 바\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"콘텐츠\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"요청 폼\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"메인 콘텐츠\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"요청 정보\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"응답 정보\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"없음\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"선택할 아이템이 없습니다.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"이 필드는 반드시 고유해야 합니다.\"\n\n#: validators.py:98\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"필드 {field_names} 는 반드시 고유해야 합니다.\"\n\n#: validators.py:200\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"대체(surrogate) 문자는 허용되지 않습니다: U+{code_point:X}.\"\n\n#: validators.py:290\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"이 필드는 \\\"{date_field}\\\" 날짜에 대해 고유해야 합니다.\"\n\n#: validators.py:305\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"이 필드는 \\\"{date_field}\\\" 월에 대해 고유해야 합니다.\"\n\n#: validators.py:318\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"이 필드는 \\\"{date_field}\\\" 연도에 대해 고유해야 합니다.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\\\"Accept\\\" 헤더의 버전이 유효하지 않습니다.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"URL 경로의 버전이 유효하지 않습니다.\"\n\n#: versioning.py:118\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"URL 경로에 유효하지 않은 버전이 있습니다. 버전 네임스페이스와 일치하지 않습니다.\"\n\n#: versioning.py:150\nmsgid \"Invalid version in hostname.\"\nmsgstr \"hostname 내 버전이 유효하지 않습니다.\"\n\n#: versioning.py:172\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"쿼리 파라메터 내 버전이 유효하지 않습니다.\"\n"
  },
  {
    "path": "rest_framework/locale/lt/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# vytautas <vytautas@anqlave.co>, 2019\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Lithuanian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/lt/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: lt\\n\"\n\"Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Vartotojas neaktyvus arba pašalintas.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Raktas\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Vartotojas\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Sukurta\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Vartotojo vardas\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Slaptažodis\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Įvyko serverio klaida.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Netinkamai suformuota užklausa.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Neteisingi autentifikacijos duomenys.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Autentifikacijos duomenys nesuteikti.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Nerasta.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metodas \\\"{method}\\\" yra neleidžiamas.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Nepavyko patenkinti užklausos Accept antraštės.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Nepalaikomas duomenų formatas \\\"{media_type}\\\" užklausoje.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Užklausa pristabdyta.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Šis laukas yra privalomas.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Šis laukas negali būti nustatytas kaip null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Šis laukas negali būti tuščias.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Patikrinkite, ar šis laukas turi ne daugiau nei {max_length} simbolių.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Patikrinkite, ar šis laukas turi ne mažiau nei {min_length} simbolių.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Įveskite tinkamą el. pašto adresą.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Ši vertė neatitinka nustatyto šablono.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Įveskite tinkamą \\\"slug\\\" tekstą, turintį tik raidžių, skaičių, pabraukimų arba brūkšnelių.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Įveskite tinkamą URL adresą.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Įveskite tinkamą IPv4 arba IPv6 adresą.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Reikiama tinkama integer tipo reikšmė.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Patikrinkite, ar ši reikšmė yra mažesnė arba lygi {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Patikrinkite, ar ši reikšmė yra didesnė arba lygi {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"String tipo reikšmė per ilga.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Reikiamas tinkamas skaičius.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Patikrinkite, ar nėra daugiau nei {max_digits} skaitmenų.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Patikrinkite, ar nėra daugiau nei {max_decimal_places} skaitmenų po kablelio.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Patikrinkite, ar nėra daugiau nei {max_whole_digits} skaitmenų priešais kablelį.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datetime tipo reikšmė yra netinkamo formato. Naudokite vieną iš šių formatų: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Tikėtasi datetime, gauta date tipo reikšmė.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Date tipo reikšmė yra netinkamo formato. Naudokite vieną iš šių formatų: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Tikėtasi date, gauta datetime tipo reikšmė.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Time tipo reikšmė yra netinkamo formato. Naudokite vieną iš šių formatų: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Duration tipo reikšmė yra netinkamo formato. Naudokite vieną iš šių formatų: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" nėra tinkamas pasirinkimas.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Šis pasirinkimas negali būti tuščias.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Netinkamas puslapis.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/lv/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# peterisb <pb@sungis.lv>, 2017\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Latvian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/lv/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: lv\\n\"\n\"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Nederīgs pieprasījuma sākums. Akreditācijas parametri nav nodrošināti.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Nederīgs pieprasījuma sākums. Akreditācijas parametriem jābūt bez atstarpēm.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Nederīgs pieprasījuma sākums. Akreditācijas parametri nav korekti base64 kodēti.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Nederīgs lietotājvārds/parole.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Lietotājs neaktīvs vai dzēsts.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Nederīgs pilnvaras sākums. Akreditācijas parametri nav nodrošināti.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Nederīgs pilnvaras sākums. Pilnvaras parametros nevar būt tukšumi.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Nederīgs pilnvaras sākums. Pilnvaras parametros nevar būt nederīgas zīmes.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Nederīga pilnavara.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Autorizācijas pilnvara\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Atslēga\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Lietotājs\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Izveidots\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Pilnvara\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Pilnvaras\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Lietotājvārds\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Parole\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Neiespējami pieteikties sistēmā ar nodrošinātajiem akreditācijas datiem.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Jābūt iekļautam \\\"username\\\" un \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Notikusi servera kļūda.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Nenoformēts pieprasījums.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Nekorekti autentifikācijas parametri.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Netika nodrošināti autorizācijas parametri.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Tev nav tiesību veikt šo darbību.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Nav atrasts.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metode \\\"{method}\\\" nav atļauta.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Nevarēja apmierināt pieprasījuma Accept header.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Pieprasījumā neatbalstīts datu tips \\\"{media_type}\\\" .\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Pieprasījums tika apturēts.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Šis lauks ir obligāts.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Šis lauks nevar būt null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Šis lauks nevar būt tukšs.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Pārliecinies, ka laukā nav vairāk par {max_length} zīmēm.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Pārliecinies, ka laukā ir vismaz {min_length} zīmes.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Ievadi derīgu e-pasta adresi.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Šī vērtība neatbilst prasītajam pierakstam.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Ievadi derīgu \\\"slug\\\" vērtību, kura sastāv no burtiem, skaitļiem, apakš-svītras vai defises.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Ievadi derīgu URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Ievadi derīgu IPv4 vai IPv6 adresi.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Prasīta ir derīga skaitliska vērtība.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Pārliecinies, ka šī vērtība ir mazāka vai vienāda ar {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Pārliecinies, ka šī vērtība ir lielāka vai vienāda ar {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Teksta vērtība pārāk liela.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Derīgs skaitlis ir prasīts.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Pārliecinies, ka nav vairāk par {max_digits} zīmēm kopā.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Pārliecinies, ka nav vairāk par {max_decimal_places} decimālajām zīmēm.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Pārliecinies, ka nav vairāk par {max_whole_digits} zīmēm pirms komata.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datuma un laika formāts ir nepareizs. Lieto vienu no norādītajiem formātiem: \\\"{format}.\\\"\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Tika gaidīts datums un laiks, saņemts datums..\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datumam ir nepareizs formāts. Lieto vienu no norādītajiem formātiem: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Tika gaidīts datums, saņemts datums un laiks.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Laikam ir nepareizs formāts. Lieto vienu no norādītajiem formātiem: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Ilgumam ir nepreizs formāts. Lieto vienu no norādītajiem formātiem: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" ir nederīga izvēle.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Vairāk par {count} ierakstiem...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Tika gaidīts saraksts ar ierakstiem, bet tika saņemts \\\"{input_type}\\\" tips.\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Šī daļa nevar būt tukša.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" ir nederīga ceļa izvēle.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Neviens fails netika pievienots.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Pievienotie dati nebija fails. Pārbaudi kodējuma tipu formā.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Faila nosaukums nevar tikt noteikts.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Pievienotais fails ir tukšs.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Pārliecinies, ka faila nosaukumā ir vismaz {max_length} zīmes (tajā ir  {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Augšupielādē derīgu attēlu. Pievienotā datne nebija attēls vai bojāts attēls.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Šis saraksts nevar būt tukšs.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Tika gaidīta vārdnīca ar ierakstiem, bet tika saņemts \\\"{input_type}\\\" tips.\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Vērtībai ir jābūt derīgam JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Meklēt\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Kārtošana\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"augoši\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"dilstoši\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Nederīga lapa.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Nederīgs kursors\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Nederīga pk \\\"{pk_value}\\\" - objekts neeksistē.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Nepareizs tips. Tika gaidīta pk vērtība, saņemts {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Nederīga hipersaite - Nav URL sakritība.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Nederīga hipersaite - Nederīga URL sakritība.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Nederīga hipersaite - Objekts neeksistē.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Nepareizs tips. Tika gaidīts URL teksts, saņemts {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objekts ar {slug_name}={value} neeksistē.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Nedrīga vērtība.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Nederīgi dati. Tika gaidīta vārdnīca, saņemts {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtri\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Nekas\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Nav ierakstu, ko izvēlēties.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Šim laukam ir jābūt unikālam.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Laukiem {field_names} jāveido unikālas kombinācijas.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Šim laukam ir jābūt unikālam priekš \\\"{date_field}\\\" datuma.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Šim laukam ir jābūt unikālam priekš \\\"{date_field}\\\" mēneša.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Šim laukam ir jābūt unikālam priekš \\\"{date_field}\\\" gada.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Nederīga versija \\\"Accept\\\" galvenē.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Nederīga versija URL ceļā.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Nederīga versija URL ceļā. Nav atbilstības esošo versiju telpā.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Nederīga versija servera nosaukumā.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Nederīga versija pieprasījuma parametros.\"\n"
  },
  {
    "path": "rest_framework/locale/mk/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Filip Dimitrovski <filipdimitrovski22@gmail.com>, 2015-2016\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Macedonian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/mk/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: mk\\n\"\n\"Plural-Forms: nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Невалиден основен header. Не се внесени податоци за автентикација.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Невалиден основен header. Автентикационата низа не треба да содржи празни места.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Невалиден основен header. Податоците за автентикација не се енкодирани со base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Невалидно корисничко име/лозинка.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Корисникот е деактивиран или избришан.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Невалиден токен header. Не се внесени податоци за најава.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Невалиден токен во header. Токенот не треба да содржи празни места.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Невалиден токен.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Автентикациски токен\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Корисник\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Токен\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Токени\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Корисничко име\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Лозинка\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Не може да се најавите со податоците за најава.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Мора да се внесе „username“ и „password“.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Настана серверска грешка.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Неправилен request.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Неточни податоци за најава.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Не се внесени податоци за најава.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Немате дозвола да го сторите ова.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Не е пронајдено ништо.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Методата \\\"{method}\\\" не е дозволена.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Не може да се исполни барањето на Accept header-от.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Media типот „{media_type}“ не е поддржан.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Request-от е забранет заради ограничувања.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Ова поле е задолжително.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Ова поле не смее да биде недефинирано.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Ова поле не смее да биде празно.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Ова поле не смее да има повеќе од {max_length} знаци.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Ова поле мора да има барем {min_length} знаци.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Внесете валидна email адреса.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Ова поле не е по правилната шема/барање.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Внесете валидно име што содржи букви, бројки, долни црти или црти.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Внесете валиден URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Внеси валидна IPv4 или IPv6 адреса.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Задолжителен е валиден цел број.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Вредноста треба да биде помала или еднаква на {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Вредноста треба да биде поголема или еднаква на {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Вредноста е преголема.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Задолжителен е валиден број.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Не смее да има повеќе од {max_digits} цифри вкупно.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Не смее да има повеќе од {max_decimal_places} децимални места.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Не смее да има повеќе од {max_whole_digits} цифри пред децималната точка.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Датата и времето се со погрешен формат. Користете го овој формат: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Очекувано беше дата и време, а внесено беше само дата.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Датата е со погрешен формат. Користете го овој формат: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Очекувана беше дата, а внесени беа и дата и време.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Времето е со погрешен формат. Користете го овој формат: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"„{input}“ не е валиден избор.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Повеќе од {count} ставки...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Очекувана беше листа од ставки, а внесено беше „{input_type}“.\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Ниеден фајл не е качен (upload-иран).\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Испратените податоци не се фајл. Проверете го encoding-от на формата.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Не може да се открие име на фајлот.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Качениот (upload-иран) фајл е празен.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Името на фајлот треба да има највеќе {max_length} знаци (а има {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Качете (upload-ирајте) валидна слика. Фајлот што го качивте не е валидна слика или е расипан.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Оваа листа не смее да биде празна.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Очекуван беше dictionary од ставки, a внесен беше тип \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Вредноста мора да биде валиден JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Пребарај\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Подредување\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"растечки\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"опаѓачки\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Невалидна вредност за страна.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Невалиден покажувач (cursor)\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Невалиден pk „{pk_value}“ - објектот не постои.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Неточен тип. Очекувано беше pk, а внесено {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Невалиден хиперлинк - не е внесен URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Невалиден хиперлинк - внесен е неправилен URL.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Невалиден хиперлинк - Објектот не постои.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Неточен тип. Очекувано беше URL, a внесено {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Објектот со {slug_name}={value} не постои.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Невалидна вредност.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Невалидни податоци. Очекуван беше dictionary, а внесен {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Филтри\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Ништо\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Нема ставки за избирање.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Ова поле мора да биде уникатно.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Полињата {field_names} заедно мора да формираат уникатен збир.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Ова поле мора да биде уникатно за „{date_field}“ датата.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Ова поле мора да биде уникатно за „{date_field}“ месецот.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Ова поле мора да биде уникатно за „{date_field}“ годината.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Невалидна верзија во „Accept“ header-от.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Невалидна верзија во URL патеката.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Верзијата во URL патеката не е валидна. Не се согласува со ниеден version namespace (именски простор за верзии).\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Невалидна верзија во hostname-от.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Невалидна верзија во query параметарот.\"\n"
  },
  {
    "path": "rest_framework/locale/nb/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Håken Lid <haakenlid@gmail.com>, 2017\n# Petter Kjelkenes <kjelkenes@gmail.com>, 2015\n# Thomas Bruun <thomas.bruun@gmail.com>, 2017\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Norwegian Bokmål (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/nb/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: nb\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Ugyldig basic header. Ingen legitimasjon gitt.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Ugyldig basic header. Legitimasjonsstreng bør ikke inneholde mellomrom.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Ugyldig basic header. Legitimasjonen ikke riktig Base64 kodet.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Ugyldig brukernavn eller passord.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Bruker inaktiv eller slettet.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Ugyldig token header. Ingen legitimasjon gitt.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Ugyldig token header. Token streng skal ikke inneholde mellomrom.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Ugyldig token header. Tokenstrengen skal ikke inneholde ugyldige tegn.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Ugyldig token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Auth Token\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Nøkkel\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Bruker\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Opprettet\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokener\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Brukernavn\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Passord\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Kan ikke logge inn med gitt legitimasjon.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Må inneholde \\\"username\\\" og \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"En serverfeil skjedde.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Misformet forespørsel.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Ugyldig autentiseringsinformasjon.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Manglende autentiseringsinformasjon.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Du har ikke tilgang til å utføre denne handlingen.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Ikke funnet.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metoden \\\"{method}\\\" ikke gyldig.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Kunne ikke tilfredsstille request Accept header.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Ugyldig media type \\\"{media_type}\\\" i request.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Forespørselen ble strupet.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Dette feltet er påkrevd.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Dette feltet må ikke være tomt.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Dette feltet må ikke være blankt.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Forsikre deg om at dette feltet ikke har mer enn {max_length} tegn.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Forsikre deg at dette feltet har minst {min_length} tegn.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Oppgi en gyldig epost-adresse.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Denne verdien samsvarer ikke med de påkrevde mønsteret.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Skriv inn en gyldig \\\"slug\\\" som består av bokstaver, tall, understrek eller bindestrek.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Skriv inn en gyldig URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Skriv inn en gyldig IPv4 eller IPv6-adresse.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"En gyldig heltall er nødvendig.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Sikre denne verdien er mindre enn eller lik {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Sikre denne verdien er større enn eller lik {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Strengverdien for stor.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Et gyldig nummer er nødvendig.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Pass på at det ikke er flere enn {max_digits} siffer totalt.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Pass på at det ikke er flere enn {max_decimal_places} desimaler.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Pass på at det ikke er flere enn {max_whole_digits} siffer før komma.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datetime har feil format. Bruk et av disse formatene i stedet: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Forventet en datetime, men fikk en date.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Dato har feil format. Bruk et av disse formatene i stedet: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Forventet en date, men fikk en datetime.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Tid har feil format. Bruk et av disse formatene i stedet: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Varighet har feil format. Bruk et av disse formatene i stedet: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" er ikke et gyldig valg.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Mer enn {count} elementer ...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Forventet en liste over elementer, men fikk type \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Dette valget kan ikke være tomt.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" er ikke en gyldig bane valg.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Ingen fil ble sendt.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"De innsendte data var ikke en fil. Kontroller kodingstypen på skjemaet.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Kunne ikke finne filnavn.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Den innsendte filen er tom.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Sikre dette filnavnet har på det meste {max_length} tegn (det har {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Last opp et gyldig bilde. Filen du lastet opp var enten ikke et bilde eller en ødelagt bilde.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Denne listen kan ikke være tom.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Forventet en dictionary av flere ting, men fikk typen \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Verdien må være gyldig JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Søk\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Sortering\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"stigende\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"synkende\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Ugyldig side\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Ugyldig markør\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Ugyldig pk \\\"{pk_value}\\\" - objektet eksisterer ikke.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Feil type. Forventet pk verdi, fikk {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Ugyldig hyperkobling - No URL match.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Ugyldig hyperkobling - Incorrect URL match.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Ugyldig hyperkobling - Objektet eksisterer ikke.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Feil type. Forventet URL streng, fikk {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objekt med {slug_name}={value} finnes ikke.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Ugyldig verdi.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Ugyldige data. Forventet en dictionary, men fikk {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtre\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Ingen\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Ingenting å velge.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Dette feltet må være unikt.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Feltene {field_names} må gjøre et unikt sett.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Dette feltet må være unikt for \\\"{date_field}\\\" dato.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Dette feltet må være unikt for \\\"{date_field}\\\" måned.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Dette feltet må være unikt for \\\"{date_field}\\\" år.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Ugyldig versjon på \\\"Accept\\\" header.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Ugyldig versjon i URL-banen.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Ugyldig versjon i URL. Passer ikke med noen eksisterende versjon.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Ugyldig versjon i vertsnavn.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Ugyldig versjon i søkeparameter.\"\n"
  },
  {
    "path": "rest_framework/locale/ne_NP/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Shrawan Poudel <shrwnkr@gmail.com>, 2018\n# Xavier Ordoquy <xordoquy@linovia.com>, 2020\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:59+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Nepali (Nepal) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ne_NP/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: ne_NP\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"अमान्य हेडरहरू, क्रेडेन्सियलहरू प्रदान गरिएको छैन |\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"अमान्य हेडरहरू, क्रेडेन्सियलहरूमा स्पेस हुनु हुँदैन |\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"अमान्य हेडरहरू, क्रेडेन्सियलहरूमा सही तरिकाले base64 एन्कोड गरिएको छैन |\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"अमान्य प्रयोगकर्तानाम/पासवर्ड |\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"प्रयोगकर्ता निष्क्रिय वा मेटायिएको छ |\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"अमान्य टोकन हेडर । कुनै क्रेडेन्सियल प्रदान गरिएको छैन ।\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"अमान्य टोकन हेडर | टोकनमा स्पेस हुनु हुँदैन |\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"अमान्य टोकन हेडर | टोकनमा अवैध अक्षरहरू हुनु हुँदैन |\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"अमान्य टोकन |\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"प्रयोगकर्ता प्रमाणिकरण टोकन \"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"मूल\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"प्रयोगकर्ता\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"सिर्जना गरियो\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"टोकन\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"टोकेनहरु\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"प्रयोगकर्ताको नाम\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"पासवर्ड\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"प्रदान गरिएको क्रेडेन्सियलसँग लग इन गर्न सकिएन |\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\\\"प्रयोगकर्ताको नाम\\\" र \\\"पासवर्ड\\\" सामेल हुनु पर्छ |\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"सर्भर त्रुटि देखापर्यो |\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"विकृत अनुरोध |\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"गलत प्रमाणीकरण क्रेडेन्सियलहरू |\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"प्रमाणीकरण क्रेडेन्सियलहरू पयिएन | \"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"तपाइँसँग यो कार्य गर्न अनुमति छैन |\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"फेला परेन |\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\\\"{method}\\\" गर्ने अनुमती छैन |\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Accept Header अनुरोधलाई सन्तुष्ट गर्ने सकिएन |\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"असमर्थित मिडिया टाईप \\\"{media_type}\\\" अनुरोधको | \"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"अनुरोध प्रतिबन्दित गरियो |\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"यो फिल्ड आवश्यक छ |\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"यो फिल्ड खाली हुनु हुँदैन |\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"यो फिल्ड खाली हुन सक्दैन |\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"यो फिल्डसँग {max_length} अक्षरहरू भन्दा बढी छ छैन सुनिश्चित गर्नुहोस् |\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"यो फिल्डमा कम से कम {min_length} अक्षरहरू छ छैन सुनिश्चित गर्नुहोस् |\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"मान्य इमेल ठेगाना प्रविष्ट गर्नुहोस् |\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"यो परिमाण आवश्यक ढाँचा मेल खाँदैन ।\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"अक्षरहरू, अङ्कहरू, अन्डरसेर्सहरू वा हाइफनहरू समावेश भएका एक मान्य \\\"slug\\\" प्रविष्टि गर्नुहोस् ।\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"मान्य यूआरएल प्रविष्ट गर्नुहोस् ।\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"मान्य IPv4 वा IPv6 ठेगाना प्रविष्टि गर्नुहोस् ।\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"एक मान्य पूर्णांक आवश्यक छ ।\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"यो परिमाण {max_value} को भन्दा कम वा बराबर छ  सुनिश्चित गर्नुहोस् ।\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"यो परिमाण {min_value} भन्दा बढी वा बराबर छ सुनिश्चित गर्नुहोस् ।\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"स्ट्रिङ परिमाण धेरै ठूलो छ ।\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"एउटा मान्य अङ्कहरू आवश्यक छ ।\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"सुनिश्चित गर्नुहोस् कि {max_digits} अङ्कहरू भन्दा अधिक नहोस् ।\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"सुनिश्चित गर्नुहोस् कि {max_decimal_places} दशमलव स्थानहरू भन्दा अधिक नहोस् ।\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"सुनिश्चित गर्नुहोस् कि दशमलव बिन्दुभन्दा पहिले {max_whole_digits} अङ्कहरू भन्दा अधिक नहोस् ।\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"डेटटाइममा गलत ढाँचा छ । यसको सट्टामा यी मध्ये एक ढाँचा प्रयोग गर्नुहोस्: {format} ।\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"डेटटाइम अपेक्षित भए तर मिति प्राप्त भयो ।\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"डेटमा गलत ढाँचा छ । यसको सट्टामा यी मध्ये एक ढाँचा प्रयोग गर्नुहोस्: {format} ।\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"डेट अपेक्षित भए तर डेटाटाइम प्राप्त भयो ।\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"समयमा गलत ढाँचा छ । यसको सट्टामा यी मध्ये एक ढाँचा प्रयोग गर्नुहोस्: {format} ।\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"अवधिमा गलत ढाँचा छ । यसको सट्टामा यी मध्ये एक ढाँचा प्रयोग गर्नुहोस्: {format} ।\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" मान्य छनौट छैन ।\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"{count} वस्तुहरू भन्दा बढी ...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"वस्तुहरूको सूची अपेक्षित तर \\\"{input_type}\\\" टाइप प्राप्त भयो ।\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"यो चयन रिक्त हुन सक्दैन ।\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" मान्य मार्गको विकल्प होइन ।\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"कुनै फाइल पेश गरिएको छैन ।\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"पेश गरिएको डेटा फाईल थिएन । एन्कोडिङ प्रकार फारममा जाँच्नुहोस् ।\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"कुनै फाइल नाम निर्धारण गर्न सकिएन ।\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"पेश गरिएको फाइल खाली छ ।\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"यो फाइल नाममा अधिक {max_length} अक्षरहरू छ छैन (यसमा {length} छ) सुनिश्चित गर्नुहोस् ।\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"मान्य चित्र अपलोड गर्नुहोस् । तपाईंले अपलोड गर्नुभएको फाइल होइन वा चित्र वा भ्रष्ट चित्र हो ।\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"यो सूची खाली हुन सक्दैन ।\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"वस्तुहरूको शब्दकोशको अपेक्षित तर \\\"{input_type}\\\" टाइप प्राप्त भयो ।\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"परिमाण मान्य JSON हुनु पर्छ ।\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"खोजी गर्नुहोस्\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"क्रम\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"आरोहण\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"अवरोहण\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"अमान्य पृष्ठ ।\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"अमान्य कर्सर\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"अमान्य pk \\\"{pk_value}\\\" - वस्तुको अस्तित्व छैन ।\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"गलत प्रकार। अपेक्षित pk परिमाण, {data_type} प्राप्त भयो ।\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"अमान्य हाइपरलिंक - कुनै यूआरएलको मेल छैन ।\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"अमान्य हाइपरलिंक - गलत यूआरएलको मेल छ ।\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"अमान्य हाइपरलिंक - वस्तुको अस्तित्व छैन ।\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"गलत प्रकार। अपेक्षित यूआरएल स्ट्रिङ, {data_type} प्राप्त भयो ।\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"वस्तु {slug_name} = {value} सँग अस्तित्व छैन ।\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"अमान्य परिमाण ।\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"अमान्य डेटा । एक शब्दकोश अपेक्षित, तर {datatype} प्राप्त भयो ।\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"फिल्टरहरू\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"कुनै पनि होइन\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"चयन गर्न वस्तुहरू छैनन् ।\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"यो फिल्ड अद्वितीय हुनुपर्छ ।\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"फिल्ड {field_names} ले एक अद्वितीय सेट गर्नु पर्छ ।\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"यो फिल्ड \\\"{date_field}\\\" मितिको लागि अद्वितीय हुनुपर्छ ।\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"यो फिल्ड \\\"{date_field}\\\" महिनाको लागि अद्वितीय हुनुपर्छ ।\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"यो फिल्ड \\\"{date_field}\\\" वर्षको लागि अद्वितीय हुनुपर्छ ।\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\\\"Accept\\\" हेडरमा अमान्य संस्करण ।\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"यूआरएल मार्गमा अमान्य संस्करण ।\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"यूआरएल मार्गमा अमान्य संस्करण । कुनै पनि संस्करणको नामसँग मेल खाँदैन ।\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"होस्ट नाममा अमान्य संस्करण ।\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \" क्वेरी परिमितिमा अमान्य संस्करण ।\"\n"
  },
  {
    "path": "rest_framework/locale/nl/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Hans van Luttikhuizen <hansvanluttikhuizen@me.com>, 2016\n# Mike Dingjan <mike@mikedingjan.nl>, 2015\n# Mike Dingjan <mike@mikedingjan.nl>, 2017\n# Mike Dingjan <mike@mikedingjan.nl>, 2015\n# Hans van Luttikhuizen <hansvanluttikhuizen@me.com>, 2016\n# Tom Hendrikx <tom+transifex.com@whyscream.net>, 2017\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Dutch (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/nl/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: nl\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Ongeldige basic header. Geen logingegevens opgegeven.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Ongeldige basic header. logingegevens kunnen geen spaties bevatten.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Ongeldige basic header. logingegevens zijn niet correct base64-versleuteld.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Ongeldige gebruikersnaam/wachtwoord.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Gebruiker inactief of verwijderd.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Ongeldige token header. Geen logingegevens opgegeven\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Ongeldige token header. Token kan geen spaties bevatten.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Ongeldige token header. Token kan geen ongeldige karakters bevatten.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Ongeldige token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Autorisatietoken\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Key\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Gebruiker\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Aangemaakt\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokens\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Gebruikersnaam\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Wachtwoord\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Kan niet inloggen met opgegeven gegevens.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Moet \\\"username\\\" en \\\"password\\\" bevatten.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Er is een serverfout opgetreden.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Ongeldig samengestelde request.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Ongeldige authenticatiegegevens.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Authenticatiegegevens zijn niet opgegeven.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Je hebt geen toestemming om deze actie uit te voeren.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Niet gevonden.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Methode \\\"{method}\\\" niet toegestaan.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Kan niet voldoen aan de opgegeven Accept header.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Ongeldige media type \\\"{media_type}\\\" in aanvraag.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Aanvraag was verstikt.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Dit veld is vereist.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Dit veld mag niet leeg zijn.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Dit veld mag niet leeg zijn.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Zorg ervoor dat dit veld niet meer dan {max_length} karakters bevat.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Zorg ervoor dat dit veld minimaal {min_length} karakters bevat.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Voer een geldig e-mailadres in.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Deze waarde voldoet niet aan het vereiste formaat.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Voer een geldige \\\"slug\\\" in, bestaande uit letters, cijfers, lage streepjes of streepjes.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Voer een geldige URL in.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Voer een geldig IPv4- of IPv6-adres in.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Een geldig getal is vereist.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Zorg ervoor dat deze waarde kleiner is dan of gelijk is aan {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Zorg ervoor dat deze waarde groter is dan of gelijk is aan {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Tekstwaarde is te lang.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Een geldig nummer is vereist.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Zorg ervoor dat er in totaal niet meer dan {max_digits} cijfers zijn.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Zorg ervoor dat er niet meer dan {max_decimal_places} cijfers achter de komma zijn.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Zorg ervoor dat er niet meer dan {max_whole_digits} cijfers voor de komma zijn.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datetime heeft een ongeldig formaat, gebruik 1 van de volgende formaten: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Verwachtte een datetime, maar kreeg een date.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Date heeft het verkeerde formaat, gebruik 1 van deze formaten: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Verwachtte een date, maar kreeg een datetime.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Time heeft het verkeerde formaat, gebruik 1 van onderstaande formaten: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Tijdsduur heeft een verkeerd formaat, gebruik 1 van onderstaande formaten: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" is een ongeldige keuze.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Meer dan {count} items...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Verwachtte een lijst met items, maar kreeg type \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Deze selectie mag niet leeg zijn.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" is niet een geldig pad.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Er is geen bestand opgestuurd.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"De verstuurde data was geen bestand. Controleer de encoding type op het formulier.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Bestandsnaam kon niet vastgesteld worden.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Het verstuurde bestand is leeg.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Zorg ervoor dat deze bestandsnaam hoogstens {max_length} karakters heeft (het heeft er {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Upload een geldige afbeelding, de geüploade afbeelding is geen afbeelding of is beschadigd geraakt,\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Deze lijst mag niet leeg zijn.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Verwachtte een dictionary van items, maar kreeg type \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Waarde moet valide JSON zijn.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Zoek\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Sorteer op\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"oplopend\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"aflopend\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Ongeldige pagina.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Ongeldige cursor.\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Ongeldige pk \\\"{pk_value}\\\" - object bestaat niet.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Ongeldig type. Verwacht een pk-waarde, ontving {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Ongeldige hyperlink - Geen overeenkomende URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Ongeldige hyperlink - Ongeldige URL\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Ongeldige hyperlink - Object bestaat niet.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Ongeldig type. Verwacht een URL, ontving {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Object met {slug_name}={value} bestaat niet.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Ongeldige waarde.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Ongeldige data. Verwacht een dictionary, kreeg een {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filters\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Geen\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Geen items geselecteerd.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Dit veld moet uniek zijn.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"De velden {field_names} moeten een unieke set zijn.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Dit veld moet uniek zijn voor de \\\"{date_field}\\\" datum.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Dit veld moet uniek zijn voor de \\\"{date_field}\\\" maand.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Dit veld moet uniek zijn voor de \\\"{date_field}\\\" year.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Ongeldige versie in \\\"Accept\\\" header.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Ongeldige versie in URL-pad.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Ongeldige versie in het URL pad, komt niet overeen met een geldige versie namespace\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Ongeldige versie in hostnaam.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Ongeldige versie in query parameter.\"\n"
  },
  {
    "path": "rest_framework/locale/nn/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Norwegian Nynorsk (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/nn/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: nn\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/no/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Norwegian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/no/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: no\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/pl/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Janusz Harkot <jh@trilab.pl>, 2015\n# Piotr Jakimiak <legolass71@gmail.com>, 2015\n# m_aciek <maciej.olko@gmail.com>, 2016\n# m_aciek <maciej.olko@gmail.com>, 2015-2016\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Polish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/pl/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: pl\\n\"\n\"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Niepoprawny podstawowy nagłówek. Brak danych uwierzytelniających.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Niepoprawny podstawowy nagłówek. Ciąg znaków danych uwierzytelniających nie powinien zawierać spacji.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Niepoprawny podstawowy nagłówek. Niewłaściwe kodowanie base64 danych uwierzytelniających.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Niepoprawna nazwa użytkownika lub hasło.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Użytkownik nieaktywny lub usunięty.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Niepoprawny nagłówek tokena. Brak danych uwierzytelniających.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Niepoprawny nagłówek tokena. Token nie może zawierać odstępów.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Błędny nagłówek z tokenem. Token nie może zawierać błędnych znaków.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Niepoprawny token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Token uwierzytelniający\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Klucz\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Użytkownik\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Stworzono\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokeny\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Nazwa użytkownika\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Hasło\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Podane dane uwierzytelniające nie pozwalają na zalogowanie.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Musi zawierać \\\"username\\\" i \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Wystąpił błąd serwera.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Zniekształcone żądanie.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Błędne dane uwierzytelniające.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Nie podano danych uwierzytelniających.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Nie masz uprawnień, by wykonać tę czynność.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Nie znaleziono.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Niedozwolona metoda \\\"{method}\\\".\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Nie można zaspokoić nagłówka Accept żądania.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Brak wsparcia dla żądanego typu danych \\\"{media_type}\\\".\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Żądanie zostało zdławione.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"To pole jest wymagane.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Pole nie może mieć wartości null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"To pole nie może być puste.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Upewnij się, że to pole ma nie więcej niż {max_length} znaków.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Upewnij się, że pole ma co najmniej {min_length} znaków.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Podaj poprawny adres e-mail.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Ta wartość nie pasuje do wymaganego wzorca.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Wprowadź poprawną wartość pola typu \\\"slug\\\", składającą się ze znaków łacińskich, cyfr, podkreślenia lub myślnika.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Wprowadź poprawny adres URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Wprowadź poprawny adres IPv4 lub IPv6.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Wymagana poprawna liczba całkowita.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Upewnij się, że ta wartość jest mniejsza lub równa {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Upewnij się, że ta wartość jest większa lub równa {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Za długi ciąg znaków.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Wymagana poprawna liczba.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Upewnij się, że liczba ma nie więcej niż {max_digits} cyfr.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Upewnij się, że liczba ma nie więcej niż {max_decimal_places} cyfr dziesiętnych.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Upewnij się, że liczba ma nie więcej niż {max_whole_digits} cyfr całkowitych.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Wartość daty z czasem ma zły format. Użyj jednego z dostępnych formatów: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Oczekiwano datę z czasem, otrzymano tylko datę.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Data ma zły format. Użyj jednego z tych formatów: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Oczekiwano daty a otrzymano datę z czasem.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Błędny format czasu. Użyj jednego z dostępnych formatów: {format}\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Czas trwania ma zły format. Użyj w zamian jednego z tych formatów: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" nie jest poprawnym wyborem.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Więcej niż {count} elementów...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Oczekiwano listy elementów, a otrzymano dane typu \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Zaznaczenie nie może być puste.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" nie jest poprawną ścieżką.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Nie przesłano pliku.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Przesłane dane nie były plikiem. Sprawdź typ kodowania formatki.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Nie można określić nazwy pliku.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Przesłany plik jest pusty.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Upewnij się, że nazwa pliku ma długość co najwyżej {max_length} znaków (aktualnie ma {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Prześlij poprawny plik graficzny. Przesłany plik albo nie jest grafiką lub jest uszkodzony.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Lista nie może być pusta.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Oczekiwano słownika, ale otrzymano  \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Wartość musi być poprawnym ciągiem znaków JSON\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Szukaj\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Kolejność\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"rosnąco\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"malejąco\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Niepoprawna strona.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Niepoprawny wskaźnik\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Błędny klucz główny \\\"{pk_value}\\\" - obiekt nie istnieje.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Błędny typ danych. Oczekiwano wartość klucza głównego, otrzymano {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Błędny hyperlink - nie znaleziono pasującego adresu URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Błędny hyperlink - błędne dopasowanie adresu URL.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Błędny hyperlink - obiekt nie istnieje.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Błędny typ danych. Oczekiwano adresu URL, otrzymano {data_type}\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Obiekt z polem {slug_name}={value} nie istnieje\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Niepoprawna wartość.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Niepoprawne dane. Oczekiwano słownika, otrzymano  {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtry\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"None\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Nie wybrano wartości.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Wartość dla tego pola musi być unikalna.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Pola {field_names} muszą tworzyć unikalny zestaw.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"To pole musi mieć unikalną wartość dla jednej daty z pola \\\"{date_field}\\\".\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"To pole musi mieć unikalną wartość dla konkretnego miesiąca z pola \\\"{date_field}\\\".\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"To pole musi mieć unikalną wartość dla konkretnego roku z pola \\\"{date_field}\\\".\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Błędna wersja w nagłówku \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Błędna wersja w ścieżce URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Niepoprawna wersja w ścieżce URL. Nie pasuje do przestrzeni nazw żadnej wersji.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Błędna wersja w nazwie hosta.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Błędna wersja w parametrach zapytania.\"\n"
  },
  {
    "path": "rest_framework/locale/pt/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Craig Blaszczyk <masterjakul@gmail.com>, 2015\n# Ederson  Mota Pereira <edermp@gmail.com>, 2015\n# Filipe Rinaldi <filipe.rinaldi@gmail.com>, 2015\n# Hugo Leonardo Chalhoub Mendonça <hugoleonardocm@live.com>, 2015\n# Jonatas Baldin <jonatas.baldin@gmail.com>, 2017\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Portuguese (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/pt/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: pt\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Cabeçalho básico inválido. Credenciais não fornecidas.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Cabeçalho básico inválido. String de credenciais não deve incluir espaços.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Cabeçalho básico inválido. Credenciais codificadas em base64 incorretamente.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Usuário ou senha inválido.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Usuário inativo ou removido.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Cabeçalho de token inválido. Credenciais não fornecidas.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Cabeçalho de token inválido. String de token não deve incluir espaços.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Cabeçalho de token inválido. String de token não deve possuir caracteres inválidos.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Token inválido.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Token de autenticação\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Chave\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Usuário\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Criado\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokens\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Nome do usuário\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Senha\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Impossível fazer login com as credenciais fornecidas.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Obrigatório incluir \\\"usuário\\\" e \\\"senha\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Ocorreu um erro de servidor.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Pedido malformado.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Credenciais de autenticação incorretas.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"As credenciais de autenticação não foram fornecidas.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Você não tem permissão para executar essa ação.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Não encontrado.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Método \\\"{method}\\\" não é permitido.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Não foi possível satisfazer a requisição do cabeçalho Accept.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Tipo de mídia  \\\"{media_type}\\\" no pedido não é suportado.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Pedido foi limitado.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Este campo é obrigatório.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Este campo não pode ser nulo.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Este campo não pode ser em branco.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Certifique-se de que este campo não tenha mais de {max_length} caracteres.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Certifique-se de que este campo tenha mais de {min_length} caracteres.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Insira um endereço de email válido.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Este valor não corresponde ao padrão exigido.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Entrar um \\\"slug\\\" válido que consista de letras, números, sublinhados ou hífens.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Entrar um URL válido.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Informe um endereço IPv4 ou IPv6 válido.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Um número inteiro válido é exigido.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Certifique-se de que este valor seja inferior ou igual a {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Certifque-se de que este valor seja maior ou igual a {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Valor da string é muito grande.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Um número válido é necessário.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Certifique-se de que não haja mais de {max_digits} dígitos no total.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Certifique-se de que não haja mais de {max_decimal_places} casas decimais.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Certifique-se de que não haja mais de {max_whole_digits} dígitos antes do ponto decimal.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Formato inválido para data e hora. Use um dos formatos a seguir: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Necessário uma data e hora mas recebeu uma data.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Formato inválido para data. Use um dos formatos a seguir: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Necessário uma data mas recebeu uma data e hora.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Formato inválido para Tempo. Use um dos formatos a seguir: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Formato inválido para Duração. Use um dos formatos a seguir: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" não é um escolha válido.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Mais de {count} itens...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Necessário uma lista de itens, mas recebeu tipo \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Esta seleção não pode estar vazia.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" não é uma escolha válida para um caminho.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Nenhum arquivo foi submetido.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"O dado submetido não é um arquivo. Certifique-se do tipo de codificação no formulário.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Nome do arquivo não pode ser determinado.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"O arquivo submetido está vázio.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Certifique-se de que o nome do arquivo tem menos de {max_length} caracteres (tem {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Fazer upload de uma imagem válida. O arquivo enviado não é um arquivo de imagem ou está corrompido.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Esta lista não pode estar vazia.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Esperado um dicionário de itens mas recebeu tipo \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Valor devo ser JSON válido.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Buscar\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Ordenando\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"ascendente\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"descendente\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Página inválida.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Cursor inválido\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Pk inválido \\\"{pk_value}\\\" - objeto não existe.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Tipo incorreto. Esperado valor pk, recebeu {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Hyperlink inválido - Sem combinação para a URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Hyperlink inválido - Combinação URL incorreta.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Hyperlink inválido - Objeto não existe.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Tipo incorreto. Necessário string URL, recebeu {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objeto com {slug_name}={value} não existe.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Valor inválido.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Dado inválido. Necessário um dicionário mas recebeu {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtra\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Nenhum(a/as)\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Nenhum item para escholher.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Esse campo deve ser  único.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Os campos {field_names} devem criar um set único.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"O campo \\\"{date_field}\\\" deve ser único para a data.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"O campo \\\"{date_field}\\\" deve ser único para o mês.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"O campo \\\"{date_field}\\\" deve ser único para o ano.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Versão inválida no cabeçalho \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Versão inválida no caminho de URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Versão inválida no caminho da URL. Não corresponde a nenhuma versão do namespace.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Versão inválida no hostname.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Versão inválida no parâmetro de query.\"\n"
  },
  {
    "path": "rest_framework/locale/pt_BR/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n#\n# Translators:\n# Cloves Oliveira <clovesolivier23@gmail.com>, 2020\n# Craig Blaszczyk <masterjakul@gmail.com>, 2015\n# Ederson  Mota Pereira <edermp@gmail.com>, 2015\n# Filipe Rinaldi <filipe.rinaldi@gmail.com>, 2015\n# Hugo Leonardo Chalhoub Mendonça <hugoleonardocm@live.com>, 2015\n# Jonatas Baldin <jonatas.baldin@gmail.com>, 2017\n# Gabriel Mitelman Tkacz <gmtkacz@proton.me>, 2024\n# Matheus Oliveira <moliveiracdev@gmail.com>, 2025\n# João Victor Pinheiro Reis <joaovictorpinheiro1510@gmail.com>, 2025\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2025-11-18 17:00+0300\\n\"\n\"PO-Revision-Date: 2025-11-18 14:00+0000\\n\"\n\"Last-Translator: João Victor Pinheiro Reis <joaovictorpinheiro1510@gmail.com>\\n\"\n\"Language-Team: Portuguese (Brazil) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/pt_BR/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: pt_BR\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Cabeçalho básico inválido. Credenciais não fornecidas.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Cabeçalho básico inválido. String de credenciais não deve incluir espaços.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Cabeçalho básico inválido. Credenciais não foram corretamente codificadas em base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Usuário ou senha inválidos.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Usuário inativo ou removido.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Cabeçalho de token inválido. Credenciais não fornecidas.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Cabeçalho de token inválido. String de token não deve incluir espaços.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Cabeçalho de token inválido. String de token não deveria possuir caracteres inválidos.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Token inválido.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Token de autenticação\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Chave\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Usuário\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Criado\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokens\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Nome de usuário\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Senha\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Impossível fazer login com as credenciais fornecidas.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Deve incluir \\\"username\\\" e \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Um erro de servidor ocorreu.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"Entrada inválida\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Requisição malformada.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Credenciais de autenticação incorretas.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"As credenciais de autenticação não foram fornecidas.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Você não tem permissão para executar essa ação.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Não encontrado.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Método \\\"{method}\\\" não é permitido.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Não foi possível satisfazer a requisição do cabeçalho Accept.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Tipo de mídia \\\"{media_type}\\\" não é suportado.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Pedido foi suprimido.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"Espera-se que esteja diponível em {wait} segundo.\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"Espera-se que esteja diponível em {wait} segundos.\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Este campo é obrigatório.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Este campo pode não ser nulo.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"Deve ser um valor booleano válido.\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"Não é uma string válida.\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Este campo pode não estar em branco.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Certifique-se de que este campo não tenha mais de {max_length} caracteres.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Certifique-se de que este campo tenha mais de {min_length} caracteres.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Insira um endereço de email válido.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Este valor não corresponde ao padrão exigido.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Insira um \\\"slug\\\" válido que consista em letras, números, sublinhados ou hífens.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"Insira um \\\"slug\\\" válido que consista em letras, números, sublinhados ou hífens Unicode.\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Insira um URL válido.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"Deve ser um UUID válido.\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Informe um endereço IPv4 ou IPv6 válido.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Um número inteiro válido é exigido.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Certifique-se de que este valor seja inferior ou igual a {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Certifque-se de que este valor seja maior ou igual a {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Valor da string é muito grande.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Um número válido é necessário.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Certifique-se de que não haja mais de {max_digits} dígitos no total.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Certifique-se de que não haja mais de {max_decimal_places} casas decimais.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Certifique-se de que não haja mais de {max_whole_digits} dígitos antes do ponto decimal.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Formato inválido para data e hora. Use um dos formatos a seguir: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Esperava data e hora, mas recebeu data.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"Data e hora inválidas para o fuso horário \\\"{timezone}\\\".\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"Valor de data e hora fora do intervalo.\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Formato de data inválido. Use um dos formatos a seguir: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Esperava data, mas recebeu data e hora.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Formato inválido para tempo. Use um dos formatos a seguir: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Formato inválido para duração. Use um dos formatos a seguir: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" não é uma escolha válida.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Mais de {count} itens...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Esperava uma lista de itens, mas recebeu tipo \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Esta seleção pode não estar vazia.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" não é uma escolha válida de caminho.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Nenhum arquivo foi submetido.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"O dado submetido não era um arquivo. Cheque o tipo de codificação no formulário.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Nome do arquivo não pode ser determinado.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"O arquivo submetido está vázio.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Certifique-se de que o nome do arquivo tenho no máximo {max_length} caracteres (tem {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Faça upload de uma imagem válida. O arquivo enviado não é um arquivo de imagem ou está corrompido.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Esta lista pode não estar vazia.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"Certifique-se de que este campo tenha pelo menos {min_length} elementos.\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"Certifique-se de que este campo não tenha mais que {max_length} elementos.\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Esperava um dicionário de itens, mas recebeu tipo \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"Este dicionário pode não estar vazio.\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Valor deve ser JSON válido.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Buscar\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"Um termo de busca.\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Ordenando\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"Qual campo usar ao ordenar os resultados.\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"crescente\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"decrescente\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"Um número de página dentro do conjunto de resultados paginado.\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"Número de resultados a serem retornados por página.\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Página inválida.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"O índice inicial a partir do qual retornar os resultados.\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"O valor do cursor de paginação.\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Cursor inválido\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Pk inválido \\\"{pk_value}\\\" - objeto não existe.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Tipo incorreto. Esperava valor pk, recebeu {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Hyperlink inválido - Sem combinação para a URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Hyperlink inválido - Combinação URL incorreta.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Hyperlink inválido - Objeto não existe.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Tipo incorreto. Esperava string URL, recebeu {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objeto com {slug_name}={value} não existe.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Valor inválido.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"valor inteiro único\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"string UUID\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"valor único\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"Um {value_type} que identifica este {name}.\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Dado inválido. Esperava um dicionário, mas recebeu {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"Ações Extras\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtros\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"conteúdo\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"formulário de requisição\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"conteúdo principal\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"informações da requisição\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"informações da resposta\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Nenhum(a/as)\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Nenhum item para selecionar.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Este campo deve ser único.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Os campos {field_names} devem criar um set único.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"Caracteres substitutos não são permitidos: U+{code_point:X}.\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Este campo deve ser único para a data de \\\"{date_field}\\\".\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Este campo deve ser único para o mês de \\\"{date_field}\\\".\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Este campo deve ser único para o ano de \\\"{date_field}\\\".\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Versão inválida no cabeçalho \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Versão inválida no caminho de URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Versão inválida no caminho da URL. Não corresponde a nenhuma versão do namespace.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Versão inválida no hostname.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Versão inválida no parâmetro de consulta.\"\n"
  },
  {
    "path": "rest_framework/locale/pt_PT/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Portuguese (Portugal) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/pt_PT/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: pt_PT\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/ro/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Bogdan Mateescu, 2019\n# Elena-Adela Neacsu <adela.neacsu@rodeapps.com>, 2016\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Romanian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ro/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: ro\\n\"\n\"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Antet de bază invalid. Datele de autentificare nu au fost furnizate.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Antet de bază invalid. Şirul de caractere cu datele de autentificare nu trebuie să conțină spații.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Antet de bază invalid. Datele de autentificare nu au fost corect codificate în base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Nume utilizator / Parolă invalid(ă).\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Utilizator inactiv sau șters.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Antet token invalid. Datele de autentificare nu au fost furnizate.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Antet token invalid. Şirul de caractere pentru token nu trebuie să conțină spații.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Antet token invalid. Şirul de caractere pentru token nu trebuie să conțină caractere nevalide.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Token nevalid.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Token de autentificare\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Cheie\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Utilizator\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Creat\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokenuri\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Nume de utilizator\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Parola\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Nu se poate conecta cu datele de conectare furnizate.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Trebuie să includă \\\"numele de utilizator\\\" și \\\"parola\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"A apărut o eroare pe server.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Cerere incorectă.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Date de autentificare incorecte.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Datele de autentificare nu au fost furnizate.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Nu aveți permisiunea de a efectua această acțiune.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Nu a fost găsit(ă).\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metoda \\\"{method}\\\" nu este permisa.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Antetul Accept al cererii nu a putut fi îndeplinit.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Cererea conține tipul media neacceptat \\\"{media_type}\\\"\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Cererea a fost gâtuită.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Acest câmp este obligatoriu.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Acest câmp nu poate fi nul.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Acest câmp nu poate fi gol.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Asigurați-vă că acest câmp nu are mai mult de {max_length} caractere.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Asigurați-vă că acest câmp are cel puțin{min_length} caractere.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Introduceți o adresă de email validă.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Această valoare nu se potrivește cu şablonul cerut.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Introduceți un \\\"slug\\\" valid format din litere, numere, caractere de subliniere sau cratime.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Introduceți un URL valid.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Introduceți o adresă IPv4 sau IPv6 validă.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Este necesar un întreg valid.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Asigurați-vă că această valoare este mai mică sau egală cu {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Asigurați-vă că această valoare este mai mare sau egală cu {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Valoare șir de caractere prea mare.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Este necesar un număr valid.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Asigurați-vă că nu există mai mult de {max_digits} cifre în total.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Asigurați-vă că nu există mai mult de {max_decimal_places} zecimale.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Asigurați-vă că nu există mai mult de {max_whole_digits} cifre înainte de punctul zecimal.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Câmpul datetime are format greșit. Utilizați unul dintre aceste formate în loc: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Se aștepta un câmp datetime, dar s-a primit o dată.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Data are formatul greșit. Utilizați unul dintre aceste formate în loc: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Se aștepta o dată, dar s-a primit un câmp datetime.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Timpul are formatul greșit. Utilizați unul dintre aceste formate în loc: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Durata are formatul greșit. Utilizați unul dintre aceste formate în loc: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" nu este o opțiune validă.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Mai mult de {count} articole ...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Se aștepta o listă de elemente, dar s-a primit tip \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Această selecție nu poate fi goală.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" nu este o cale validă.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Nu a fost trimis nici un fișier.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Datele prezentate nu sunt un fișier. Verificați tipul de codificare de pe formular.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Numele fișierului nu a putut fi determinat.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Fișierul trimis este gol.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Asigurați-vă că acest nume de fișier are cel mult {max_length} caractere (momentan are {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Încărcați o imagine validă. Fișierul încărcat a fost fie nu o imagine sau o imagine coruptă.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Această listă nu poate fi goală.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Se aștepta un dicționar de obiecte, dar s-a primit tipul \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Valoarea trebuie să fie JSON valid.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Căutare\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Ordonare\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"ascendent\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"descendent\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Pagină nevalidă.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Cursor nevalid\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Pk \\\"{pk_value}\\\" nevalid - obiectul nu există.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Tip incorect. Se aștepta un pk, dar s-a primit \\\"{data_type}\\\".\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Hyperlink nevalid - Nici un URL nu se potrivește.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Hyperlink nevalid - Potrivire URL incorectă.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Hyperlink nevalid - Obiectul nu există.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Tip incorect. Se aștepta un URL, dar s-a primit \\\"{data_type}\\\".\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Obiectul cu {slug_name}={value}  nu există.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Valoare nevalidă.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Date nevalide. Se aștepta un dicționar de obiecte, dar s-a primit \\\"{datatype}\\\".\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtre\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Nici unul/una\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Nu există elemente pentru a fi selectate.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Acest câmp trebuie să fie unic.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Câmpurile {field_names} trebuie să formeze un set unic.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Acest câmp trebuie să fie unic pentru data \\\"{date_field}\\\".\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Acest câmp trebuie să fie unic pentru luna \\\"{date_field}\\\".\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Acest câmp trebuie să fie unic pentru anul \\\"{date_field}\\\".\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Versiune nevalidă în antetul \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Versiune nevalidă în calea URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Versiune nevalidă în calea URL. Nu se potrivește cu niciun spațiu de nume al versiunii.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Versiune nevalidă în numele de gazdă.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Versiune nevalidă în parametrul de interogare.\"\n"
  },
  {
    "path": "rest_framework/locale/ru/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Anton Bazhanov <bazanton@yandex.ru>, 2018\n# Grigory Mishchenko <grishkokot@gmail.com>, 2017\n# Kirill Tarasenko, 2015\n# koodjo <koodjo@mail.ru>, 2015\n# Mike TUMS <mktums@gmail.com>, 2015\n# Sergei Sinitsyn <sinitsynsv@yandex.ru>, 2016\n# Val Grom <bygreez@gmail.com>, 2020\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Russian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ru/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: ru\\n\"\n\"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Недопустимый заголовок. Не предоставлены учетные данные.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Недопустимый заголовок. Учетные данные не должны содержать пробелов.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Недопустимый заголовок. Учетные данные некорректно закодированны в base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Недопустимые имя пользователя или пароль.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Пользователь неактивен или удален.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Недопустимый заголовок токена. Не предоставлены учетные данные.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Недопустимый заголовок токена. Токен не должен содержать пробелов.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Недопустимый заголовок токена. Токен не должен содержать недопустимые символы.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Недопустимый токен.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Токен аутентификации\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Ключ\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Пользователь\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Создан\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Токен\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Токены\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Имя пользователя\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Пароль\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Невозможно войти с предоставленными учетными данными.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Должен включать \\\"username\\\" и \\\"password\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Произошла ошибка сервера.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Искаженный запрос.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Некорректные учетные данные.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Учетные данные не были предоставлены.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"У вас нет прав для выполнения этой операции.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Не найдено.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Метод \\\"{method}\\\" не разрешен.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Невозможно удовлетворить \\\"Accept\\\" заголовок запроса.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Неподдерживаемый тип данных \\\"{media_type}\\\" в запросе.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Запрос был проигнорирован.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Это поле обязательно.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Это поле не может быть null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Это поле не может быть пустым.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Убедитесь, что в этом поле не больше {max_length} символов.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Убедитесь, что в этом поле как минимум {min_length} символов.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Введите корректный адрес электронной почты.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Значение не соответствует требуемому паттерну.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Введите корректный \\\"slug\\\", состоящий из букв, цифр, знаков подчеркивания или дефисов.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Введите корректный URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Введите действительный адрес IPv4 или IPv6.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Требуется целочисленное значение.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Убедитесь, что значение меньше или равно {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Убедитесь, что значение больше или равно {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Слишком длинное значение.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Требуется численное значение.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Убедитесь, что в числе не больше {max_digits} знаков.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Убедитесь, что в числе не больше {max_decimal_places} знаков в дробной части.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Убедитесь, что в числе не больше {max_whole_digits} знаков в целой части.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Неправильный формат datetime. Используйте один из этих форматов:  {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Ожидался datetime, но был получен date.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Неправильный формат date. Используйте один из этих форматов: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Ожидался date, но был получен datetime.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Неправильный формат времени. Используйте один из этих форматов: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Неправильный формат. Используйте один из этих форматов: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" не является корректным значением.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Элементов больше чем {count}\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Ожидался list со значениями, но был получен \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Выбор не может быть пустым.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" не является корректным путем до файла\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Не был загружен файл.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Загруженный файл не является корректным файлом.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Невозможно определить имя файла.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Загруженный файл пуст.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Убедитесь, что имя файла меньше {max_length} символов (сейчас {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Загрузите корректное изображение. Загруженный файл не является изображением, либо является испорченным.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Этот список не может быть пустым.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Ожидался словарь со значениями, но был получен \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Значение должно быть правильным JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Поиск\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Порядок сортировки\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"по возрастанию\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"по убыванию\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Неправильная страница\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Не корректный курсор\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Недопустимый первичный ключ \\\"{pk_value}\\\" - объект не существует.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Некорректный тип. Ожидалось значение первичного ключа, получен {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Недопустимая ссылка - нет совпадения по URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Недопустимая ссылка - некорректное совпадение по URL,\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Недопустимая ссылка - объект не существует.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Некорректный тип. Ожидался URL, получен {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Объект с {slug_name}={value} не существует.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Недопустимое значение.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Недопустимые данные. Ожидался dictionary, но был получен {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Фильтры\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Ничего\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Нет элементов для выбора\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Это поле должно быть уникально.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Поля {field_names} должны производить массив с уникальными значениями.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Это поле должно быть уникально для даты \\\"{date_field}\\\".\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Это поле должно быть уникально для месяца \\\"{date_field}\\\".\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Это поле должно быть уникально для года \\\"{date_field}\\\".\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Недопустимая версия в заголовке \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Недопустимая версия в пути URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Недопустимая версия в пути URL. Не соответствует ни одному version namespace.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Недопустимая версия в имени хоста.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Недопустимая версия в параметре запроса.\"\n"
  },
  {
    "path": "rest_framework/locale/ru_RU/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Anton Bazhanov <bazanton@yandex.ru>, 2018-2019\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Russian (Russia) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ru_RU/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: ru_RU\\n\"\n\"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Пожалуйста, введите корректные имя пользователя и пароль учётной записи. Оба поля могут быть чувствительны к регистру.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Пользователь неактивен или удален.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Недействительный токен.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Ключ\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Пользователь\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Имя пользователя\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Пароль\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Ошибка сервера.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"У вас недостаточно прав для выполнения данного действия.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Страница не найдена.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Обязательное поле.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Это поле не может быть пустым.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Это поле не может быть пустым.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Убедитесь, что это значение содержит не более {max_length} символов.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Убедитесь, что это значение содержит не менее {min_length} символов.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Введите правильный адрес электронной почты.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Значение должно состоять только из букв, цифр, символов подчёркивания или дефисов, входящих в стандарт Юникод.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Введите правильный URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Введите действительный IPv4 или IPv6 адрес.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Введите правильное число.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Убедитесь, что это значение меньше либо равно {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Убедитесь, что это значение больше либо равно {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Убедитесь, что вы ввели не более {max_digits} цифры.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Убедитесь, что вы ввели не более {max_decimal_places} цифры после запятой.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Убедитесь, что вы ввели не более {max_whole_digits} цифры перед запятой.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"Значения {input} нет среди допустимых вариантов.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Ни одного файла не было отправлено.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Отправленный файл пуст.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Убедитесь, что это имя файла содержит не более {max_length} символов (сейчас {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Загрузите правильное изображение. Файл, который вы загрузили, поврежден или не является изображением.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Сортировка\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"по возрастанию\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"по убыванию\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Введите правильное значение.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Фильтры\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Значения поля должны быть уникальны.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/sk/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Stanislav Komanec <stano@videoflot.com>, 2015\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Slovak (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/sk/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: sk\\n\"\n\"Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n == 1 ? 0 : n % 1 == 0 && n >= 2 && n <= 4 ? 1 : n % 1 != 0 ? 2: 3);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Nesprávna hlavička. Neboli poskytnuté prihlasovacie údaje.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Nesprávna hlavička. Prihlasovacie údaje nesmú obsahovať medzery.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Nesprávna hlavička. Prihlasovacie údaje nie sú správne zakódované pomocou metódy base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Nesprávne prihlasovacie údaje.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Daný používateľ je neaktívny, alebo zmazaný.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Nesprávna token hlavička. Neboli poskytnuté prihlasovacie údaje.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Nesprávna token hlavička. Token hlavička nesmie obsahovať medzery.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Nesprávny token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"S danými prihlasovacími údajmi nebolo možné sa prihlásiť.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Musí obsahovať parametre \\\"používateľské meno\\\" a \\\"heslo\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Vyskytla sa chyba na strane servera.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Požiadavok má nesprávny formát, alebo je poškodený.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Nesprávne prihlasovacie údaje.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Prihlasovacie údaje neboli zadané.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"K danej akcii nemáte oprávnenie.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Nebolo nájdené.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metóda \\\"{method}\\\" nie je povolená.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Nie je možné vyhovieť požiadavku v hlavičke \\\"Accept\\\".\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Požiadavok obsahuje nepodporovaný media type: \\\"{media_type}\\\".\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Požiadavok bol obmedzený, z dôvodu prekročenia limitu.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Toto pole je povinné.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Toto pole nemôže byť nulové.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Toto pole nemože byť prázdne.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Uistite sa, že toto pole nemá viac ako {max_length} znakov.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Uistite sa, že toto pole má viac ako {min_length} znakov.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Vložte správnu emailovú adresu.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Toto pole nezodpovedá požadovanému formátu.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Zadajte platný \\\"slug\\\", ktorý obsahuje len malé písmená, čísla, spojovník alebopodtržítko.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Zadajte platnú URL adresu.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Je vyžadované celé číslo.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Uistite sa, že hodnota je menšia alebo rovná {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Uistite sa, že hodnota je väčšia alebo rovná {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Zadaný textový reťazec je príliš dlhý.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Je vyžadované číslo.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Uistite sa, že hodnota neobsahuje viac ako {max_digits} cifier.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Uistite sa, že hodnota neobsahuje viac ako {max_decimal_places}  desatinných miest.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Uistite sa, že hodnota neobsahuje viac ako {max_whole_digits} cifier pred desatinnou čiarkou.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Nesprávny formát dátumu a času. Prosím použite jeden z nasledujúcich formátov: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Vložený len dátum - date namiesto dátumu a času - datetime.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Nesprávny formát dátumu. Prosím použite jeden z nasledujúcich formátov: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Vložený dátum a čas - datetime namiesto jednoduchého dátumu - date.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Nesprávny formát času. Prosím použite jeden z nasledujúcich formátov: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" je nesprávny výber z daných možností.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Bol očakávaný zoznam položiek, no namiesto toho bol nájdený \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Nebol odoslaný žiadny súbor.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Odoslané dáta neobsahujú súbor. Prosím skontrolujte kódovanie - encoding type daného formuláru.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Nebolo možné určiť meno súboru.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Odoslaný súbor je prázdny.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Uistite sa, že meno súboru neobsahuje viac ako {max_length} znakov. (V skutočnosti ich má   {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Uploadujte prosím obrázok. Súbor, ktorý ste uploadovali buď nie je obrázok, alebo daný obrázok je poškodený.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Bol očakávaný slovník položiek, no namiesto toho bol nájdený \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Nesprávny kurzor.\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Nesprávny primárny kľúč \\\"{pk_value}\\\" - objekt s daným primárnym kľúčom neexistuje.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Nesprávny typ. Bol prijatý {data_type} namiesto primárneho kľúča.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Nesprávny hypertextový odkaz - žiadna zhoda.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Nesprávny hypertextový odkaz - chybná URL.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Nesprávny hypertextový odkaz - požadovný objekt neexistuje.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Nesprávny typ {data_type}. Požadovaný typ: hypertextový odkaz.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objekt, ktorého atribút \\\"{slug_name}\\\" je \\\"{value}\\\" neexistuje.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Nesprávna hodnota.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Bol očakávaný slovník položiek, no namiesto toho bol nájdený \\\"{datatype}\\\".\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Táto položka musí byť unikátna.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Dané položky:  {field_names} musia tvoriť musia spolu tvoriť unikátnu množinu.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Položka musí byť pre špecifický deň \\\"{date_field}\\\" unikátna.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Položka musí byť pre mesiac \\\"{date_field}\\\" unikátna.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Položka musí byť pre rok \\\"{date_field}\\\" unikátna.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Nesprávna verzia v \\\"Accept\\\" hlavičke.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Nesprávna verzia v URL adrese.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Nesprávna verzia v \\\"hostname\\\".\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Nesprávna verzia v parametri požiadavku.\"\n"
  },
  {
    "path": "rest_framework/locale/sl/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Gregor Cimerman, 2017\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Slovenian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/sl/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: sl\\n\"\n\"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Napačno enostavno zagalvje. Ni podanih poverilnic.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Napačno enostavno zaglavje. Poverilniški niz ne sme vsebovati presledkov.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Napačno enostavno zaglavje. Poverilnice niso pravilno base64 kodirane.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Napačno uporabniško ime ali geslo.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Uporabnik neaktiven ali izbrisan.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Neveljaven žeton v zaglavju. Ni vsebovanih poverilnic.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Neveljaven žeton v zaglavju. Žeton ne sme vsebovati presledkov.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Neveljaven žeton v zaglavju. Žeton ne sme vsebovati napačnih znakov.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Neveljaven žeton.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Prijavni žeton\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Ključ\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Uporabnik\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Ustvarjen\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Žeton\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Žetoni\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Uporabniško ime\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Geslo\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Neuspešna prijava s podanimi poverilnicami.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Mora vsebovati \\\"uporabniško ime\\\" in \\\"geslo\\\".\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Napaka na strežniku.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Okvarjen zahtevek.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Napačni avtentikacijski podatki.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Avtentikacijski podatki niso bili podani.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Nimate dovoljenj za izvedbo te akcije.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Ni najdeno\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metoda \\\"{method}\\\" ni dovoljena\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Ni bilo mogoče zagotoviti zaglavja Accept zahtevka.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Nepodprt medijski tip \\\"{media_type}\\\" v zahtevku.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Zahtevek je bil pridržan.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"To polje je obvezno.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"To polje ne sme biti null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"To polje ne sme biti prazno.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"To polje ne sme biti daljše od {max_length} znakov.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"To polje mora vsebovati vsaj {min_length} znakov.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Vnesite veljaven elektronski naslov.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Ta vrednost ne ustreza zahtevanemu vzorcu.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Vnesite veljaven \\\"slug\\\", ki vsebuje črke, številke, podčrtaje ali vezaje.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Vnesite veljaven URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Vnesite veljaven IPv4 ali IPv6 naslov.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Zahtevano je veljavno celo število.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Vrednost mora biti manjša ali enaka {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Vrednost mora biti večija ali enaka {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Niz je prevelik.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Zahtevano je veljavno število.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Vnesete lahko največ {max_digits} števk.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Vnesete lahko največ {max_decimal_places} decimalnih mest.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Vnesete lahko največ {max_whole_digits} števk pred decimalno piko.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datim in čas v napačnem formatu. Uporabite eno izmed naslednjih formatov: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Pričakovan datum in čas, prejet le datum.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datum je v napačnem formatu. Uporabnite enega izmed naslednjih: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Pričakovan datum vendar prejet datum in čas.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Čas je v napačnem formatu. Uporabite enega izmed naslednjih: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Trajanje je v napačnem formatu. Uporabite enega izmed naslednjih: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" ni veljavna izbira.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Več kot {count} elementov...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Pričakovan seznam elementov vendar prejet tip \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Ta izbria ne sme ostati prazna.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" ni veljavna izbira poti.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Datoteka ni bila oddana.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Oddani podatki niso datoteka. Preverite vrsto kodiranja na formi.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Imena datoteke ni bilo mogoče določiti.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Oddana datoteka je prazna.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Ime datoteke lahko vsebuje največ {max_length} znakov (ta jih ima {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Naložite veljavno sliko. Naložena datoteka ni bila slika ali pa je okvarjena.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Seznam ne sme biti prazen.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Pričakovan je slovar elementov, prejet element je tipa \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Vrednost mora biti veljaven JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Iskanje\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Razvrščanje\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"naraščujoče\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"padajoče\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Neveljavna stran.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Neveljaven kazalec\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Neveljaven pk \\\"{pk_value}\\\" - objekt ne obstaja.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Neveljaven tip. Pričakovana vrednost pk, prejet {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Neveljavna povezava - Ni URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Ni veljavna povezava - Napačen URL.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Ni veljavna povezava - Objekt ne obstaja.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Napačen tip. Pričakovan URL niz, prejet {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objekt z {slug_name}={value} ne obstaja.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Neveljavna vrednost.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Napačni podatki. Pričakovan slovar, prejet {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtri\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"None\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Ni elementov za izbiro.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"To polje mora biti unikatno.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Polja {field_names} morajo skupaj sestavljati unikaten niz.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Polje mora biti unikatno za \\\"{date_field}\\\" dan.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Polje mora biti unikatno za \\\"{date_field} mesec.\\\"\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Polje mora biti unikatno za \\\"{date_field}\\\" leto.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Neveljavna verzija v \\\"Accept\\\" zaglavju.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Neveljavna različca v poti URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Neveljavna različica v poti URL. Se ne ujema z nobeno različico imenskega prostora.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Neveljavna različica v imenu gostitelja.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Neveljavna verzija v poizvedbenem parametru.\"\n"
  },
  {
    "path": "rest_framework/locale/sv/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Frank Wickström <frwickst@gmail.com>, 2015\n# Joakim Soderlund, 2015-2016\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Swedish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/sv/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: sv\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Ogiltig \\\"basic\\\"-header. Inga användaruppgifter tillhandahölls.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Ogiltig \\\"basic\\\"-header. Strängen för användaruppgifterna ska inte innehålla mellanslag.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Ogiltig \\\"basic\\\"-header. Användaruppgifterna är inte korrekt base64-kodade.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Ogiltigt användarnamn/lösenord.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Användaren borttagen eller inaktiv.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Ogiltig \\\"token\\\"-header. Inga användaruppgifter tillhandahölls.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Ogiltig \\\"token\\\"-header. Strängen ska inte innehålla mellanslag.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Ogiltig \\\"token\\\"-header. Strängen ska inte innehålla ogiltiga tecken.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Ogiltig \\\"token\\\".\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Autentiseringstoken\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Nyckel\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Användare\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Skapad\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokens\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Användarnamn\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Lösenord\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Kunde inte logga in med de angivna inloggningsuppgifterna.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Användarnamn och lösenord måste anges.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Ett serverfel inträffade.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Ogiltig förfrågan.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Ogiltiga inloggningsuppgifter. \"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Autentiseringsuppgifter ej tillhandahållna.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Du har inte tillåtelse att utföra denna förfrågan.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Hittades inte.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Metoden \\\"{method}\\\" tillåts inte.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Kunde inte tillfredsställa förfrågans \\\"Accept\\\"-header.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Medietypen \\\"{media_type}\\\" stöds inte.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Förfrågan stoppades eftersom du har skickat för många.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Det här fältet är obligatoriskt.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Det här fältet får inte vara null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Det här fältet får inte vara blankt.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Se till att detta fält inte har fler än {max_length} tecken.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Se till att detta fält har minst {min_length} tecken.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Ange en giltig mejladress.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Det här värdet matchar inte mallen.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Ange en giltig \\\"slug\\\" bestående av bokstäver, nummer, understreck eller bindestreck.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Ange en giltig URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Ange en giltig IPv4- eller IPv6-adress.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Ett giltigt heltal krävs.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Se till att detta värde är mindre än eller lika med {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Se till att detta värde är större än eller lika med {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Textvärdet är för långt.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Ett giltigt nummer krävs.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Se till att det inte finns fler än totalt {max_digits} siffror.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Se till att det inte finns fler än {max_decimal_places} decimaler.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Se till att det inte finns fler än {max_whole_digits} siffror före decimalpunkten.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datumtiden har fel format. Använd ett av dessa format istället: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Förväntade en datumtid men fick ett datum.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datumet har fel format. Använde ett av dessa format istället: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Förväntade ett datum men fick en datumtid.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Tiden har fel format. Använd ett av dessa format istället: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Perioden har fel format. Använd ett av dessa format istället: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" är inte ett giltigt val.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Fler än {count} objekt...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Förväntade en lista med element men fick typen \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Det här valet får inte vara tomt.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" är inte ett giltigt val för en sökväg.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Ingen fil skickades.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Den skickade informationen var inte en fil. Kontrollera formulärets kodningstyp.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Inget filnamn kunde bestämmas.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Den skickade filen var tom.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Se till att det här filnamnet har högst {max_length} tecken (det har {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Ladda upp en giltig bild. Filen du laddade upp var antingen inte en bild eller en skadad bild.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Den här listan får inte vara tom.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Förväntade en \\\"dictionary\\\" med element men fick typen \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Värdet måste vara giltig JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Sök\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Ordning\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"stigande\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"fallande\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Ogiltig sida.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Ogiltig cursor.\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Ogiltigt pk \\\"{pk_value}\\\" - Objektet finns inte.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Felaktig typ. Förväntade pk-värde, fick {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Ogiltig hyperlänk - Ingen URL matchade.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Ogiltig hyperlänk - Felaktig URL-matching.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Ogiltig hyperlänk - Objektet finns inte.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Felaktig typ. Förväntade URL-sträng, fick {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Objekt med {slug_name}={value} finns inte.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Ogiltigt värde.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Ogiltig data. Förväntade en dictionary, men fick {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filter\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Inget\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Inga valbara objekt.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Det här fältet måste vara unikt.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Fälten {field_names} måste skapa ett unikt set.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Det här fältet måste vara unikt för datumet \\\"{date_field}\\\".\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Det här fältet måste vara unikt för månaden \\\"{date_field}\\\".\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Det här fältet måste vara unikt för året \\\"{date_field}\\\".\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Ogiltig version i \\\"Accept\\\"-headern.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Ogiltig version i URL-resursen.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Ogiltig version i URL-resursen. Matchar inget versions-namespace.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Ogiltig version i värdnamnet.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Ogiltig version i förfrågningsparametern.\"\n"
  },
  {
    "path": "rest_framework/locale/th/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Preeti Yuankrathok <preetisatit@gmail.com>, 2018\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Thai (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/th/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: th\\n\"\n\"Plural-Forms: nplurals=1; plural=0;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"ชื่อผู้ใช้งานหรือรหัสผ่านไม่ถูกต้อง\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"ผู้ใช้ไม่ได้เปิดใช้งานหรือถูกลบ\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Token ไม่ถูกต้อง\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Auth Token\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"คีย์\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"ผู้ใช้\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Token\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"ชื่อผู้ใช้งาน\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"รหัสผ่าน\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"ไม่สามารถเข้าสู่ระบบได้\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"จำเป็นต้องใส่ชื่อผู้ใช้งานและรหัสผ่าน\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"เซิร์ฟเวอร์เกิดข้อผิดพลาด\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"ข้อมูลการเข้าสู่ระบบไม่ถูกต้อง\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"ไม่พบข้อมูลการเข้าสู่ระบบ\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"คุณไม่มีสิทธิ์ที่จะดำเนินการ\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"ไม่พบ\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"ไม่ใช่อนุญาติให้ใช้ Method \\\"{method}\\\"\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"ไม่รองรับมีเดียประเภท \\\"{media_type}\\\" ใน Request\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"ฟิลด์นี้จำเป็น\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"ฟิลด์นี้จำเป็นต้องมีค่า\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"ฟิลด์นี้ไม่สามารถเว้นว่างได้\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"ตรวจสอบฟิลด์ว่ามีความยาวไม่เกิน {max_length} ตัวอักษร\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"ตรวตสอบฟิลด์ว่ามีความยาวอย่างน้อย {min_length} ตัวอักษร\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"กรอกอีเมลให้ถูกต้อง\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"ค่านี้ไม่ตรงกับรูปแบบที่ต้องการ\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"กรอกข้อมูลที่ประกอบด้วยตัวอักษร ตัวเลข สัญประกาศ และยัติภังค์เท่านั้น\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"กรอก URL ให้ถูกต้อง\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"กรอก IPv4 หรือ IPv6 ให้ถูกต้อง\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"ต้องการค่าจำนวนเต็มที่ถูกต้อง\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"ตรวจสอบว่าค่านี้น้อยกว่าหรือเท่ากับ {max_value}\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"ตรวจสอบว่าค่านี้มากกว่าหรือเท่ากับ {min_value}\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"ข้อความยาวเกินไป\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"ต้องการตัวเลขที่ถูกต้อง\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"ตรวจสอบตัวเลขว่ามีไม่เกิน {max_digits} ตัว\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"ตรวจสอบทศนิยมว่ามีไม่เกิน {max_decimal_places} หลัก\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"ตรวจสอบตัวเลขและทศนิยมรวมกันว่ามีไม่เกิน {max_whole_digits} ตัว\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"รูปแบบวันที่และเวลาไม่ถูกต้อง โปรดใช้รูปแบบใดรูปแบบหนึ่งจาก: {format}\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"ต้องการวันที่และเวลา แต่ได้รับเพียงวันที่\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"รูปแบบวันที่ไม่ถูกต้อง โปรดใช้รูปแบบใดรูปแบบหนึ่งจาก: {format}\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"ต้องการวันที่ แต่ได้รับวันที่และเวลา\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"รูปแบบเวลาไม่ถูกต้อง โปรดใช้รูปแบบใดรูปแบบหนึ่งจาก: {format}\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"รูปแบบระยะเวลาไม่ถูกต้อง โปรดใช้รูปแบบใดรูปแบบหนึ่งจาก: {format}\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" ไม่ใช่ตัวเลือกที่ถูกต้อง\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"มีมากกว่า {count} ไอเทม...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"ต้องการ List ของข้อมูล แต่ได้รับ \\\"{input_type}\\\"\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"ไม่พบไฟล์\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"ข้อมูลที่ส่งไม่ใช่ไฟล์ โปรดตรวจสอบการเข้ารหัสของฟอร์ม\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"ไม่สามารถระบุชื่อไฟล์ได้\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"ไฟล์ที่ส่งว่างเปล่า\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"List นี้ไม่สามารถว่างได้\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"ต้องการ Dictionary แต่ได้รับ \\\"{input_type}\\\"\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"ค่าจะต้องเป็น JSON ที่ถูกต้อง\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"ค้นหา\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"การเรียงลำดับ\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"น้อยไปมาก\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"มากไปน้อย\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"หน้าไม่ถูกต้อง\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"เคอร์เซอร์ไม่ถูกต้อง\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"ค่าไม่ถูกต้อง\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"ข้อมูลไม่ถูกต้อง ต้องการ Dictionary แต่ได้รับ {datatype}\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"การกรองข้อมูล\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"ไม่มี\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/tr/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Dogukan Tufekci <dogukan@creco.co>, 2015\n# Emrah BİLBAY <emrahbilbay@gmail.com>, 2015\n# Ertaç Paprat <epaprat@gmail.com>, 2015\n# José Luis <alagunajs@gmail.com>, 2016\n# Mesut Can Gürle <mesutcang@gmail.com>, 2015\n# Murat Çorlu <muratcorlu@me.com>, 2015\n# Recep KIRMIZI <rkirmizi@gmail.com>, 2015\n# Ülgen Sarıkavak <ulgensrkvk@gmail.com>, 2015\n# Sezer BOZKIR <natgho@hotmail.com>, 2025\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Turkish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/tr/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: tr\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Geçersiz yetkilendirme başlığı. Gerekli uygunluk kriterleri sağlanmamış.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Geçersiz yetkilendirme başlığı. Uygunluk kriterine ait veri boşluk karakteri içermemeli.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Geçersiz yetkilendirme başlığı. Uygunluk kriterleri base64 formatına uygun olarak kodlanmamış.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Geçersiz kullanıcı adı/parola\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Kullanıcı aktif değil ya da silinmiş.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Geçersiz token başlığı. Kimlik bilgileri eksik.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Geçersiz token başlığı. Token'da boşluk olmamalı.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Geçersiz token başlığı. Token geçersiz karakter içermemeli.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Geçersiz token.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Kimlik doğrulama belirteci\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Anahtar\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Kullanan\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Oluşturulan\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"İşaret\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"İşaretler\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Kullanıcı adı\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Şifre\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Verilen bilgiler ile giriş sağlanamadı.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\\\"Kullanıcı Adı\\\" ve \\\"Parola\\\" eklenmeli.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Sunucu hatası oluştu.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"Geçersiz girdi.\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Bozuk istek.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Giriş bilgileri hatalı.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Giriş bilgileri verilmedi.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Bu işlemi yapmak için izniniz bulunmuyor.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Bulunamadı.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\\\"{method}\\\" metoduna izin verilmiyor.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"İsteğe ait Accept başlık bilgisi yanıt verilecek başlık bilgileri arasında değil.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"İstekte desteklenmeyen medya tipi: \\\"{media_type}\\\".\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Üst üste çok fazla istek yapıldı.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"{wait} saniye içinde erişilebilir olması bekleniyor.\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"{wait} saniye içinde erişilebilir olması bekleniyor.\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Bu alan zorunlu.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Bu alan boş bırakılmamalı.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"Geçerli bir boolean olmalı.\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"Geçerli bir string değil.\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Bu alan boş bırakılmamalı.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Bu alanın {max_length} karakterden fazla karakter barındırmadığından emin olun.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Bu alanın en az {min_length} karakter barındırdığından emin olun.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Geçerli bir e-posta adresi girin.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Bu değer gereken düzenli ifade deseni ile uyuşmuyor.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Harf, rakam, altçizgi veya tireden oluşan geçerli bir \\\"slug\\\" giriniz.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Geçerli bir URL girin.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"Geçerli bir UUID olmalı.\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Geçerli bir IPv4 ya da IPv6 adresi girin.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Geçerli bir tam sayı girin.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Değerin {max_value} değerinden küçük ya da eşit olduğundan emin olun.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Değerin {min_value} değerinden büyük ya da eşit olduğundan emin olun.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"String değeri çok uzun.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Geçerli bir numara gerekiyor.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Toplamda {max_digits} haneden fazla hane olmadığından emin olun.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Ondalık basamak değerinin {max_decimal_places} haneden fazla olmadığından emin olun.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Ondalık ayracından önce {max_whole_digits} basamaktan fazla olmadığından emin olun.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datetime alanı yanlış biçimde. {format} biçimlerinden birini kullanın.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Datetime değeri bekleniyor, ama date değeri geldi.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\\\"{timezone}\\\" zaman dilimi için geçersiz datetime.\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"Datetime değeri aralığın dışında.\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Tarih biçimi yanlış. {format} biçimlerinden birini kullanın.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Date tipi beklenmekteydi, fakat datetime tipi geldi.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Time biçimi yanlış. {format} biçimlerinden birini kullanın.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Duration biçimi yanlış. {format} biçimlerinden birini kullanın.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" geçerli bir seçim değil.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"{count} elemandan daha fazla...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Elemanların listesi beklenirken \\\"{input_type}\\\" alındı.\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Bu seçim boş bırakılmamalı.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" geçerli bir yol seçimi değil.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Hiçbir dosya verilmedi.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Gönderilen veri dosya değil. Formdaki kodlama tipini kontrol edin.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Hiçbir dosya adı belirlenemedi.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Gönderilen dosya boş.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Bu dosya adının en fazla {max_length} karakter uzunluğunda olduğundan emin olun. (şu anda {length} karakter).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Geçerli bir resim yükleyin. Yüklediğiniz dosya resim değil ya da bozuk.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Bu liste boş olmamalı.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"Bu alanın en az {min_length} eleman içerdiğinden emin olun.\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"Bu alanın en fazla {max_length} eleman içerdiğinden emin olun.\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Sözlük tipi bir değişken beklenirken \\\"{input_type}\\\" tipi bir değişken alındı.\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"Bu sözlük boş olmamalı.\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Değer geçerli bir JSON olmalı.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Arama\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"Bir arama terimi.\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Sıralama\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"Sonuçların sıralanmasında kullanılacak alan.\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"artan\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"azalan\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"Sayfalanmış sonuç kümesinde bir sayfa numarası.\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"Her sayfada döndürülecek sonuç sayısı.\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Geçersiz sayfa.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"Döndürülecek sonuçların başlangıç indeksi.\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"Sayfalandırma imleci değeri.\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Sayfalandırma imleci geçersiz\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Geçersiz pk \\\"{pk_value}\\\" - obje bulunamadı.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Hatalı tip. Pk değeri beklenirken, alınan {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Geçersiz bağlantı - Hiçbir URL eşleşmedi.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Geçersiz bağlantı - Yanlış URL eşleşmesi.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Geçersiz bağlantı - Obje bulunamadı.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Hatalı tip. URL metni bekleniyor, {data_type} alındı.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"{slug_name}={value} değerini taşıyan obje bulunamadı.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Geçersiz değer.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"benzersiz tamsayı değeri\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"UUID metni\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"benzersiz değer\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"Bir {name} öğesini tanımlayan {value_type}.\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Geçersiz veri. Sözlük bekleniyordu fakat {datatype} geldi. \"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"Ekstra Eylemler\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtreler\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"navigasyon çubuğu\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"içerik\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"istek formu\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"ana içerik\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"istek bilgisi\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"cevap bilgisi\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Hiçbiri\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Seçenek yok.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Bu alan eşsiz olmalı.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"{field_names} hep birlikte eşsiz bir küme oluşturmalılar.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"Yerine konulmuş karakterlere izin verilmiyor: U+{code_point:X}.\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Bu alan \\\"{date_field}\\\" tarihine göre eşsiz olmalı.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Bu alan \\\"{date_field}\\\" ayına göre eşsiz olmalı.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Bu alan \\\"{date_field}\\\" yılına göre eşsiz olmalı.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\\\"Accept\\\" başlığındaki sürüm geçersiz.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"URL dizininde geçersiz versiyon.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Geçersiz versiyon URL dizininde. Hiçbir versiyon ad alanı ile eşleşmiyor.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Host adında geçersiz versiyon.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Sorgu parametresinde geçersiz versiyon.\"\n"
  },
  {
    "path": "rest_framework/locale/tr_TR/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Deniz <dakdeniz@hotmail.com>, 2019\n# José Luis <alagunajs@gmail.com>, 2015-2016\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Turkish (Turkey) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/tr_TR/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: tr_TR\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Geçersiz yetkilendirme başlığı. Gerekli uygunluk kriterleri sağlanmamış.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Geçersiz yetkilendirme başlığı. Uygunluk kriterine ait veri boşluk karakteri içermemeli.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Geçersiz yetkilendirme başlığı. Uygunluk kriterleri base64 formatına uygun olarak kodlanmamış.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Geçersiz kullanıcı adı / şifre.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Kullanıcı aktif değil ya da silinmiş\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Geçersiz token başlığı. Kimlik bilgileri eksik.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Geçersiz token başlığı. Token'da boşluk olmamalı.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Geçersiz token başlığı. Token geçersiz karakter içermemeli.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Geçersiz simge.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Kimlik doğrulama belirteci\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Anahtar\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Kullanan\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Oluşturulan\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"İşaret\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"İşaretler\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Kullanıcı adı\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Şifre\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Verilen bilgiler ile giriş sağlanamadı.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\\\"Kullanıcı Adı\\\" ve \\\"Parola\\\" eklenmeli.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Sunucu hatası oluştu.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Bozuk istek.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Giriş bilgileri hatalı.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Giriş bilgileri verilmedi.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Bu işlemi yapmak için izniniz bulunmuyor.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Bulunamadı.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\\\"{method}\\\" metoduna izin verilmiyor.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"İsteğe ait Accept başlık bilgisi yanıt verilecek başlık bilgileri arasında değil.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"İstekte desteklenmeyen medya tipi: \\\"{media_type}\\\".\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Üst üste çok fazla istek yapıldı.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Bu alan zorunlu.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Bu alan boş bırakılmamalı.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Bu alan boş bırakılmamalı.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Bu alanın {max_length} karakterden fazla karakter barındırmadığından emin olun.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Bu alanın en az {min_length} karakter barındırdığından emin olun.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Geçerli bir e-posta adresi girin.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Bu değer gereken düzenli ifade deseni ile uyuşmuyor.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Harf, rakam, altçizgi veya tireden oluşan geçerli bir \\\"slug\\\" giriniz.\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Geçerli bir URL girin.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Geçerli bir IPv4 ya da IPv6 adresi girin.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Geçerli bir tam sayı girin.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Değerin {max_value} değerinden küçük ya da eşit olduğundan emin olun.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Değerin {min_value} değerinden büyük ya da eşit olduğundan emin olun.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"String değeri çok uzun.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Geçerli bir numara gerekiyor.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Toplamda {max_digits} haneden fazla hane olmadığından emin olun.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Ondalık basamak değerinin {max_decimal_places} haneden fazla olmadığından emin olun.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Ondalık ayracından önce {max_whole_digits} basamaktan fazla olmadığından emin olun.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Datetime alanı yanlış biçimde. {format} biçimlerinden birini kullanın.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Datetime değeri bekleniyor, ama date değeri geldi.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Tarih biçimi yanlış. {format} biçimlerinden birini kullanın.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Date tipi beklenmekteydi, fakat datetime tipi geldi.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Time biçimi yanlış. {format} biçimlerinden birini kullanın.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Duration biçimi yanlış. {format} biçimlerinden birini kullanın.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" geçerli bir seçim değil.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"{count} elemandan daha fazla...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Elemanların listesi beklenirken \\\"{input_type}\\\" alındı.\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Bu seçim boş bırakılmamalı.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" geçerli bir yol seçimi değil.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Hiçbir dosya verilmedi.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Gönderilen veri dosya değil. Formdaki kodlama tipini kontrol edin.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Hiçbir dosya adı belirlenemedi.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Gönderilen dosya boş.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Bu dosya adının en fazla {max_length} karakter uzunluğunda olduğundan emin olun. (şu anda {length} karakter).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Geçerli bir resim yükleyin. Yüklediğiniz dosya resim değil ya da bozuk.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Bu liste boş olmamalı.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Sözlük tipi bir değişken beklenirken \\\"{input_type}\\\" tipi bir değişken alındı.\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Değer geçerli bir JSON olmalı.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Arama\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Sıralama\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"artan\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"azalan\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Geçersiz sayfa.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Geçersiz imleç.\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Geçersiz pk \\\"{pk_value}\\\" - obje bulunamadı.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Hatalı tip. Pk değeri beklenirken, alınan {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Geçersiz hyper link - URL maçı yok.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Geçersiz hyper link - Yanlış URL maçı.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Geçersiz hyper link - Nesne yok..\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Hatalı tip. URL metni bekleniyor, {data_type} alındı.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"{slug_name}={value} değerini taşıyan obje bulunamadı.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Geçersiz değer.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Geçersiz veri. Bir sözlük bekleniyor, ama var {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Filtreler\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Hiç kimse\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Seçenek yok.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Bu alan benzersiz olmalıdır.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"{field_names}  alanları benzersiz bir set yapmak gerekir.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Bu alan \\\"{date_field}\\\" tarihine göre eşsiz olmalı.\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Bu alan \\\"{date_field}\\\" ayına göre eşsiz olmalı.\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Bu alan \\\"{date_field}\\\" yılına göre eşsiz olmalı.\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\\\"Kabul et\\\" başlığında geçersiz sürümü.\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"URL yolunda geçersiz sürüm.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"URL yolunda geçersiz sürüm. Sürüm adlarında eşleşen bulunamadı.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Hostname geçersiz sürümü.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Sorgu parametresi geçersiz sürümü.\"\n"
  },
  {
    "path": "rest_framework/locale/uk/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Denis Podlesniy <haos616@gmail.com>, 2016\n# Illarion <khlyestovillarion@gmail.com>, 2016\n# Kirill Tarasenko, 2016,2018\n# Victor Mireyev <greymouse2005@ya.ru>, 2017\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Ukrainian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/uk/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: uk\\n\"\n\"Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"Недійсний основний заголовок. Облікові дані відсутні.\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"Недійсний основний заголовок. Строка з обліковими даними має бути без пробілів.\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"Недійсний основний заголовок. Облікові дані невірно закодовані у base64.\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Недійсне iм'я користувача/пароль.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Користувач неактивний або видалений.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"Недійсний токен. Облікові дані відсутні.\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"Недійсний токен. Значення токена не повинне містити пробіли.\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"Недійсний токен. Значення токена не повинне містити некоректні символи.\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"Недійсний токен.\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"Авторизаційний токен\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Ключ\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Користувач\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Створено\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Токен\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Токени\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Ім'я користувача\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Пароль\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Неможливо зайти з введеними даними.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Має включати iм'я користувача та пароль\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"Помилка сервера.\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"Некоректний запит.\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"Некоректні реквізити перевірки достовірності.\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"Реквізити перевірки достовірності не надані.\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"У вас нема дозволу робити цю дію.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Не знайдено.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Метод \\\"{method}\\\" не дозволений.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"Неможливо виконати запит заголовку Accept.\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"Непідтримуваний тип даних \\\"{media_type}\\\" в запиті.\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"Запит було проігноровано.\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"Це поле обов'язкове.\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"Це поле не може бути null.\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Це поле не може бути порожнім.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"Переконайтесь, що кількість символів в цьому полі не перевищує {max_length}.\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"Переконайтесь, що в цьому полі мінімум {min_length} символів.\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Введіть коректну адресу електронної пошти.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"Значення не відповідає необхідному патерну.\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"Введіть коректний \\\"slug\\\", що складається із букв, цифр, нижніх підкреслень або дефісів. \"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"Введіть коректний URL.\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"Введіть коректну IPv4 або IPv6 адресу.\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"Необхідне цілочисельне значення.\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"Переконайтесь, що значення менше або дорівнює {max_value}.\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"Переконайтесь, що значення більше або дорівнює {min_value}.\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"Строкове значення занадто велике.\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"Необхідне чисельне значення.\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"Переконайтесь, що в числі не більше {max_digits} знаків.\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"Переконайтесь, що в числі не більше {max_decimal_places} знаків у дробовій частині.\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"Переконайтесь, що в числі не більше {max_whole_digits} знаків у цілій частині.\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Невірний формат дата з часом. Використайте один з цих форматів: {format}.\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"Очікувалась дата з часом, але було отримано дату.\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Невірний формат дати. Використайте один з цих форматів: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"Очікувалась дата, але було отримано дату з часом.\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Неправильний формат часу. Використайте один з цих форматів: {format}.\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Невірний формат тривалості. Використайте один з цих форматів: {format}.\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" не є коректним вибором.\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"Елементів більше, ніж {count}...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Очікувався список елементів, але було отримано \\\"{input_type}\\\".\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"Вибір не може бути порожнім.\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\" вибраний шлях не є коректним.\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"Файл не було відправленно.\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"Відправленні дані не є файл. Перевірте тип кодування у формі.\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"Неможливо визначити ім'я файлу.\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"Відправленний файл порожній.\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"Переконайтесь, що ім'я файлу становить менше {max_length} символів (зараз {length}).\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"Завантажте коректне зображення. Завантажений файл або не є зображенням, або пошкоджений.\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"Цей список не може бути порожнім.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"Очікувався словник зі елементами, але було отримано \\\"{input_type}\\\".\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Значення повинно бути коректним JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Пошук\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Впорядкування\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"у порядку зростання\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"у порядку зменшення\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"Недійсна сторінка.\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"Недійсний курсор.\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"Недопустимий первинний ключ \\\"{pk_value}\\\" - об'єкт не існує.\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"Некоректний тип. Очікувалось значення первинного ключа, отримано {data_type}.\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"Недійсне посилання - немає збігу за URL.\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"Недійсне посилання - некоректний збіг за URL.\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"Недійсне посилання - об'єкт не існує.\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"Некоректний тип. Очікувався URL, отримано {data_type}.\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"Об'єкт із {slug_name}={value} не існує.\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"Недійсне значення.\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"Недопустимі дані. Очікувався словник, але було отримано {datatype}.\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"Фільтри\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"Нічого\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Немає елементів для вибору.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"Це поле повинне бути унікальним.\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"Поля {field_names} повинні створювати унікальний масив значень.\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"Це поле повинне бути унікальним для дати \\\"{date_field}\\\".\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"Це поле повинне бути унікальним для місяця \\\"{date_field}\\\".\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"Це поле повинне бути унікальним для року \\\"{date_field}\\\".\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"Недопустима версія в загаловку \\\"Accept\\\".\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"Недопустима версія в шляху URL.\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"Недопустима версія в шляху URL. Не співпадає з будь-яким простором версій.\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"Недопустима версія в імені хоста.\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"Недопустима версія в параметрі запиту.\"\n"
  },
  {
    "path": "rest_framework/locale/vi/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Nguyen Tuan Anh <bboyadao@gmail.com>, 2019\n# Xavier Ordoquy <xordoquy@linovia.com>, 2020\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 20:02+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Vietnamese (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/vi/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: vi\\n\"\n\"Plural-Forms: nplurals=1; plural=0;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"Sai tên đăng nhập hoặc mật khẩu.\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"Người dùng không còn hoạt động, hoặc đã bị xoá.\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"Khoá\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"Người dùng\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"Đã tạo\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"Tên người dùng\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"Mật khẩu\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"Không thể đăng nhập với thông tin đã nhập.\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"Bắt buộc phải có “tên người dùng” và “mật khẩu”.\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"Bạn không được cấp quyền để thực hiện hành động này.\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"Không tìm thấy.\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"Phương thức “{method}” không được chấp nhận.\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"Trường này không được bỏ trống.\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"Nhập một địa chỉ email hợp lệ.\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"Ngày sai định dạng. Dùng một trong những định dạng sau để thay thế: {format}.\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \" Danh sách này không thể để trống.\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"Giá trị bắt buộc phải là định dạng JSON.\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"Tìm kiếm\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"Sắp xếp\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"Không có gì để chọn.\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/zh_CN/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# hunter007 <wentao79@gmail.com>, 2015\n# Lele Long <schemacs@gmail.com>, 2015,2017\n# Ming Chen <mockey.chen@gmail.com>, 2015-2016\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Chinese (China) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/zh_CN/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: zh_CN\\n\"\n\"Plural-Forms: nplurals=1; plural=0;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"无效的Basic认证头，没有提供认证信息。\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"认证字符串不应该包含空格（基本认证HTTP头无效）。\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"认证字符串base64编码错误（基本认证HTTP头无效）。\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"用户名或者密码错误。\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"用户未激活或者已删除。\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"没有提供认证信息（认证令牌HTTP头无效）。\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"认证令牌字符串不应该包含空格（无效的认证令牌HTTP头）。\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"无效的Token。Token字符串不能包含非法的字符。\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"认证令牌无效。\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"认证令牌\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"键\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"用户\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"已创建\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"令牌\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"令牌\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"用户名\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"密码\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"无法使用提供的认证信息登录。\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"必须包含 “用户名” 和 “密码”。\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"服务器出现了错误。\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"错误的请求。\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"不正确的身份认证信息。\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"身份认证信息未提供。\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"您没有执行该操作的权限。\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"未找到。\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"方法 “{method}” 不被允许。\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"无法满足Accept HTTP头的请求。\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"不支持请求中的媒体类型 “{media_type}”。\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"请求超过了限速。\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"该字段是必填项。\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"该字段不能为 null。\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"该字段不能为空。\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"请确保这个字段不能超过 {max_length} 个字符。\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"请确保这个字段至少包含 {min_length} 个字符。\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"请输入合法的邮件地址。\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"输入值不匹配要求的模式。\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"请输入合法的“短语“，只能包含字母，数字，下划线或者中划线。\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"请输入合法的URL。\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"请输入一个有效的IPv4或IPv6地址。\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"请填写合法的整数值。\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"请确保该值小于或者等于 {max_value}。\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"请确保该值大于或者等于 {min_value}。\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"字符串值太长。\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"请填写合法的数字。\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"请确保总计不超过 {max_digits} 个数字。\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"请确保总计不超过 {max_decimal_places} 个小数位。\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"请确保小数点前不超过 {max_whole_digits} 个数字。\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"日期时间格式错误。请从这些格式中选择：{format}。\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"期望为日期时间，得到的是日期。\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"日期格式错误。请从这些格式中选择：{format}。\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"期望为日期，得到的是日期时间。\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"时间格式错误。请从这些格式中选择：{format}。\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"持续时间的格式错误。使用这些格式中的一个：{format}。\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"“{input}” 不是合法选项。\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"多于{count}条记录。\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"期望为一个包含物件的列表，得到的类型是“{input_type}”。\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"这项选择不能为空。\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"“{input}” 不是\b有效路径选项。\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"没有提交任何文件。\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"提交的数据不是一个文件。请检查表单的编码类型。\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"无法检测到文件名。\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"提交的是空文件。\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"确保该文件名最多包含 {max_length} 个字符 ( 当前长度为{length} ) 。\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"请上传有效图片。您上传的该文件不是图片或者图片已经损坏。\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"列表字段不能为空值。\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"请确保这个字段至少包含 {min_length} 个元素。\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"请确保这个字段不能超过 {max_length} 个元素。\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"期望是包含类目的字典，得到类型为 “{input_type}”。\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"这个字典可能不是空的。\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"值必须是有效的 JSON 数据。\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"查找\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"排序\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"升序\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"降序\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"无效页。\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"无效游标\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"无效主键 “{pk_value}” － 对象不存在。\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"类型错误。期望为主键，得到的类型为 {data_type}。\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"无效超链接 －没有匹配的URL。\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"无效超链接 －错误的URL匹配。\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"无效超链接 －对象不存在。\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"类型错误。期望为URL字符串，实际的类型是 {data_type}。\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"属性 {slug_name} 为 {value} 的对象不存在。\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"无效值。\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"无效数据。期待为字典类型，得到的是 {datatype} 。\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"过滤器\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"无\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"没有可选项。\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"该字段必须唯一。\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"字段 {field_names} 必须能构成唯一集合。\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"该字段必须在日期 “{date_field}” 唯一。\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"该字段必须在月份 “{date_field}” 唯一。\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"该字段必须在年 “{date_field}” 唯一。\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"“Accept” HTTP头包含无效版本。\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"URL路径包含无效版本。\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"URL路径中存在无效版本。版本空间中无法匹配上。\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"主机名包含无效版本。\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"请求参数里包含无效版本。\"\n"
  },
  {
    "path": "rest_framework/locale/zh_Hans/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# cokky <cokkywu@gmail.com>, 2015\n# hunter007 <wentao79@gmail.com>, 2015\n# 3eb8e7e672c2428f1223e00920bfd2b3, 2015\n# ppppfly <mpang@gizwits.com>, 2017\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Chinese Simplified (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/zh-Hans/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: zh-Hans\\n\"\n\"Plural-Forms: nplurals=1; plural=0;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"无效的Basic认证头，没有提供认证信息。\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"认证字符串不应该包含空格（基本认证HTTP头无效）。\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"认证字符串base64编码错误（基本认证HTTP头无效）。\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"用户名或者密码错误。\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"用户未激活或者已删除。\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"没有提供认证信息（认证令牌HTTP头无效）。\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"认证令牌字符串不应该包含空格（无效的认证令牌HTTP头）。\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"无效的Token。Token字符串不能包含非法的字符。\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"认证令牌无效。\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"认证令牌\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"键\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"用户\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"已创建\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"令牌\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"令牌\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"用户名\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"密码\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"无法使用提供的认证信息登录。\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"必须包含 “用户名” 和 “密码”。\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"服务器出现了错误。\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"无效的输入。\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"错误的请求。\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"不正确的身份认证信息。\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"身份认证信息未提供。\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"您没有执行该操作的权限。\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"未找到。\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"方法 “{method}” 不被允许。\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"无法满足Accept HTTP头的请求。\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"不支持请求中的媒体类型 “{media_type}”。\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"请求已被限流。\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"预计 {wait} 秒后可用。\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"预计 {wait} 秒后可用。\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"该字段是必填项。\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"该字段不能为 null。\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"必须是有效的布尔值。\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"不是有效的字符串。\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"该字段不能为空。\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"请确保这个字段不能超过 {max_length} 个字符。\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"请确保这个字段至少包含 {min_length} 个字符。\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"请输入合法的邮件地址。\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"输入值不匹配要求的模式。\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"请输入合法的“短语“，只能包含字母，数字，下划线或者中划线。\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"请输入有效的“slug”，由 Unicode 字母、数字、下划线或连字符组成。\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"请输入合法的URL。\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"必须是有效的 UUID。\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"请输入一个有效的IPv4或IPv6地址。\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"请填写合法的整数值。\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"请确保该值小于或者等于 {max_value}。\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"请确保该值大于或者等于 {min_value}。\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"字符串值太长。\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"请填写合法的数字。\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"请确保总计不超过 {max_digits} 个数字。\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"请确保总计不超过 {max_decimal_places} 个小数位。\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"请确保小数点前不超过 {max_whole_digits} 个数字。\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"日期时间格式错误。请从这些格式中选择：{format}。\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"期望为日期时间，获得的是日期。\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"时区“{timezone}”的时间格式无效。\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"时间数值超出有效范围。\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"日期格式错误。请从这些格式中选择：{format}。\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"期望为日期，获得的是日期时间。\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"时间格式错误。请从这些格式中选择：{format}。\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"持续时间的格式错误。使用这些格式中的一个：{format}。\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"“{input}” 不是合法选项。\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"多于{count}条记录。\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"期望为一个包含物件的列表，得到的类型是“{input_type}”。\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"这项选择不能为空。\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\\\"{input}\\\"不是一个有效路径选项。\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"没有提交任何文件。\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"提交的数据不是一个文件。请检查表单的编码类型。\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"无法检测到文件名。\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"提交的是空文件。\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"确保该文件名最多包含 {max_length} 个字符 ( 当前长度为{length} ) 。\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"请上传有效图片。您上传的该文件不是图片或者图片已经损坏。\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"列表不能为空。\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"该字段必须包含至少 {min_length} 个元素。\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"该字段不能超过 {max_length} 个元素。\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"期望是包含类目的字典，得到类型为 “{input_type}”。\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"该字典不能为空。\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"值必须是有效的 JSON 数据。\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \" 搜索\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"搜索关键词。\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"排序\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"用于排序结果的字段。\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"正排序\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"倒排序\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"分页结果集中的页码。\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"每页返回的结果数量。\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"无效页面。\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"返回结果的起始索引位置。\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"分页游标值\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"无效游标\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"无效主键 “{pk_value}” － 对象不存在。\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"类型错误。期望为主键，获得的类型为 {data_type}。\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"无效超链接 －没有匹配的URL。\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"无效超链接 －错误的URL匹配。\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"无效超链接 －对象不存在。\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"类型错误。期望为URL字符串，实际的类型是 {data_type}。\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"属性 {slug_name} 为 {value} 的对象不存在。\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"无效值。\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"唯一整数值\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"UUID 字符串\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"唯一值\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"标识此 {name} 的 {value_type}。\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"无效数据。期待为字典类型，得到的是 {datatype} 。\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"扩展操作\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"过滤器\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"导航栏\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"内容主体\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"请求表单\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"主要内容区\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"请求信息\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"响应信息\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"无\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"没有可选项。\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"该字段必须唯一。\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"字段 {field_names} 必须能构成唯一集合。\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"不允许使用代理字符: U+{code_point:X}。\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"该字段必须在日期 “{date_field}” 唯一。\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"该字段必须在月份 “{date_field}” 唯一。\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"该字段必须在年 “{date_field}” 唯一。\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"“Accept” HTTP头包含无效版本。\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"URL路径包含无效版本。\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"在URL路径中发现无效的版本。无法匹配任何的版本命名空间。\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"主机名包含无效版本。\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"请求参数里包含无效版本。\"\n"
  },
  {
    "path": "rest_framework/locale/zh_Hant/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\n# Matsui Lin <matsuilin101@gmail.com>, 2019\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2020-10-13 21:45+0200\\n\"\n\"PO-Revision-Date: 2020-10-13 19:45+0000\\n\"\n\"Last-Translator: Xavier Ordoquy <xordoquy@linovia.com>\\n\"\n\"Language-Team: Chinese Traditional (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/zh-Hant/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: zh-Hant\\n\"\n\"Plural-Forms: nplurals=1; plural=0;\\n\"\n\n#: authentication.py:70\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:83\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:101\nmsgid \"Invalid username/password.\"\nmsgstr \"無效的使用者名稱及密碼。\"\n\n#: authentication.py:104 authentication.py:206\nmsgid \"User inactive or deleted.\"\nmsgstr \"帳號未啟用或已被刪除。\"\n\n#: authentication.py:184\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:187\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:193\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:203\nmsgid \"Invalid token.\"\nmsgstr \"無效的token。\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"驗證 Token\"\n\n#: authtoken/models.py:13\nmsgid \"Key\"\nmsgstr \"金鑰\"\n\n#: authtoken/models.py:16\nmsgid \"User\"\nmsgstr \"使用者\"\n\n#: authtoken/models.py:18\nmsgid \"Created\"\nmsgstr \"建立者\"\n\n#: authtoken/models.py:27 authtoken/serializers.py:19\nmsgid \"Token\"\nmsgstr \"Token\"\n\n#: authtoken/models.py:28\nmsgid \"Tokens\"\nmsgstr \"Tokens\"\n\n#: authtoken/serializers.py:9\nmsgid \"Username\"\nmsgstr \"使用者名稱\"\n\n#: authtoken/serializers.py:13\nmsgid \"Password\"\nmsgstr \"密碼\"\n\n#: authtoken/serializers.py:35\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:38\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"必須包含使用者名稱及密碼。\"\n\n#: exceptions.py:102\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:142\nmsgid \"Invalid input.\"\nmsgstr \"\"\n\n#: exceptions.py:161\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:167\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:173\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:179\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"你沒有執行此操作的權限。\"\n\n#: exceptions.py:185\nmsgid \"Not found.\"\nmsgstr \"找不到資源。\"\n\n#: exceptions.py:191\n#, python-brace-format\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"不被允許的方法 \\\"{method}\\\"。\"\n\n#: exceptions.py:202\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:212\n#, python-brace-format\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:223\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: exceptions.py:224\n#, python-brace-format\nmsgid \"Expected available in {wait} second.\"\nmsgstr \"\"\n\n#: exceptions.py:225\n#, python-brace-format\nmsgid \"Expected available in {wait} seconds.\"\nmsgstr \"\"\n\n#: fields.py:316 relations.py:245 relations.py:279 validators.py:90\n#: validators.py:183\nmsgid \"This field is required.\"\nmsgstr \"此為必需欄位。\"\n\n#: fields.py:317\nmsgid \"This field may not be null.\"\nmsgstr \"此欄位不可為null。\"\n\n#: fields.py:701\nmsgid \"Must be a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:766\nmsgid \"Not a valid string.\"\nmsgstr \"\"\n\n#: fields.py:767\nmsgid \"This field may not be blank.\"\nmsgstr \"此欄位不可為空白。\"\n\n#: fields.py:768 fields.py:1881\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"請確認此欄位字元長度不超過 {max_length}。\"\n\n#: fields.py:769\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"請確認此欄位字元長度最少超過 {min_length}。\"\n\n#: fields.py:816\nmsgid \"Enter a valid email address.\"\nmsgstr \"請輸入有效的電子郵件地址。\"\n\n#: fields.py:827\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:838\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:839\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of Unicode letters, numbers, underscores, \"\n\"or hyphens.\"\nmsgstr \"\"\n\n#: fields.py:854\nmsgid \"Enter a valid URL.\"\nmsgstr \"請輸入有效的URL。\"\n\n#: fields.py:867\nmsgid \"Must be a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:903\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"請輸入有效的 IPv4 或 IPv6 地址。\"\n\n#: fields.py:931\nmsgid \"A valid integer is required.\"\nmsgstr \"請輸入有效的整數值。\"\n\n#: fields.py:932 fields.py:969 fields.py:1005 fields.py:1366\n#, python-brace-format\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"請確認輸入值小於或等於 {max_value}。\"\n\n#: fields.py:933 fields.py:970 fields.py:1006 fields.py:1367\n#, python-brace-format\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"請確認輸入值大於或等於 {min_value}。\"\n\n#: fields.py:934 fields.py:971 fields.py:1010\nmsgid \"String value too large.\"\nmsgstr \"字串長度太長。\"\n\n#: fields.py:968 fields.py:1004\nmsgid \"A valid number is required.\"\nmsgstr \"請輸入有效的數字。\"\n\n#: fields.py:1007\n#, python-brace-format\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:1008\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:1009\n#, python-brace-format\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1148\n#, python-brace-format\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1149\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"應該為日期時間格式，並非日期格式。\"\n\n#: fields.py:1150\n#, python-brace-format\nmsgid \"Invalid datetime for the timezone \\\"{timezone}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1151\nmsgid \"Datetime value out of range.\"\nmsgstr \"\"\n\n#: fields.py:1236\n#, python-brace-format\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1237\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"應該為日期格式，並非日期時間格式。\"\n\n#: fields.py:1303\n#, python-brace-format\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"時間格式錯誤，請在下列格式中擇一取代：{format}。\"\n\n#: fields.py:1365\n#, python-brace-format\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1399 fields.py:1456\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\\\"{input}\\\" 不是有效的選擇。\"\n\n#: fields.py:1402\n#, python-brace-format\nmsgid \"More than {count} items...\"\nmsgstr \"超過 {count} 個項目...\"\n\n#: fields.py:1457 fields.py:1603 relations.py:485 serializers.py:570\n#, python-brace-format\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"應該為項目組成的列表，並非 \\\"{input_type}\\\" 類型。\"\n\n#: fields.py:1458\nmsgid \"This selection may not be empty.\"\nmsgstr \"此選項不可為空。\"\n\n#: fields.py:1495\n#, python-brace-format\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1514\nmsgid \"No file was submitted.\"\nmsgstr \"沒有任何檔案被提交。\"\n\n#: fields.py:1515\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"提交的資料並不是檔案格式，請確認表單的編碼類型。\"\n\n#: fields.py:1516\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1517\nmsgid \"The submitted file is empty.\"\nmsgstr \"沒有任何檔案被提交。\"\n\n#: fields.py:1518\n#, python-brace-format\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1566\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1604 relations.py:486 serializers.py:571\nmsgid \"This list may not be empty.\"\nmsgstr \"此列表不可為空。\"\n\n#: fields.py:1605\n#, python-brace-format\nmsgid \"Ensure this field has at least {min_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1606\n#, python-brace-format\nmsgid \"Ensure this field has no more than {max_length} elements.\"\nmsgstr \"\"\n\n#: fields.py:1682\n#, python-brace-format\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1683\nmsgid \"This dictionary may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1755\nmsgid \"Value must be valid JSON.\"\nmsgstr \"輸入值必須為有效的JSON。\"\n\n#: filters.py:49 templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"搜尋\"\n\n#: filters.py:50\nmsgid \"A search term.\"\nmsgstr \"\"\n\n#: filters.py:180 templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"排序\"\n\n#: filters.py:181\nmsgid \"Which field to use when ordering the results.\"\nmsgstr \"\"\n\n#: filters.py:287\nmsgid \"ascending\"\nmsgstr \"升序排列\"\n\n#: filters.py:288\nmsgid \"descending\"\nmsgstr \"降序排列\"\n\n#: pagination.py:174\nmsgid \"A page number within the paginated result set.\"\nmsgstr \"\"\n\n#: pagination.py:179 pagination.py:372 pagination.py:590\nmsgid \"Number of results to return per page.\"\nmsgstr \"\"\n\n#: pagination.py:189\nmsgid \"Invalid page.\"\nmsgstr \"無效的頁面。\"\n\n#: pagination.py:374\nmsgid \"The initial index from which to return the results.\"\nmsgstr \"\"\n\n#: pagination.py:581\nmsgid \"The pagination cursor value.\"\nmsgstr \"\"\n\n#: pagination.py:583\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:246\n#, python-brace-format\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"無效的主鍵 \\\"{pk_value}\\\" - 物件不存在。\"\n\n#: relations.py:247\n#, python-brace-format\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:280\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"無效的超連結 - 沒有匹配的URL。\"\n\n#: relations.py:281\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"無效的超連結 - 匹配的URL不正確。\"\n\n#: relations.py:282\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"無效的超連結 - 物件不存在。\"\n\n#: relations.py:283\n#, python-brace-format\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:448\n#, python-brace-format\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:449\nmsgid \"Invalid value.\"\nmsgstr \"無效值。\"\n\n#: schemas/utils.py:32\nmsgid \"unique integer value\"\nmsgstr \"\"\n\n#: schemas/utils.py:34\nmsgid \"UUID string\"\nmsgstr \"\"\n\n#: schemas/utils.py:36\nmsgid \"unique value\"\nmsgstr \"\"\n\n#: schemas/utils.py:38\n#, python-brace-format\nmsgid \"A {value_type} identifying this {name}.\"\nmsgstr \"\"\n\n#: serializers.py:337\n#, python-brace-format\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"無效的資料，應該為字典類型，並非 {datatype}。\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:136\nmsgid \"Extra Actions\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:130\n#: templates/rest_framework/base.html:150\nmsgid \"Filters\"\nmsgstr \"篩選\"\n\n#: templates/rest_framework/base.html:37\nmsgid \"navbar\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:75\nmsgid \"content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:78\nmsgid \"request form\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:157\nmsgid \"main content\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:173\nmsgid \"request info\"\nmsgstr \"\"\n\n#: templates/rest_framework/base.html:177\nmsgid \"response info\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:4\n#: templates/rest_framework/inline/radio.html:3\n#: templates/rest_framework/vertical/radio.html:3\nmsgid \"None\"\nmsgstr \"無\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:4\n#: templates/rest_framework/inline/select_multiple.html:3\n#: templates/rest_framework/vertical/select_multiple.html:3\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:39\nmsgid \"This field must be unique.\"\nmsgstr \"此欄位必須唯一。\"\n\n#: validators.py:89\n#, python-brace-format\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:171\n#, python-brace-format\nmsgid \"Surrogate characters are not allowed: U+{code_point:X}.\"\nmsgstr \"\"\n\n#: validators.py:243\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:258\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:271\n#, python-brace-format\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:40\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:71\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:116\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:148\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:170\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/locale/zh_TW/LC_MESSAGES/django.po",
    "content": "# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n# This file is distributed under the same license as the PACKAGE package.\n# \n# Translators:\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: Django REST framework\\n\"\n\"Report-Msgid-Bugs-To: \\n\"\n\"POT-Creation-Date: 2016-07-12 16:13+0100\\n\"\n\"PO-Revision-Date: 2016-07-12 15:14+0000\\n\"\n\"Last-Translator: Thomas Christie <tom@tomchristie.com>\\n\"\n\"Language-Team: Chinese (Taiwan) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/zh_TW/)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Language: zh_TW\\n\"\n\"Plural-Forms: nplurals=1; plural=0;\\n\"\n\n#: authentication.py:73\nmsgid \"Invalid basic header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:76\nmsgid \"Invalid basic header. Credentials string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:82\nmsgid \"Invalid basic header. Credentials not correctly base64 encoded.\"\nmsgstr \"\"\n\n#: authentication.py:99\nmsgid \"Invalid username/password.\"\nmsgstr \"\"\n\n#: authentication.py:102 authentication.py:198\nmsgid \"User inactive or deleted.\"\nmsgstr \"\"\n\n#: authentication.py:176\nmsgid \"Invalid token header. No credentials provided.\"\nmsgstr \"\"\n\n#: authentication.py:179\nmsgid \"Invalid token header. Token string should not contain spaces.\"\nmsgstr \"\"\n\n#: authentication.py:185\nmsgid \"\"\n\"Invalid token header. Token string should not contain invalid characters.\"\nmsgstr \"\"\n\n#: authentication.py:195\nmsgid \"Invalid token.\"\nmsgstr \"\"\n\n#: authtoken/apps.py:7\nmsgid \"Auth Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:15\nmsgid \"Key\"\nmsgstr \"\"\n\n#: authtoken/models.py:18\nmsgid \"User\"\nmsgstr \"\"\n\n#: authtoken/models.py:20\nmsgid \"Created\"\nmsgstr \"\"\n\n#: authtoken/models.py:29\nmsgid \"Token\"\nmsgstr \"\"\n\n#: authtoken/models.py:30\nmsgid \"Tokens\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:8\nmsgid \"Username\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:9\nmsgid \"Password\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:20\nmsgid \"User account is disabled.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:23\nmsgid \"Unable to log in with provided credentials.\"\nmsgstr \"\"\n\n#: authtoken/serializers.py:26\nmsgid \"Must include \\\"username\\\" and \\\"password\\\".\"\nmsgstr \"\"\n\n#: exceptions.py:49\nmsgid \"A server error occurred.\"\nmsgstr \"\"\n\n#: exceptions.py:84\nmsgid \"Malformed request.\"\nmsgstr \"\"\n\n#: exceptions.py:89\nmsgid \"Incorrect authentication credentials.\"\nmsgstr \"\"\n\n#: exceptions.py:94\nmsgid \"Authentication credentials were not provided.\"\nmsgstr \"\"\n\n#: exceptions.py:99\nmsgid \"You do not have permission to perform this action.\"\nmsgstr \"\"\n\n#: exceptions.py:104 views.py:81\nmsgid \"Not found.\"\nmsgstr \"\"\n\n#: exceptions.py:109\nmsgid \"Method \\\"{method}\\\" not allowed.\"\nmsgstr \"\"\n\n#: exceptions.py:120\nmsgid \"Could not satisfy the request Accept header.\"\nmsgstr \"\"\n\n#: exceptions.py:132\nmsgid \"Unsupported media type \\\"{media_type}\\\" in request.\"\nmsgstr \"\"\n\n#: exceptions.py:145\nmsgid \"Request was throttled.\"\nmsgstr \"\"\n\n#: fields.py:269 relations.py:206 relations.py:239 validators.py:98\n#: validators.py:181\nmsgid \"This field is required.\"\nmsgstr \"\"\n\n#: fields.py:270\nmsgid \"This field may not be null.\"\nmsgstr \"\"\n\n#: fields.py:608 fields.py:639\nmsgid \"\\\"{input}\\\" is not a valid boolean.\"\nmsgstr \"\"\n\n#: fields.py:674\nmsgid \"This field may not be blank.\"\nmsgstr \"\"\n\n#: fields.py:675 fields.py:1675\nmsgid \"Ensure this field has no more than {max_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:676\nmsgid \"Ensure this field has at least {min_length} characters.\"\nmsgstr \"\"\n\n#: fields.py:713\nmsgid \"Enter a valid email address.\"\nmsgstr \"\"\n\n#: fields.py:724\nmsgid \"This value does not match the required pattern.\"\nmsgstr \"\"\n\n#: fields.py:735\nmsgid \"\"\n\"Enter a valid \\\"slug\\\" consisting of letters, numbers, underscores or \"\n\"hyphens.\"\nmsgstr \"\"\n\n#: fields.py:747\nmsgid \"Enter a valid URL.\"\nmsgstr \"\"\n\n#: fields.py:760\nmsgid \"\\\"{value}\\\" is not a valid UUID.\"\nmsgstr \"\"\n\n#: fields.py:796\nmsgid \"Enter a valid IPv4 or IPv6 address.\"\nmsgstr \"\"\n\n#: fields.py:821\nmsgid \"A valid integer is required.\"\nmsgstr \"\"\n\n#: fields.py:822 fields.py:857 fields.py:891\nmsgid \"Ensure this value is less than or equal to {max_value}.\"\nmsgstr \"\"\n\n#: fields.py:823 fields.py:858 fields.py:892\nmsgid \"Ensure this value is greater than or equal to {min_value}.\"\nmsgstr \"\"\n\n#: fields.py:824 fields.py:859 fields.py:896\nmsgid \"String value too large.\"\nmsgstr \"\"\n\n#: fields.py:856 fields.py:890\nmsgid \"A valid number is required.\"\nmsgstr \"\"\n\n#: fields.py:893\nmsgid \"Ensure that there are no more than {max_digits} digits in total.\"\nmsgstr \"\"\n\n#: fields.py:894\nmsgid \"\"\n\"Ensure that there are no more than {max_decimal_places} decimal places.\"\nmsgstr \"\"\n\n#: fields.py:895\nmsgid \"\"\n\"Ensure that there are no more than {max_whole_digits} digits before the \"\n\"decimal point.\"\nmsgstr \"\"\n\n#: fields.py:1025\nmsgid \"Datetime has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1026\nmsgid \"Expected a datetime but got a date.\"\nmsgstr \"\"\n\n#: fields.py:1103\nmsgid \"Date has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1104\nmsgid \"Expected a date but got a datetime.\"\nmsgstr \"\"\n\n#: fields.py:1170\nmsgid \"Time has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1232\nmsgid \"Duration has wrong format. Use one of these formats instead: {format}.\"\nmsgstr \"\"\n\n#: fields.py:1251 fields.py:1300\nmsgid \"\\\"{input}\\\" is not a valid choice.\"\nmsgstr \"\"\n\n#: fields.py:1254 relations.py:71 relations.py:441\nmsgid \"More than {count} items...\"\nmsgstr \"\"\n\n#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524\nmsgid \"Expected a list of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1302\nmsgid \"This selection may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1339\nmsgid \"\\\"{input}\\\" is not a valid path choice.\"\nmsgstr \"\"\n\n#: fields.py:1358\nmsgid \"No file was submitted.\"\nmsgstr \"\"\n\n#: fields.py:1359\nmsgid \"\"\n\"The submitted data was not a file. Check the encoding type on the form.\"\nmsgstr \"\"\n\n#: fields.py:1360\nmsgid \"No filename could be determined.\"\nmsgstr \"\"\n\n#: fields.py:1361\nmsgid \"The submitted file is empty.\"\nmsgstr \"\"\n\n#: fields.py:1362\nmsgid \"\"\n\"Ensure this filename has at most {max_length} characters (it has {length}).\"\nmsgstr \"\"\n\n#: fields.py:1410\nmsgid \"\"\n\"Upload a valid image. The file you uploaded was either not an image or a \"\n\"corrupted image.\"\nmsgstr \"\"\n\n#: fields.py:1449 relations.py:438 serializers.py:525\nmsgid \"This list may not be empty.\"\nmsgstr \"\"\n\n#: fields.py:1502\nmsgid \"Expected a dictionary of items but got type \\\"{input_type}\\\".\"\nmsgstr \"\"\n\n#: fields.py:1549\nmsgid \"Value must be valid JSON.\"\nmsgstr \"\"\n\n#: filters.py:36 templates/rest_framework/filters/django_filter.html:5\nmsgid \"Submit\"\nmsgstr \"\"\n\n#: filters.py:336\nmsgid \"ascending\"\nmsgstr \"\"\n\n#: filters.py:337\nmsgid \"descending\"\nmsgstr \"\"\n\n#: pagination.py:193\nmsgid \"Invalid page.\"\nmsgstr \"\"\n\n#: pagination.py:427\nmsgid \"Invalid cursor\"\nmsgstr \"\"\n\n#: relations.py:207\nmsgid \"Invalid pk \\\"{pk_value}\\\" - object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:208\nmsgid \"Incorrect type. Expected pk value, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:240\nmsgid \"Invalid hyperlink - No URL match.\"\nmsgstr \"\"\n\n#: relations.py:241\nmsgid \"Invalid hyperlink - Incorrect URL match.\"\nmsgstr \"\"\n\n#: relations.py:242\nmsgid \"Invalid hyperlink - Object does not exist.\"\nmsgstr \"\"\n\n#: relations.py:243\nmsgid \"Incorrect type. Expected URL string, received {data_type}.\"\nmsgstr \"\"\n\n#: relations.py:401\nmsgid \"Object with {slug_name}={value} does not exist.\"\nmsgstr \"\"\n\n#: relations.py:402\nmsgid \"Invalid value.\"\nmsgstr \"\"\n\n#: serializers.py:326\nmsgid \"Invalid data. Expected a dictionary, but got {datatype}.\"\nmsgstr \"\"\n\n#: templates/rest_framework/admin.html:116\n#: templates/rest_framework/base.html:128\nmsgid \"Filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/django_filter.html:2\n#: templates/rest_framework/filters/django_filter_crispyforms.html:4\nmsgid \"Field filters\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/ordering.html:3\nmsgid \"Ordering\"\nmsgstr \"\"\n\n#: templates/rest_framework/filters/search.html:2\nmsgid \"Search\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/radio.html:2\n#: templates/rest_framework/inline/radio.html:2\n#: templates/rest_framework/vertical/radio.html:2\nmsgid \"None\"\nmsgstr \"\"\n\n#: templates/rest_framework/horizontal/select_multiple.html:2\n#: templates/rest_framework/inline/select_multiple.html:2\n#: templates/rest_framework/vertical/select_multiple.html:2\nmsgid \"No items to select.\"\nmsgstr \"\"\n\n#: validators.py:43\nmsgid \"This field must be unique.\"\nmsgstr \"\"\n\n#: validators.py:97\nmsgid \"The fields {field_names} must make a unique set.\"\nmsgstr \"\"\n\n#: validators.py:245\nmsgid \"This field must be unique for the \\\"{date_field}\\\" date.\"\nmsgstr \"\"\n\n#: validators.py:260\nmsgid \"This field must be unique for the \\\"{date_field}\\\" month.\"\nmsgstr \"\"\n\n#: validators.py:273\nmsgid \"This field must be unique for the \\\"{date_field}\\\" year.\"\nmsgstr \"\"\n\n#: versioning.py:42\nmsgid \"Invalid version in \\\"Accept\\\" header.\"\nmsgstr \"\"\n\n#: versioning.py:73\nmsgid \"Invalid version in URL path.\"\nmsgstr \"\"\n\n#: versioning.py:115\nmsgid \"Invalid version in URL path. Does not match any version namespace.\"\nmsgstr \"\"\n\n#: versioning.py:147\nmsgid \"Invalid version in hostname.\"\nmsgstr \"\"\n\n#: versioning.py:169\nmsgid \"Invalid version in query parameter.\"\nmsgstr \"\"\n\n#: views.py:88\nmsgid \"Permission denied.\"\nmsgstr \"\"\n"
  },
  {
    "path": "rest_framework/management/__init__.py",
    "content": ""
  },
  {
    "path": "rest_framework/management/commands/__init__.py",
    "content": ""
  },
  {
    "path": "rest_framework/management/commands/generateschema.py",
    "content": "from django.core.management.base import BaseCommand\nfrom django.utils.module_loading import import_string\n\nfrom rest_framework import renderers\nfrom rest_framework.schemas.openapi import SchemaGenerator\n\n\nclass Command(BaseCommand):\n    help = \"Generates configured API schema for project.\"\n\n    def add_arguments(self, parser):\n        parser.add_argument('--title', dest=\"title\", default='', type=str)\n        parser.add_argument('--url', dest=\"url\", default=None, type=str)\n        parser.add_argument('--description', dest=\"description\", default=None, type=str)\n        parser.add_argument('--format', dest=\"format\", choices=['openapi', 'openapi-json'], default='openapi', type=str)\n        parser.add_argument('--urlconf', dest=\"urlconf\", default=None, type=str)\n        parser.add_argument('--generator_class', dest=\"generator_class\", default=None, type=str)\n        parser.add_argument('--file', dest=\"file\", default=None, type=str)\n        parser.add_argument('--api_version', dest=\"api_version\", default='', type=str)\n\n    def handle(self, *args, **options):\n        if options['generator_class']:\n            generator_class = import_string(options['generator_class'])\n        else:\n            generator_class = SchemaGenerator\n        generator = generator_class(\n            url=options['url'],\n            title=options['title'],\n            description=options['description'],\n            urlconf=options['urlconf'],\n            version=options['api_version'],\n        )\n        schema = generator.get_schema(request=None, public=True)\n        renderer = self.get_renderer(options['format'])\n        output = renderer.render(schema, renderer_context={})\n\n        if options['file']:\n            with open(options['file'], 'wb') as f:\n                f.write(output)\n        else:\n            self.stdout.write(output.decode())\n\n    def get_renderer(self, format):\n        renderer_cls = {\n            'openapi': renderers.OpenAPIRenderer,\n            'openapi-json': renderers.JSONOpenAPIRenderer,\n        }[format]\n        return renderer_cls()\n"
  },
  {
    "path": "rest_framework/metadata.py",
    "content": "\"\"\"\nThe metadata API is used to allow customization of how `OPTIONS` requests\nare handled. We currently provide a single default implementation that returns\nsome fairly ad-hoc information about the view.\n\nFuture implementations might use JSON schema or other definitions in order\nto return this information in a more standardized way.\n\"\"\"\nfrom django.core.exceptions import PermissionDenied\nfrom django.http import Http404\nfrom django.utils.encoding import force_str\n\nfrom rest_framework import exceptions, serializers\nfrom rest_framework.request import clone_request\nfrom rest_framework.utils.field_mapping import ClassLookupDict\n\n\nclass BaseMetadata:\n    def determine_metadata(self, request, view):\n        \"\"\"\n        Return a dictionary of metadata about the view.\n        Used to return responses for OPTIONS requests.\n        \"\"\"\n        raise NotImplementedError(\".determine_metadata() must be overridden.\")\n\n\nclass SimpleMetadata(BaseMetadata):\n    \"\"\"\n    This is the default metadata implementation.\n    It returns an ad-hoc set of information about the view.\n    There are not any formalized standards for `OPTIONS` responses\n    for us to base this on.\n    \"\"\"\n    label_lookup = ClassLookupDict({\n        serializers.Field: 'field',\n        serializers.BooleanField: 'boolean',\n        serializers.CharField: 'string',\n        serializers.UUIDField: 'string',\n        serializers.URLField: 'url',\n        serializers.EmailField: 'email',\n        serializers.RegexField: 'regex',\n        serializers.SlugField: 'slug',\n        serializers.IntegerField: 'integer',\n        serializers.FloatField: 'float',\n        serializers.DecimalField: 'decimal',\n        serializers.DateField: 'date',\n        serializers.DateTimeField: 'datetime',\n        serializers.TimeField: 'time',\n        serializers.DurationField: 'duration',\n        serializers.ChoiceField: 'choice',\n        serializers.MultipleChoiceField: 'multiple choice',\n        serializers.FileField: 'file upload',\n        serializers.ImageField: 'image upload',\n        serializers.ListField: 'list',\n        serializers.DictField: 'nested object',\n        serializers.Serializer: 'nested object',\n    })\n\n    def determine_metadata(self, request, view):\n        metadata = {\n            \"name\": view.get_view_name(),\n            \"description\": view.get_view_description(),\n            \"renders\": [renderer.media_type for renderer in view.renderer_classes],\n            \"parses\": [parser.media_type for parser in view.parser_classes],\n        }\n        if hasattr(view, 'get_serializer'):\n            actions = self.determine_actions(request, view)\n            if actions:\n                metadata['actions'] = actions\n        return metadata\n\n    def determine_actions(self, request, view):\n        \"\"\"\n        For generic class based views we return information about\n        the fields that are accepted for 'PUT' and 'POST' methods.\n        \"\"\"\n        actions = {}\n        for method in {'PUT', 'POST'} & set(view.allowed_methods):\n            view.request = clone_request(request, method)\n            try:\n                # Test global permissions\n                if hasattr(view, 'check_permissions'):\n                    view.check_permissions(view.request)\n                # Test object permissions\n                if method == 'PUT' and hasattr(view, 'get_object'):\n                    view.get_object()\n            except (exceptions.APIException, PermissionDenied, Http404):\n                pass\n            else:\n                # If user has appropriate permissions for the view, include\n                # appropriate metadata about the fields that should be supplied.\n                serializer = view.get_serializer()\n                actions[method] = self.get_serializer_info(serializer)\n            finally:\n                view.request = request\n\n        return actions\n\n    def get_serializer_info(self, serializer):\n        \"\"\"\n        Given an instance of a serializer, return a dictionary of metadata\n        about its fields.\n        \"\"\"\n        if hasattr(serializer, 'child'):\n            # If this is a `ListSerializer` then we want to examine the\n            # underlying child serializer instance instead.\n            serializer = serializer.child\n        return {\n            field_name: self.get_field_info(field)\n            for field_name, field in serializer.fields.items()\n            if not isinstance(field, serializers.HiddenField)\n        }\n\n    def get_field_info(self, field):\n        \"\"\"\n        Given an instance of a serializer field, return a dictionary\n        of metadata about it.\n        \"\"\"\n        field_info = {\n            \"type\": self.label_lookup[field],\n            \"required\": getattr(field, \"required\", False),\n        }\n\n        attrs = [\n            'read_only', 'label', 'help_text',\n            'min_length', 'max_length',\n            'min_value', 'max_value',\n            'max_digits', 'decimal_places'\n        ]\n\n        for attr in attrs:\n            value = getattr(field, attr, None)\n            if value is not None and value != '':\n                field_info[attr] = force_str(value, strings_only=True)\n\n        if getattr(field, 'child', None):\n            field_info['child'] = self.get_field_info(field.child)\n        elif getattr(field, 'fields', None):\n            field_info['children'] = self.get_serializer_info(field)\n\n        if (not field_info.get('read_only') and\n            not isinstance(field, (serializers.RelatedField, serializers.ManyRelatedField)) and\n                hasattr(field, 'choices')):\n            field_info['choices'] = [\n                {\n                    'value': choice_value,\n                    'display_name': force_str(choice_name, strings_only=True)\n                }\n                for choice_value, choice_name in field.choices.items()\n            ]\n\n        return field_info\n"
  },
  {
    "path": "rest_framework/mixins.py",
    "content": "\"\"\"\nBasic building blocks for generic class based views.\n\nWe don't bind behavior to http method handlers yet,\nwhich allows mixin classes to be composed in interesting ways.\n\"\"\"\nfrom rest_framework import status\nfrom rest_framework.response import Response\nfrom rest_framework.settings import api_settings\n\n\nclass CreateModelMixin:\n    \"\"\"\n    Create a model instance.\n    \"\"\"\n    def create(self, request, *args, **kwargs):\n        serializer = self.get_serializer(data=request.data)\n        serializer.is_valid(raise_exception=True)\n        self.perform_create(serializer)\n        headers = self.get_success_headers(serializer.data)\n        return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)\n\n    def perform_create(self, serializer):\n        serializer.save()\n\n    def get_success_headers(self, data):\n        try:\n            return {'Location': str(data[api_settings.URL_FIELD_NAME])}\n        except (TypeError, KeyError):\n            return {}\n\n\nclass ListModelMixin:\n    \"\"\"\n    List a queryset.\n    \"\"\"\n    def list(self, request, *args, **kwargs):\n        queryset = self.filter_queryset(self.get_queryset())\n\n        page = self.paginate_queryset(queryset)\n        if page is not None:\n            serializer = self.get_serializer(page, many=True)\n            return self.get_paginated_response(serializer.data)\n\n        serializer = self.get_serializer(queryset, many=True)\n        return Response(serializer.data)\n\n\nclass RetrieveModelMixin:\n    \"\"\"\n    Retrieve a model instance.\n    \"\"\"\n    def retrieve(self, request, *args, **kwargs):\n        instance = self.get_object()\n        serializer = self.get_serializer(instance)\n        return Response(serializer.data)\n\n\nclass UpdateModelMixin:\n    \"\"\"\n    Update a model instance.\n    \"\"\"\n    def update(self, request, *args, **kwargs):\n        partial = kwargs.pop('partial', False)\n        instance = self.get_object()\n        serializer = self.get_serializer(instance, data=request.data, partial=partial)\n        serializer.is_valid(raise_exception=True)\n        self.perform_update(serializer)\n\n        if getattr(instance, '_prefetched_objects_cache', None):\n            # If 'prefetch_related' has been applied to a queryset, we need to\n            # forcibly invalidate the prefetch cache on the instance.\n            instance._prefetched_objects_cache = {}\n\n        return Response(serializer.data)\n\n    def perform_update(self, serializer):\n        serializer.save()\n\n    def partial_update(self, request, *args, **kwargs):\n        kwargs['partial'] = True\n        return self.update(request, *args, **kwargs)\n\n\nclass DestroyModelMixin:\n    \"\"\"\n    Destroy a model instance.\n    \"\"\"\n    def destroy(self, request, *args, **kwargs):\n        instance = self.get_object()\n        self.perform_destroy(instance)\n        return Response(status=status.HTTP_204_NO_CONTENT)\n\n    def perform_destroy(self, instance):\n        instance.delete()\n"
  },
  {
    "path": "rest_framework/negotiation.py",
    "content": "\"\"\"\nContent negotiation deals with selecting an appropriate renderer given the\nincoming request.  Typically this will be based on the request's Accept header.\n\"\"\"\nfrom django.http import Http404\n\nfrom rest_framework import exceptions\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils.mediatypes import (\n    _MediaType, media_type_matches, order_by_precedence\n)\n\n\nclass BaseContentNegotiation:\n    def select_parser(self, request, parsers):\n        raise NotImplementedError('.select_parser() must be implemented')\n\n    def select_renderer(self, request, renderers, format_suffix=None):\n        raise NotImplementedError('.select_renderer() must be implemented')\n\n\nclass DefaultContentNegotiation(BaseContentNegotiation):\n    settings = api_settings\n\n    def select_parser(self, request, parsers):\n        \"\"\"\n        Given a list of parsers and a media type, return the appropriate\n        parser to handle the incoming request.\n        \"\"\"\n        for parser in parsers:\n            if media_type_matches(parser.media_type, request.content_type):\n                return parser\n        return None\n\n    def select_renderer(self, request, renderers, format_suffix=None):\n        \"\"\"\n        Given a request and a list of renderers, return a two-tuple of:\n        (renderer, media type).\n        \"\"\"\n        # Allow URL style format override.  eg. \"?format=json\n        format_query_param = self.settings.URL_FORMAT_OVERRIDE\n        format = format_suffix or request.query_params.get(format_query_param)\n\n        if format:\n            renderers = self.filter_renderers(renderers, format)\n\n        accepts = self.get_accept_list(request)\n\n        # Check the acceptable media types against each renderer,\n        # attempting more specific media types first\n        # NB. The inner loop here isn't as bad as it first looks :)\n        #     Worst case is we're looping over len(accept_list) * len(self.renderers)\n        for media_type_set in order_by_precedence(accepts):\n            for renderer in renderers:\n                for media_type in media_type_set:\n                    if media_type_matches(renderer.media_type, media_type):\n                        # Return the most specific media type as accepted.\n                        media_type_wrapper = _MediaType(media_type)\n                        if (\n                            _MediaType(renderer.media_type).precedence >\n                            media_type_wrapper.precedence\n                        ):\n                            # Eg client requests '*/*'\n                            # Accepted media type is 'application/json'\n                            full_media_type = ';'.join(\n                                (renderer.media_type,) +\n                                tuple(\n                                    f'{key}={value}'\n                                    for key, value in media_type_wrapper.params.items()\n                                )\n                            )\n                            return renderer, full_media_type\n                        else:\n                            # Eg client requests 'application/json; indent=8'\n                            # Accepted media type is 'application/json; indent=8'\n                            return renderer, media_type\n\n        raise exceptions.NotAcceptable(available_renderers=renderers)\n\n    def filter_renderers(self, renderers, format):\n        \"\"\"\n        If there is a '.json' style format suffix, filter the renderers\n        so that we only negotiation against those that accept that format.\n        \"\"\"\n        renderers = [renderer for renderer in renderers\n                     if renderer.format == format]\n        if not renderers:\n            raise Http404\n        return renderers\n\n    def get_accept_list(self, request):\n        \"\"\"\n        Given the incoming request, return a tokenized list of media\n        type strings.\n        \"\"\"\n        header = request.META.get('HTTP_ACCEPT', '*/*')\n        return [token.strip() for token in header.split(',')]\n"
  },
  {
    "path": "rest_framework/pagination.py",
    "content": "\"\"\"\nPagination serializers determine the structure of the output that should\nbe used for paginated responses.\n\"\"\"\n\nimport contextlib\nfrom base64 import b64decode, b64encode\nfrom collections import namedtuple\nfrom urllib import parse\n\nfrom django.core.paginator import InvalidPage\nfrom django.core.paginator import Paginator as DjangoPaginator\nfrom django.template import loader\nfrom django.utils.encoding import force_str\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework.exceptions import NotFound\nfrom rest_framework.response import Response\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils.urls import remove_query_param, replace_query_param\n\n\ndef _positive_int(integer_string, strict=False, cutoff=None):\n    \"\"\"\n    Cast a string to a strictly positive integer.\n    \"\"\"\n    ret = int(integer_string)\n    if ret < 0 or (ret == 0 and strict):\n        raise ValueError()\n    if cutoff:\n        return min(ret, cutoff)\n    return ret\n\n\ndef _divide_with_ceil(a, b):\n    \"\"\"\n    Returns 'a' divided by 'b', with any remainder rounded up.\n    \"\"\"\n    if a % b:\n        return (a // b) + 1\n\n    return a // b\n\n\ndef _get_displayed_page_numbers(current, final):\n    \"\"\"\n    This utility function determines a list of page numbers to display.\n    This gives us a nice contextually relevant set of page numbers.\n\n    For example:\n    current=14, final=16 -> [1, None, 13, 14, 15, 16]\n\n    This implementation gives one page to each side of the cursor,\n    or two pages to the side when the cursor is at the edge, then\n    ensures that any breaks between non-continuous page numbers never\n    remove only a single page.\n\n    For an alternative implementation which gives two pages to each side of\n    the cursor, eg. as in GitHub issue list pagination, see:\n\n    https://gist.github.com/tomchristie/321140cebb1c4a558b15\n    \"\"\"\n    assert current >= 1\n    assert final >= current\n\n    if final <= 5:\n        return list(range(1, final + 1))\n\n    # We always include the first two pages, last two pages, and\n    # two pages either side of the current page.\n    included = {1, current - 1, current, current + 1, final}\n\n    # If the break would only exclude a single page number then we\n    # may as well include the page number instead of the break.\n    if current <= 4:\n        included.add(2)\n        included.add(3)\n    if current >= final - 3:\n        included.add(final - 1)\n        included.add(final - 2)\n\n    # Now sort the page numbers and drop anything outside the limits.\n    included = [\n        idx for idx in sorted(included)\n        if 0 < idx <= final\n    ]\n\n    # Finally insert any `...` breaks\n    if current > 4:\n        included.insert(1, None)\n    if current < final - 3:\n        included.insert(len(included) - 1, None)\n    return included\n\n\ndef _get_page_links(page_numbers, current, url_func):\n    \"\"\"\n    Given a list of page numbers and `None` page breaks,\n    return a list of `PageLink` objects.\n    \"\"\"\n    page_links = []\n    for page_number in page_numbers:\n        if page_number is None:\n            page_link = PAGE_BREAK\n        else:\n            page_link = PageLink(\n                url=url_func(page_number),\n                number=page_number,\n                is_active=(page_number == current),\n                is_break=False\n            )\n        page_links.append(page_link)\n    return page_links\n\n\ndef _reverse_ordering(ordering_tuple):\n    \"\"\"\n    Given an order_by tuple such as `('-created', 'uuid')` reverse the\n    ordering and return a new tuple, eg. `('created', '-uuid')`.\n    \"\"\"\n    def invert(x):\n        return x[1:] if x.startswith('-') else '-' + x\n\n    return tuple([invert(item) for item in ordering_tuple])\n\n\nCursor = namedtuple('Cursor', ['offset', 'reverse', 'position'])\nPageLink = namedtuple('PageLink', ['url', 'number', 'is_active', 'is_break'])\n\nPAGE_BREAK = PageLink(url=None, number=None, is_active=False, is_break=True)\n\n\nclass BasePagination:\n    display_page_controls = False\n\n    def paginate_queryset(self, queryset, request, view=None):  # pragma: no cover\n        raise NotImplementedError('paginate_queryset() must be implemented.')\n\n    def get_paginated_response(self, data):  # pragma: no cover\n        raise NotImplementedError('get_paginated_response() must be implemented.')\n\n    def get_paginated_response_schema(self, schema):\n        return schema\n\n    def to_html(self):  # pragma: no cover\n        raise NotImplementedError('to_html() must be implemented to display page controls.')\n\n    def get_results(self, data):\n        return data['results']\n\n    def get_schema_operation_parameters(self, view):\n        return []\n\n\nclass PageNumberPagination(BasePagination):\n    \"\"\"\n    A simple page number based style that supports page numbers as\n    query parameters. For example:\n\n    http://api.example.org/accounts/?page=4\n    http://api.example.org/accounts/?page=4&page_size=100\n    \"\"\"\n    # The default page size.\n    # Defaults to `None`, meaning pagination is disabled.\n    page_size = api_settings.PAGE_SIZE\n\n    django_paginator_class = DjangoPaginator\n\n    # Client can control the page using this query parameter.\n    page_query_param = 'page'\n    page_query_description = _('A page number within the paginated result set.')\n\n    # Client can control the page size using this query parameter.\n    # Default is 'None'. Set to eg 'page_size' to enable usage.\n    page_size_query_param = None\n    page_size_query_description = _('Number of results to return per page.')\n\n    # Set to an integer to limit the maximum page size the client may request.\n    # Only relevant if 'page_size_query_param' has also been set.\n    max_page_size = None\n\n    last_page_strings = ('last',)\n\n    template = 'rest_framework/pagination/numbers.html'\n\n    invalid_page_message = _('Invalid page.')\n\n    def paginate_queryset(self, queryset, request, view=None):\n        \"\"\"\n        Paginate a queryset if required, either returning a\n        page object, or `None` if pagination is not configured for this view.\n        \"\"\"\n        self.request = request\n        page_size = self.get_page_size(request)\n        if not page_size:\n            return None\n\n        paginator = self.django_paginator_class(queryset, page_size)\n        page_number = self.get_page_number(request, paginator)\n\n        try:\n            self.page = paginator.page(page_number)\n        except InvalidPage as exc:\n            msg = self.invalid_page_message.format(\n                page_number=page_number, message=str(exc)\n            )\n            raise NotFound(msg)\n\n        if paginator.num_pages > 1 and self.template is not None:\n            # The browsable API should display pagination controls.\n            self.display_page_controls = True\n\n        return list(self.page)\n\n    def get_page_number(self, request, paginator):\n        page_number = request.query_params.get(self.page_query_param) or 1\n        if page_number in self.last_page_strings:\n            page_number = paginator.num_pages\n        return page_number\n\n    def get_paginated_response(self, data):\n        return Response({\n            'count': self.page.paginator.count,\n            'next': self.get_next_link(),\n            'previous': self.get_previous_link(),\n            'results': data,\n        })\n\n    def get_paginated_response_schema(self, schema):\n        return {\n            'type': 'object',\n            'required': ['count', 'results'],\n            'properties': {\n                'count': {\n                    'type': 'integer',\n                    'example': 123,\n                },\n                'next': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?{page_query_param}=4'.format(\n                        page_query_param=self.page_query_param)\n                },\n                'previous': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?{page_query_param}=2'.format(\n                        page_query_param=self.page_query_param)\n                },\n                'results': schema,\n            },\n        }\n\n    def get_page_size(self, request):\n        if self.page_size_query_param:\n            with contextlib.suppress(KeyError, ValueError):\n                return _positive_int(\n                    request.query_params[self.page_size_query_param],\n                    strict=True,\n                    cutoff=self.max_page_size\n                )\n        return self.page_size\n\n    def get_next_link(self):\n        if not self.page.has_next():\n            return None\n        url = self.request.build_absolute_uri()\n        page_number = self.page.next_page_number()\n        return replace_query_param(url, self.page_query_param, page_number)\n\n    def get_previous_link(self):\n        if not self.page.has_previous():\n            return None\n        url = self.request.build_absolute_uri()\n        page_number = self.page.previous_page_number()\n        if page_number == 1:\n            return remove_query_param(url, self.page_query_param)\n        return replace_query_param(url, self.page_query_param, page_number)\n\n    def get_html_context(self):\n        base_url = self.request.build_absolute_uri()\n\n        def page_number_to_url(page_number):\n            if page_number == 1:\n                return remove_query_param(base_url, self.page_query_param)\n            else:\n                return replace_query_param(base_url, self.page_query_param, page_number)\n\n        current = self.page.number\n        final = self.page.paginator.num_pages\n        page_numbers = _get_displayed_page_numbers(current, final)\n        page_links = _get_page_links(page_numbers, current, page_number_to_url)\n\n        return {\n            'previous_url': self.get_previous_link(),\n            'next_url': self.get_next_link(),\n            'page_links': page_links\n        }\n\n    def to_html(self):\n        template = loader.get_template(self.template)\n        context = self.get_html_context()\n        return template.render(context)\n\n    def get_schema_operation_parameters(self, view):\n        parameters = [\n            {\n                'name': self.page_query_param,\n                'required': False,\n                'in': 'query',\n                'description': force_str(self.page_query_description),\n                'schema': {\n                    'type': 'integer',\n                },\n            },\n        ]\n        if self.page_size_query_param is not None:\n            parameters.append(\n                {\n                    'name': self.page_size_query_param,\n                    'required': False,\n                    'in': 'query',\n                    'description': force_str(self.page_size_query_description),\n                    'schema': {\n                        'type': 'integer',\n                    },\n                },\n            )\n        return parameters\n\n\nclass LimitOffsetPagination(BasePagination):\n    \"\"\"\n    A limit/offset based style. For example:\n\n    http://api.example.org/accounts/?limit=100\n    http://api.example.org/accounts/?offset=400&limit=100\n    \"\"\"\n    default_limit = api_settings.PAGE_SIZE\n    limit_query_param = 'limit'\n    limit_query_description = _('Number of results to return per page.')\n    offset_query_param = 'offset'\n    offset_query_description = _('The initial index from which to return the results.')\n    max_limit = None\n    template = 'rest_framework/pagination/numbers.html'\n\n    def paginate_queryset(self, queryset, request, view=None):\n        self.request = request\n        self.limit = self.get_limit(request)\n        if self.limit is None:\n            return None\n\n        self.count = self.get_count(queryset)\n        self.offset = self.get_offset(request)\n        if self.count > self.limit and self.template is not None:\n            self.display_page_controls = True\n\n        if self.count == 0 or self.offset > self.count:\n            return []\n        return list(queryset[self.offset:self.offset + self.limit])\n\n    def get_paginated_response(self, data):\n        return Response({\n            'count': self.count,\n            'next': self.get_next_link(),\n            'previous': self.get_previous_link(),\n            'results': data\n        })\n\n    def get_paginated_response_schema(self, schema):\n        return {\n            'type': 'object',\n            'required': ['count', 'results'],\n            'properties': {\n                'count': {\n                    'type': 'integer',\n                    'example': 123,\n                },\n                'next': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?{offset_param}=400&{limit_param}=100'.format(\n                        offset_param=self.offset_query_param, limit_param=self.limit_query_param),\n                },\n                'previous': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?{offset_param}=200&{limit_param}=100'.format(\n                        offset_param=self.offset_query_param, limit_param=self.limit_query_param),\n                },\n                'results': schema,\n            },\n        }\n\n    def get_limit(self, request):\n        if self.limit_query_param:\n            with contextlib.suppress(KeyError, ValueError):\n                return _positive_int(\n                    request.query_params[self.limit_query_param],\n                    strict=True,\n                    cutoff=self.max_limit\n                )\n        return self.default_limit\n\n    def get_offset(self, request):\n        try:\n            return _positive_int(\n                request.query_params[self.offset_query_param],\n            )\n        except (KeyError, ValueError):\n            return 0\n\n    def get_next_link(self):\n        if self.offset + self.limit >= self.count:\n            return None\n\n        url = self.request.build_absolute_uri()\n        url = replace_query_param(url, self.limit_query_param, self.limit)\n\n        offset = self.offset + self.limit\n        return replace_query_param(url, self.offset_query_param, offset)\n\n    def get_previous_link(self):\n        if self.offset <= 0:\n            return None\n\n        url = self.request.build_absolute_uri()\n        url = replace_query_param(url, self.limit_query_param, self.limit)\n\n        if self.offset - self.limit <= 0:\n            return remove_query_param(url, self.offset_query_param)\n\n        offset = self.offset - self.limit\n        return replace_query_param(url, self.offset_query_param, offset)\n\n    def get_html_context(self):\n        base_url = self.request.build_absolute_uri()\n\n        if self.limit:\n            current = _divide_with_ceil(self.offset, self.limit) + 1\n\n            # The number of pages is a little bit fiddly.\n            # We need to sum both the number of pages from current offset to end\n            # plus the number of pages up to the current offset.\n            # When offset is not strictly divisible by the limit then we may\n            # end up introducing an extra page as an artifact.\n            final = (\n                _divide_with_ceil(self.count - self.offset, self.limit) +\n                _divide_with_ceil(self.offset, self.limit)\n            )\n\n            final = max(final, 1)\n        else:\n            current = 1\n            final = 1\n\n        if current > final:\n            current = final\n\n        def page_number_to_url(page_number):\n            if page_number == 1:\n                return remove_query_param(base_url, self.offset_query_param)\n            else:\n                offset = self.offset + ((page_number - current) * self.limit)\n                return replace_query_param(base_url, self.offset_query_param, offset)\n\n        page_numbers = _get_displayed_page_numbers(current, final)\n        page_links = _get_page_links(page_numbers, current, page_number_to_url)\n\n        return {\n            'previous_url': self.get_previous_link(),\n            'next_url': self.get_next_link(),\n            'page_links': page_links\n        }\n\n    def to_html(self):\n        template = loader.get_template(self.template)\n        context = self.get_html_context()\n        return template.render(context)\n\n    def get_count(self, queryset):\n        \"\"\"\n        Determine an object count, supporting either querysets or regular lists.\n        \"\"\"\n        try:\n            return queryset.count()\n        except (AttributeError, TypeError):\n            return len(queryset)\n\n    def get_schema_operation_parameters(self, view):\n        parameters = [\n            {\n                'name': self.limit_query_param,\n                'required': False,\n                'in': 'query',\n                'description': force_str(self.limit_query_description),\n                'schema': {\n                    'type': 'integer',\n                },\n            },\n            {\n                'name': self.offset_query_param,\n                'required': False,\n                'in': 'query',\n                'description': force_str(self.offset_query_description),\n                'schema': {\n                    'type': 'integer',\n                },\n            },\n        ]\n        return parameters\n\n\nclass CursorPagination(BasePagination):\n    \"\"\"\n    The cursor pagination implementation is necessarily complex.\n    For an overview of the position/offset style we use, see this post:\n    https://cra.mr/2011/03/08/building-cursors-for-the-disqus-api\n    \"\"\"\n    cursor_query_param = 'cursor'\n    cursor_query_description = _('The pagination cursor value.')\n    page_size = api_settings.PAGE_SIZE\n    invalid_cursor_message = _('Invalid cursor')\n    ordering = '-created'\n    template = 'rest_framework/pagination/previous_and_next.html'\n\n    # Client can control the page size using this query parameter.\n    # Default is 'None'. Set to eg 'page_size' to enable usage.\n    page_size_query_param = None\n    page_size_query_description = _('Number of results to return per page.')\n\n    # Set to an integer to limit the maximum page size the client may request.\n    # Only relevant if 'page_size_query_param' has also been set.\n    max_page_size = None\n\n    # The offset in the cursor is used in situations where we have a\n    # nearly-unique index. (Eg millisecond precision creation timestamps)\n    # We guard against malicious users attempting to cause expensive database\n    # queries, by having a hard cap on the maximum possible size of the offset.\n    offset_cutoff = 1000\n\n    def paginate_queryset(self, queryset, request, view=None):\n        self.request = request\n        self.page_size = self.get_page_size(request)\n        if not self.page_size:\n            return None\n\n        self.base_url = request.build_absolute_uri()\n        self.ordering = self.get_ordering(request, queryset, view)\n\n        self.cursor = self.decode_cursor(request)\n        if self.cursor is None:\n            (offset, reverse, current_position) = (0, False, None)\n        else:\n            (offset, reverse, current_position) = self.cursor\n\n        # Cursor pagination always enforces an ordering.\n        if reverse:\n            queryset = queryset.order_by(*_reverse_ordering(self.ordering))\n        else:\n            queryset = queryset.order_by(*self.ordering)\n\n        # If we have a cursor with a fixed position then filter by that.\n        if current_position is not None:\n            order = self.ordering[0]\n            is_reversed = order.startswith('-')\n            order_attr = order.lstrip('-')\n\n            # Test for: (cursor reversed) XOR (queryset reversed)\n            if self.cursor.reverse != is_reversed:\n                kwargs = {order_attr + '__lt': current_position}\n            else:\n                kwargs = {order_attr + '__gt': current_position}\n\n            queryset = queryset.filter(**kwargs)\n\n        # If we have an offset cursor then offset the entire page by that amount.\n        # We also always fetch an extra item in order to determine if there is a\n        # page following on from this one.\n        results = list(queryset[offset:offset + self.page_size + 1])\n        self.page = list(results[:self.page_size])\n\n        # Determine the position of the final item following the page.\n        if len(results) > len(self.page):\n            has_following_position = True\n            following_position = self._get_position_from_instance(results[-1], self.ordering)\n        else:\n            has_following_position = False\n            following_position = None\n\n        if reverse:\n            # If we have a reverse queryset, then the query ordering was in reverse\n            # so we need to reverse the items again before returning them to the user.\n            self.page = list(reversed(self.page))\n\n            # Determine next and previous positions for reverse cursors.\n            self.has_next = (current_position is not None) or (offset > 0)\n            self.has_previous = has_following_position\n            if self.has_next:\n                self.next_position = current_position\n            if self.has_previous:\n                self.previous_position = following_position\n        else:\n            # Determine next and previous positions for forward cursors.\n            self.has_next = has_following_position\n            self.has_previous = (current_position is not None) or (offset > 0)\n            if self.has_next:\n                self.next_position = following_position\n            if self.has_previous:\n                self.previous_position = current_position\n\n        # Display page controls in the browsable API if there is more\n        # than one page.\n        if (self.has_previous or self.has_next) and self.template is not None:\n            self.display_page_controls = True\n\n        return self.page\n\n    def get_page_size(self, request):\n        if self.page_size_query_param:\n            with contextlib.suppress(KeyError, ValueError):\n                return _positive_int(\n                    request.query_params[self.page_size_query_param],\n                    strict=True,\n                    cutoff=self.max_page_size\n                )\n        return self.page_size\n\n    def get_next_link(self):\n        if not self.has_next:\n            return None\n\n        if self.page and self.cursor and self.cursor.reverse and self.cursor.offset != 0:\n            # If we're reversing direction and we have an offset cursor\n            # then we cannot use the first position we find as a marker.\n            compare = self._get_position_from_instance(self.page[-1], self.ordering)\n        else:\n            compare = self.next_position\n        offset = 0\n\n        has_item_with_unique_position = False\n        for item in reversed(self.page):\n            position = self._get_position_from_instance(item, self.ordering)\n            if position != compare:\n                # The item in this position and the item following it\n                # have different positions. We can use this position as\n                # our marker.\n                has_item_with_unique_position = True\n                break\n\n            # The item in this position has the same position as the item\n            # following it, we can't use it as a marker position, so increment\n            # the offset and keep seeking to the previous item.\n            compare = position\n            offset += 1\n\n        if self.page and not has_item_with_unique_position:\n            # There were no unique positions in the page.\n            if not self.has_previous:\n                # We are on the first page.\n                # Our cursor will have an offset equal to the page size,\n                # but no position to filter against yet.\n                offset = self.page_size\n                position = None\n            elif self.cursor.reverse:\n                # The change in direction will introduce a paging artifact,\n                # where we end up skipping forward a few extra items.\n                offset = 0\n                position = self.previous_position\n            else:\n                # Use the position from the existing cursor and increment\n                # it's offset by the page size.\n                offset = self.cursor.offset + self.page_size\n                position = self.previous_position\n\n        if not self.page:\n            position = self.next_position\n\n        cursor = Cursor(offset=offset, reverse=False, position=position)\n        return self.encode_cursor(cursor)\n\n    def get_previous_link(self):\n        if not self.has_previous:\n            return None\n\n        if self.page and self.cursor and not self.cursor.reverse and self.cursor.offset != 0:\n            # If we're reversing direction and we have an offset cursor\n            # then we cannot use the first position we find as a marker.\n            compare = self._get_position_from_instance(self.page[0], self.ordering)\n        else:\n            compare = self.previous_position\n        offset = 0\n\n        has_item_with_unique_position = False\n        for item in self.page:\n            position = self._get_position_from_instance(item, self.ordering)\n            if position != compare:\n                # The item in this position and the item following it\n                # have different positions. We can use this position as\n                # our marker.\n                has_item_with_unique_position = True\n                break\n\n            # The item in this position has the same position as the item\n            # following it, we can't use it as a marker position, so increment\n            # the offset and keep seeking to the previous item.\n            compare = position\n            offset += 1\n\n        if self.page and not has_item_with_unique_position:\n            # There were no unique positions in the page.\n            if not self.has_next:\n                # We are on the final page.\n                # Our cursor will have an offset equal to the page size,\n                # but no position to filter against yet.\n                offset = self.page_size\n                position = None\n            elif self.cursor.reverse:\n                # Use the position from the existing cursor and increment\n                # it's offset by the page size.\n                offset = self.cursor.offset + self.page_size\n                position = self.next_position\n            else:\n                # The change in direction will introduce a paging artifact,\n                # where we end up skipping back a few extra items.\n                offset = 0\n                position = self.next_position\n\n        if not self.page:\n            position = self.previous_position\n\n        cursor = Cursor(offset=offset, reverse=True, position=position)\n        return self.encode_cursor(cursor)\n\n    def get_ordering(self, request, queryset, view):\n        \"\"\"\n        Return a tuple of strings, that may be used in an `order_by` method.\n        \"\"\"\n        # The default case is to check for an `ordering` attribute\n        # on this pagination instance.\n        ordering = self.ordering\n\n        ordering_filters = [\n            filter_cls for filter_cls in getattr(view, 'filter_backends', [])\n            if hasattr(filter_cls, 'get_ordering')\n        ]\n\n        if ordering_filters:\n            # If a filter exists on the view that implements `get_ordering`\n            # then we defer to that filter to determine the ordering.\n            filter_cls = ordering_filters[0]\n            filter_instance = filter_cls()\n            ordering_from_filter = filter_instance.get_ordering(request, queryset, view)\n            if ordering_from_filter:\n                ordering = ordering_from_filter\n\n        assert ordering is not None, (\n            'Using cursor pagination, but no ordering attribute was declared '\n            'on the pagination class.'\n        )\n        assert '__' not in ordering, (\n            'Cursor pagination does not support double underscore lookups '\n            'for orderings. Orderings should be an unchanging, unique or '\n            'nearly-unique field on the model, such as \"-created\" or \"pk\".'\n        )\n\n        assert isinstance(ordering, (str, list, tuple)), (\n            'Invalid ordering. Expected string or tuple, but got {type}'.format(\n                type=type(ordering).__name__\n            )\n        )\n\n        if isinstance(ordering, str):\n            return (ordering,)\n        return tuple(ordering)\n\n    def decode_cursor(self, request):\n        \"\"\"\n        Given a request with a cursor, return a `Cursor` instance.\n        \"\"\"\n        # Determine if we have a cursor, and if so then decode it.\n        encoded = request.query_params.get(self.cursor_query_param)\n        if encoded is None:\n            return None\n\n        try:\n            querystring = b64decode(encoded.encode('ascii')).decode('ascii')\n            tokens = parse.parse_qs(querystring, keep_blank_values=True)\n\n            offset = tokens.get('o', ['0'])[0]\n            offset = _positive_int(offset, cutoff=self.offset_cutoff)\n\n            reverse = tokens.get('r', ['0'])[0]\n            reverse = bool(int(reverse))\n\n            position = tokens.get('p', [None])[0]\n        except (TypeError, ValueError):\n            raise NotFound(self.invalid_cursor_message)\n\n        return Cursor(offset=offset, reverse=reverse, position=position)\n\n    def encode_cursor(self, cursor):\n        \"\"\"\n        Given a Cursor instance, return an url with encoded cursor.\n        \"\"\"\n        tokens = {}\n        if cursor.offset != 0:\n            tokens['o'] = str(cursor.offset)\n        if cursor.reverse:\n            tokens['r'] = '1'\n        if cursor.position is not None:\n            tokens['p'] = cursor.position\n\n        querystring = parse.urlencode(tokens, doseq=True)\n        encoded = b64encode(querystring.encode('ascii')).decode('ascii')\n        return replace_query_param(self.base_url, self.cursor_query_param, encoded)\n\n    def _get_position_from_instance(self, instance, ordering):\n        field_name = ordering[0].lstrip('-')\n        if isinstance(instance, dict):\n            attr = instance[field_name]\n        else:\n            attr = getattr(instance, field_name)\n        return str(attr)\n\n    def get_paginated_response(self, data):\n        return Response({\n            'next': self.get_next_link(),\n            'previous': self.get_previous_link(),\n            'results': data,\n        })\n\n    def get_paginated_response_schema(self, schema):\n        return {\n            'type': 'object',\n            'required': ['results'],\n            'properties': {\n                'next': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?{cursor_query_param}=cD00ODY%3D\"'.format(\n                        cursor_query_param=self.cursor_query_param)\n                },\n                'previous': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?{cursor_query_param}=cj0xJnA9NDg3'.format(\n                        cursor_query_param=self.cursor_query_param)\n                },\n                'results': schema,\n            },\n        }\n\n    def get_html_context(self):\n        return {\n            'previous_url': self.get_previous_link(),\n            'next_url': self.get_next_link()\n        }\n\n    def to_html(self):\n        template = loader.get_template(self.template)\n        context = self.get_html_context()\n        return template.render(context)\n\n    def get_schema_operation_parameters(self, view):\n        parameters = [\n            {\n                'name': self.cursor_query_param,\n                'required': False,\n                'in': 'query',\n                'description': force_str(self.cursor_query_description),\n                'schema': {\n                    'type': 'string',\n                },\n            }\n        ]\n        if self.page_size_query_param is not None:\n            parameters.append(\n                {\n                    'name': self.page_size_query_param,\n                    'required': False,\n                    'in': 'query',\n                    'description': force_str(self.page_size_query_description),\n                    'schema': {\n                        'type': 'integer',\n                    },\n                }\n            )\n        return parameters\n"
  },
  {
    "path": "rest_framework/parsers.py",
    "content": "\"\"\"\nParsers are used to parse the content of incoming HTTP requests.\n\nThey give us a generic way of being able to handle various media types\non the request, such as form content or json encoded data.\n\"\"\"\n\nimport codecs\nimport contextlib\n\nfrom django.conf import settings\nfrom django.core.files.uploadhandler import StopFutureHandlers\nfrom django.http import QueryDict\nfrom django.http.multipartparser import ChunkIter\nfrom django.http.multipartparser import \\\n    MultiPartParser as DjangoMultiPartParser\nfrom django.http.multipartparser import MultiPartParserError\nfrom django.utils.http import parse_header_parameters\n\nfrom rest_framework import renderers\nfrom rest_framework.exceptions import ParseError\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils import json\n\n\nclass DataAndFiles:\n    def __init__(self, data, files):\n        self.data = data\n        self.files = files\n\n\nclass BaseParser:\n    \"\"\"\n    All parsers should extend `BaseParser`, specifying a `media_type`\n    attribute, and overriding the `.parse()` method.\n    \"\"\"\n    media_type = None\n\n    def parse(self, stream, media_type=None, parser_context=None):\n        \"\"\"\n        Given a stream to read from, return the parsed representation.\n        Should return parsed data, or a `DataAndFiles` object consisting of the\n        parsed data and files.\n        \"\"\"\n        raise NotImplementedError(\".parse() must be overridden.\")\n\n\nclass JSONParser(BaseParser):\n    \"\"\"\n    Parses JSON-serialized data.\n    \"\"\"\n    media_type = 'application/json'\n    renderer_class = renderers.JSONRenderer\n    strict = api_settings.STRICT_JSON\n\n    def parse(self, stream, media_type=None, parser_context=None):\n        \"\"\"\n        Parses the incoming bytestream as JSON and returns the resulting data.\n        \"\"\"\n        parser_context = parser_context or {}\n        encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)\n\n        try:\n            decoded_stream = codecs.getreader(encoding)(stream)\n            parse_constant = json.strict_constant if self.strict else None\n            return json.load(decoded_stream, parse_constant=parse_constant)\n        except ValueError as exc:\n            raise ParseError('JSON parse error - %s' % str(exc))\n\n\nclass FormParser(BaseParser):\n    \"\"\"\n    Parser for form data.\n    \"\"\"\n    media_type = 'application/x-www-form-urlencoded'\n\n    def parse(self, stream, media_type=None, parser_context=None):\n        \"\"\"\n        Parses the incoming bytestream as a URL encoded form,\n        and returns the resulting QueryDict.\n        \"\"\"\n        parser_context = parser_context or {}\n        encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)\n        return QueryDict(stream.read(), encoding=encoding)\n\n\nclass MultiPartParser(BaseParser):\n    \"\"\"\n    Parser for multipart form data, which may include file data.\n    \"\"\"\n    media_type = 'multipart/form-data'\n\n    def parse(self, stream, media_type=None, parser_context=None):\n        \"\"\"\n        Parses the incoming bytestream as a multipart encoded form,\n        and returns a DataAndFiles object.\n\n        `.data` will be a `QueryDict` containing all the form parameters.\n        `.files` will be a `QueryDict` containing all the form files.\n        \"\"\"\n        parser_context = parser_context or {}\n        request = parser_context['request']\n        encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)\n        meta = request.META.copy()\n        meta['CONTENT_TYPE'] = media_type\n        upload_handlers = request.upload_handlers\n\n        try:\n            parser = DjangoMultiPartParser(meta, stream, upload_handlers, encoding)\n            data, files = parser.parse()\n            return DataAndFiles(data, files)\n        except MultiPartParserError as exc:\n            raise ParseError('Multipart form parse error - %s' % str(exc))\n\n\nclass FileUploadParser(BaseParser):\n    \"\"\"\n    Parser for file upload data.\n    \"\"\"\n    media_type = '*/*'\n    errors = {\n        'unhandled': 'FileUpload parse error - none of upload handlers can handle the stream',\n        'no_filename': 'Missing filename. Request should include a Content-Disposition header with a filename parameter.',\n    }\n\n    def parse(self, stream, media_type=None, parser_context=None):\n        \"\"\"\n        Treats the incoming bytestream as a raw file upload and returns\n        a `DataAndFiles` object.\n\n        `.data` will be None (we expect request body to be a file content).\n        `.files` will be a `QueryDict` containing one 'file' element.\n        \"\"\"\n        parser_context = parser_context or {}\n        request = parser_context['request']\n        encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)\n        meta = request.META\n        upload_handlers = request.upload_handlers\n        filename = self.get_filename(stream, media_type, parser_context)\n\n        if not filename:\n            raise ParseError(self.errors['no_filename'])\n\n        # Note that this code is extracted from Django's handling of\n        # file uploads in MultiPartParser.\n        content_type = meta.get('HTTP_CONTENT_TYPE',\n                                meta.get('CONTENT_TYPE', ''))\n        try:\n            content_length = int(meta.get('HTTP_CONTENT_LENGTH',\n                                          meta.get('CONTENT_LENGTH', 0)))\n        except (ValueError, TypeError):\n            content_length = None\n\n        # See if the handler will want to take care of the parsing.\n        for handler in upload_handlers:\n            result = handler.handle_raw_input(stream,\n                                              meta,\n                                              content_length,\n                                              None,\n                                              encoding)\n            if result is not None:\n                return DataAndFiles({}, {'file': result[1]})\n\n        # This is the standard case.\n        possible_sizes = [x.chunk_size for x in upload_handlers if x.chunk_size]\n        chunk_size = min([2 ** 31 - 4] + possible_sizes)\n        chunks = ChunkIter(stream, chunk_size)\n        counters = [0] * len(upload_handlers)\n\n        for index, handler in enumerate(upload_handlers):\n            try:\n                handler.new_file(None, filename, content_type,\n                                 content_length, encoding)\n            except StopFutureHandlers:\n                upload_handlers = upload_handlers[:index + 1]\n                break\n\n        for chunk in chunks:\n            for index, handler in enumerate(upload_handlers):\n                chunk_length = len(chunk)\n                chunk = handler.receive_data_chunk(chunk, counters[index])\n                counters[index] += chunk_length\n                if chunk is None:\n                    break\n\n        for index, handler in enumerate(upload_handlers):\n            file_obj = handler.file_complete(counters[index])\n            if file_obj is not None:\n                return DataAndFiles({}, {'file': file_obj})\n\n        raise ParseError(self.errors['unhandled'])\n\n    def get_filename(self, stream, media_type, parser_context):\n        \"\"\"\n        Detects the uploaded file name. First searches a 'filename' url kwarg.\n        Then tries to parse Content-Disposition header.\n        \"\"\"\n        with contextlib.suppress(KeyError):\n            return parser_context['kwargs']['filename']\n\n        with contextlib.suppress(AttributeError, KeyError, ValueError):\n            meta = parser_context['request'].META\n            disposition, params = parse_header_parameters(meta['HTTP_CONTENT_DISPOSITION'])\n            if 'filename*' in params:\n                return params['filename*']\n            return params['filename']\n"
  },
  {
    "path": "rest_framework/permissions.py",
    "content": "\"\"\"\nProvides a set of pluggable permission policies.\n\"\"\"\nfrom django.http import Http404\n\nfrom rest_framework import exceptions\n\nSAFE_METHODS = ('GET', 'HEAD', 'OPTIONS')\n\n\nclass OperationHolderMixin:\n    def __and__(self, other):\n        return OperandHolder(AND, self, other)\n\n    def __or__(self, other):\n        return OperandHolder(OR, self, other)\n\n    def __rand__(self, other):\n        return OperandHolder(AND, other, self)\n\n    def __ror__(self, other):\n        return OperandHolder(OR, other, self)\n\n    def __invert__(self):\n        return SingleOperandHolder(NOT, self)\n\n\nclass SingleOperandHolder(OperationHolderMixin):\n    def __init__(self, operator_class, op1_class):\n        self.operator_class = operator_class\n        self.op1_class = op1_class\n\n    def __call__(self, *args, **kwargs):\n        op1 = self.op1_class(*args, **kwargs)\n        return self.operator_class(op1)\n\n\nclass OperandHolder(OperationHolderMixin):\n    def __init__(self, operator_class, op1_class, op2_class):\n        self.operator_class = operator_class\n        self.op1_class = op1_class\n        self.op2_class = op2_class\n\n    def __call__(self, *args, **kwargs):\n        op1 = self.op1_class(*args, **kwargs)\n        op2 = self.op2_class(*args, **kwargs)\n        return self.operator_class(op1, op2)\n\n    def __eq__(self, other):\n        return (\n            isinstance(other, OperandHolder) and\n            self.operator_class == other.operator_class and\n            self.op1_class == other.op1_class and\n            self.op2_class == other.op2_class\n        )\n\n    def __hash__(self):\n        return hash((self.operator_class, self.op1_class, self.op2_class))\n\n\nclass AND:\n    def __init__(self, op1, op2):\n        self.op1 = op1\n        self.op2 = op2\n\n    def has_permission(self, request, view):\n        return (\n            self.op1.has_permission(request, view) and\n            self.op2.has_permission(request, view)\n        )\n\n    def has_object_permission(self, request, view, obj):\n        return (\n            self.op1.has_object_permission(request, view, obj) and\n            self.op2.has_object_permission(request, view, obj)\n        )\n\n\nclass OR:\n    def __init__(self, op1, op2):\n        self.op1 = op1\n        self.op2 = op2\n\n    def has_permission(self, request, view):\n        return (\n            self.op1.has_permission(request, view) or\n            self.op2.has_permission(request, view)\n        )\n\n    def has_object_permission(self, request, view, obj):\n        return (\n            self.op1.has_permission(request, view)\n            and self.op1.has_object_permission(request, view, obj)\n        ) or (\n            self.op2.has_permission(request, view)\n            and self.op2.has_object_permission(request, view, obj)\n        )\n\n\nclass NOT:\n    def __init__(self, op1):\n        self.op1 = op1\n\n    def has_permission(self, request, view):\n        return not self.op1.has_permission(request, view)\n\n    def has_object_permission(self, request, view, obj):\n        return not self.op1.has_object_permission(request, view, obj)\n\n\nclass BasePermissionMetaclass(OperationHolderMixin, type):\n    pass\n\n\nclass BasePermission(metaclass=BasePermissionMetaclass):\n    \"\"\"\n    A base class from which all permission classes should inherit.\n    \"\"\"\n\n    def has_permission(self, request, view):\n        \"\"\"\n        Return `True` if permission is granted, `False` otherwise.\n        \"\"\"\n        return True\n\n    def has_object_permission(self, request, view, obj):\n        \"\"\"\n        Return `True` if permission is granted, `False` otherwise.\n        \"\"\"\n        return True\n\n\nclass AllowAny(BasePermission):\n    \"\"\"\n    Allow any access.\n    This isn't strictly required, since you could use an empty\n    permission_classes list, but it's useful because it makes the intention\n    more explicit.\n    \"\"\"\n\n    def has_permission(self, request, view):\n        return True\n\n\nclass IsAuthenticated(BasePermission):\n    \"\"\"\n    Allows access only to authenticated users.\n    \"\"\"\n\n    def has_permission(self, request, view):\n        return bool(request.user and request.user.is_authenticated)\n\n\nclass IsAdminUser(BasePermission):\n    \"\"\"\n    Allows access only to admin users.\n    \"\"\"\n\n    def has_permission(self, request, view):\n        return bool(request.user and request.user.is_staff)\n\n\nclass IsAuthenticatedOrReadOnly(BasePermission):\n    \"\"\"\n    The request is authenticated as a user, or is a read-only request.\n    \"\"\"\n\n    def has_permission(self, request, view):\n        return bool(\n            request.method in SAFE_METHODS or\n            request.user and\n            request.user.is_authenticated\n        )\n\n\nclass DjangoModelPermissions(BasePermission):\n    \"\"\"\n    The request is authenticated using `django.contrib.auth` permissions.\n    See: https://docs.djangoproject.com/en/dev/topics/auth/#permissions\n\n    It ensures that the user is authenticated, and has the appropriate\n    `add`/`change`/`delete` permissions on the model.\n\n    This permission can only be applied against view classes that\n    provide a `.queryset` attribute.\n    \"\"\"\n\n    # Map methods into required permission codes.\n    # Override this if you need to also provide 'view' permissions,\n    # or if you want to provide custom permission codes.\n    perms_map = {\n        'GET': [],\n        'OPTIONS': [],\n        'HEAD': [],\n        'POST': ['%(app_label)s.add_%(model_name)s'],\n        'PUT': ['%(app_label)s.change_%(model_name)s'],\n        'PATCH': ['%(app_label)s.change_%(model_name)s'],\n        'DELETE': ['%(app_label)s.delete_%(model_name)s'],\n    }\n\n    authenticated_users_only = True\n\n    def get_required_permissions(self, method, model_cls):\n        \"\"\"\n        Given a model and an HTTP method, return the list of permission\n        codes that the user is required to have.\n        \"\"\"\n        kwargs = {\n            'app_label': model_cls._meta.app_label,\n            'model_name': model_cls._meta.model_name\n        }\n\n        if method not in self.perms_map:\n            raise exceptions.MethodNotAllowed(method)\n\n        return [perm % kwargs for perm in self.perms_map[method]]\n\n    def _queryset(self, view):\n        assert hasattr(view, 'get_queryset') \\\n            or getattr(view, 'queryset', None) is not None, (\n            'Cannot apply {} on a view that does not set '\n            '`.queryset` or have a `.get_queryset()` method.'\n        ).format(self.__class__.__name__)\n\n        if hasattr(view, 'get_queryset'):\n            queryset = view.get_queryset()\n            assert queryset is not None, (\n                f'{view.__class__.__name__}.get_queryset() returned None'\n            )\n            return queryset\n        return view.queryset\n\n    def has_permission(self, request, view):\n        if not request.user or (\n           not request.user.is_authenticated and self.authenticated_users_only):\n            return False\n\n        # Workaround to ensure DjangoModelPermissions are not applied\n        # to the root view when using DefaultRouter.\n        if getattr(view, '_ignore_model_permissions', False):\n            return True\n\n        queryset = self._queryset(view)\n        perms = self.get_required_permissions(request.method, queryset.model)\n\n        return request.user.has_perms(perms)\n\n\nclass DjangoModelPermissionsOrAnonReadOnly(DjangoModelPermissions):\n    \"\"\"\n    Similar to DjangoModelPermissions, except that anonymous users are\n    allowed read-only access.\n    \"\"\"\n    authenticated_users_only = False\n\n\nclass DjangoObjectPermissions(DjangoModelPermissions):\n    \"\"\"\n    The request is authenticated using Django's object-level permissions.\n    It requires an object-permissions-enabled backend, such as Django Guardian.\n\n    It ensures that the user is authenticated, and has the appropriate\n    `add`/`change`/`delete` permissions on the object using .has_perms.\n\n    This permission can only be applied against view classes that\n    provide a `.queryset` attribute.\n    \"\"\"\n    perms_map = {\n        'GET': [],\n        'OPTIONS': [],\n        'HEAD': [],\n        'POST': ['%(app_label)s.add_%(model_name)s'],\n        'PUT': ['%(app_label)s.change_%(model_name)s'],\n        'PATCH': ['%(app_label)s.change_%(model_name)s'],\n        'DELETE': ['%(app_label)s.delete_%(model_name)s'],\n    }\n\n    def get_required_object_permissions(self, method, model_cls):\n        kwargs = {\n            'app_label': model_cls._meta.app_label,\n            'model_name': model_cls._meta.model_name\n        }\n\n        if method not in self.perms_map:\n            raise exceptions.MethodNotAllowed(method)\n\n        return [perm % kwargs for perm in self.perms_map[method]]\n\n    def has_object_permission(self, request, view, obj):\n        # authentication checks have already executed via has_permission\n        queryset = self._queryset(view)\n        model_cls = queryset.model\n        user = request.user\n\n        perms = self.get_required_object_permissions(request.method, model_cls)\n\n        if not user.has_perms(perms, obj):\n            # If the user does not have permissions we need to determine if\n            # they have read permissions to see 403, or not, and simply see\n            # a 404 response.\n\n            if request.method in SAFE_METHODS:\n                # Read permissions already checked and failed, no need\n                # to make another lookup.\n                raise Http404\n\n            read_perms = self.get_required_object_permissions('GET', model_cls)\n            if not user.has_perms(read_perms, obj):\n                raise Http404\n\n            # Has read permissions.\n            return False\n\n        return True\n"
  },
  {
    "path": "rest_framework/relations.py",
    "content": "import contextlib\nimport sys\nfrom operator import attrgetter\nfrom urllib import parse\n\nfrom django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist\nfrom django.db.models import Manager\nfrom django.db.models.query import QuerySet\nfrom django.urls import NoReverseMatch, Resolver404, get_script_prefix, resolve\nfrom django.utils.encoding import smart_str, uri_to_iri\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework.fields import (\n    Field, SkipField, empty, get_attribute, is_simple_callable, iter_options\n)\nfrom rest_framework.reverse import reverse\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils import html\n\n\ndef method_overridden(method_name, klass, instance):\n    \"\"\"\n    Determine if a method has been overridden.\n    \"\"\"\n    method = getattr(klass, method_name)\n    default_method = getattr(method, '__func__', method)  # Python 3 compat\n    return default_method is not getattr(instance, method_name).__func__\n\n\nclass ObjectValueError(ValueError):\n    \"\"\"\n    Raised when `queryset.get()` failed due to an underlying `ValueError`.\n    Wrapping prevents calling code conflating this with unrelated errors.\n    \"\"\"\n\n\nclass ObjectTypeError(TypeError):\n    \"\"\"\n    Raised when `queryset.get()` failed due to an underlying `TypeError`.\n    Wrapping prevents calling code conflating this with unrelated errors.\n    \"\"\"\n\n\nclass Hyperlink(str):\n    \"\"\"\n    A string like object that additionally has an associated name.\n    We use this for hyperlinked URLs that may render as a named link\n    in some contexts, or render as a plain URL in others.\n    \"\"\"\n    def __new__(cls, url, obj):\n        ret = super().__new__(cls, url)\n        ret.obj = obj\n        return ret\n\n    def __getnewargs__(self):\n        return (str(self), self.name)\n\n    @property\n    def name(self):\n        # This ensures that we only called `__str__` lazily,\n        # as in some cases calling __str__ on a model instances *might*\n        # involve a database lookup.\n        return str(self.obj)\n\n    is_hyperlink = True\n\n\nclass PKOnlyObject:\n    \"\"\"\n    This is a mock object, used for when we only need the pk of the object\n    instance, but still want to return an object with a .pk attribute,\n    in order to keep the same interface as a regular model instance.\n    \"\"\"\n\n    def __init__(self, pk):\n        self.pk = pk\n\n    def __str__(self):\n        return \"%s\" % self.pk\n\n\n# We assume that 'validators' are intended for the child serializer,\n# rather than the parent serializer.\nMANY_RELATION_KWARGS = (\n    'read_only', 'write_only', 'required', 'default', 'initial', 'source',\n    'label', 'help_text', 'style', 'error_messages', 'allow_empty',\n    'html_cutoff', 'html_cutoff_text'\n)\n\n\nclass RelatedField(Field):\n    queryset = None\n    html_cutoff = None\n    html_cutoff_text = None\n\n    def __init__(self, **kwargs):\n        self.queryset = kwargs.pop('queryset', self.queryset)\n\n        cutoff_from_settings = api_settings.HTML_SELECT_CUTOFF\n        if cutoff_from_settings is not None:\n            cutoff_from_settings = int(cutoff_from_settings)\n        self.html_cutoff = kwargs.pop('html_cutoff', cutoff_from_settings)\n\n        self.html_cutoff_text = kwargs.pop(\n            'html_cutoff_text',\n            self.html_cutoff_text or _(api_settings.HTML_SELECT_CUTOFF_TEXT)\n        )\n        if not method_overridden('get_queryset', RelatedField, self):\n            assert self.queryset is not None or kwargs.get('read_only'), (\n                'Relational field must provide a `queryset` argument, '\n                'override `get_queryset`, or set read_only=`True`.'\n            )\n        assert not (self.queryset is not None and kwargs.get('read_only')), (\n            'Relational fields should not provide a `queryset` argument, '\n            'when setting read_only=`True`.'\n        )\n        kwargs.pop('many', None)\n        kwargs.pop('allow_empty', None)\n        super().__init__(**kwargs)\n\n    def __new__(cls, *args, **kwargs):\n        # We override this method in order to automagically create\n        # `ManyRelatedField` classes instead when `many=True` is set.\n        if kwargs.pop('many', False):\n            return cls.many_init(*args, **kwargs)\n        return super().__new__(cls, *args, **kwargs)\n\n    @classmethod\n    def many_init(cls, *args, **kwargs):\n        \"\"\"\n        This method handles creating a parent `ManyRelatedField` instance\n        when the `many=True` keyword argument is passed.\n\n        Typically you won't need to override this method.\n\n        Note that we're over-cautious in passing most arguments to both parent\n        and child classes in order to try to cover the general case. If you're\n        overriding this method you'll probably want something much simpler, eg:\n\n        @classmethod\n        def many_init(cls, *args, **kwargs):\n            kwargs['child'] = cls()\n            return CustomManyRelatedField(*args, **kwargs)\n        \"\"\"\n        list_kwargs = {'child_relation': cls(*args, **kwargs)}\n        for key in kwargs:\n            if key in MANY_RELATION_KWARGS:\n                list_kwargs[key] = kwargs[key]\n        return ManyRelatedField(**list_kwargs)\n\n    def run_validation(self, data=empty):\n        # We force empty strings to None values for relational fields.\n        if data == '':\n            data = None\n        return super().run_validation(data)\n\n    def get_queryset(self):\n        queryset = self.queryset\n        if isinstance(queryset, (QuerySet, Manager)):\n            # Ensure queryset is re-evaluated whenever used.\n            # Note that actually a `Manager` class may also be used as the\n            # queryset argument. This occurs on ModelSerializer fields,\n            # as it allows us to generate a more expressive 'repr' output\n            # for the field.\n            # Eg: 'MyRelationship(queryset=ExampleModel.objects.all())'\n            queryset = queryset.all()\n        return queryset\n\n    def use_pk_only_optimization(self):\n        return False\n\n    def get_attribute(self, instance):\n        if self.use_pk_only_optimization() and self.source_attrs:\n            # Optimized case, return a mock object only containing the pk attribute.\n            with contextlib.suppress(AttributeError):\n                attribute_instance = get_attribute(instance, self.source_attrs[:-1])\n                value = attribute_instance.serializable_value(self.source_attrs[-1])\n                if is_simple_callable(value):\n                    # Handle edge case where the relationship `source` argument\n                    # points to a `get_relationship()` method on the model.\n                    value = value()\n\n                # Handle edge case where relationship `source` argument points\n                # to an instance instead of a pk (e.g., a `@property`).\n                value = getattr(value, 'pk', value)\n\n                return PKOnlyObject(pk=value)\n        # Standard case, return the object instance.\n        return super().get_attribute(instance)\n\n    def get_choices(self, cutoff=None):\n        queryset = self.get_queryset()\n        if queryset is None:\n            # Ensure that field.choices returns something sensible\n            # even when accessed with a read-only field.\n            return {}\n\n        if cutoff is not None:\n            queryset = queryset[:cutoff]\n\n        return {\n            self.to_representation(item): self.display_value(item) for item in queryset\n        }\n\n    @property\n    def choices(self):\n        return self.get_choices()\n\n    @property\n    def grouped_choices(self):\n        return self.choices\n\n    def iter_options(self):\n        return iter_options(\n            self.get_choices(cutoff=self.html_cutoff),\n            cutoff=self.html_cutoff,\n            cutoff_text=self.html_cutoff_text\n        )\n\n    def display_value(self, instance):\n        return str(instance)\n\n\nclass StringRelatedField(RelatedField):\n    \"\"\"\n    A read only field that represents its targets using their\n    plain string representation.\n    \"\"\"\n\n    def __init__(self, **kwargs):\n        kwargs['read_only'] = True\n        super().__init__(**kwargs)\n\n    def to_representation(self, value):\n        return str(value)\n\n\nclass PrimaryKeyRelatedField(RelatedField):\n    default_error_messages = {\n        'required': _('This field is required.'),\n        'does_not_exist': _('Invalid pk \"{pk_value}\" - object does not exist.'),\n        'incorrect_type': _('Incorrect type. Expected pk value, received {data_type}.'),\n    }\n\n    def __init__(self, **kwargs):\n        self.pk_field = kwargs.pop('pk_field', None)\n        super().__init__(**kwargs)\n\n    def use_pk_only_optimization(self):\n        return True\n\n    def to_internal_value(self, data):\n        if self.pk_field is not None:\n            data = self.pk_field.to_internal_value(data)\n        queryset = self.get_queryset()\n        try:\n            if isinstance(data, bool):\n                raise TypeError\n            return queryset.get(pk=data)\n        except ObjectDoesNotExist:\n            self.fail('does_not_exist', pk_value=data)\n        except (TypeError, ValueError):\n            self.fail('incorrect_type', data_type=type(data).__name__)\n\n    def to_representation(self, value):\n        if self.pk_field is not None:\n            return self.pk_field.to_representation(value.pk)\n        return value.pk\n\n\nclass HyperlinkedRelatedField(RelatedField):\n    lookup_field = 'pk'\n    view_name = None\n\n    default_error_messages = {\n        'required': _('This field is required.'),\n        'no_match': _('Invalid hyperlink - No URL match.'),\n        'incorrect_match': _('Invalid hyperlink - Incorrect URL match.'),\n        'does_not_exist': _('Invalid hyperlink - Object does not exist.'),\n        'incorrect_type': _('Incorrect type. Expected URL string, received {data_type}.'),\n    }\n\n    def __init__(self, view_name=None, **kwargs):\n        if view_name is not None:\n            self.view_name = view_name\n        assert self.view_name is not None, 'The `view_name` argument is required.'\n        self.lookup_field = kwargs.pop('lookup_field', self.lookup_field)\n        self.lookup_url_kwarg = kwargs.pop('lookup_url_kwarg', self.lookup_field)\n        self.format = kwargs.pop('format', None)\n\n        # We include this simply for dependency injection in tests.\n        # We can't add it as a class attributes or it would expect an\n        # implicit `self` argument to be passed.\n        self.reverse = reverse\n\n        super().__init__(**kwargs)\n\n    def use_pk_only_optimization(self):\n        return self.lookup_field == 'pk'\n\n    def get_object(self, view_name, view_args, view_kwargs):\n        \"\"\"\n        Return the object corresponding to a matched URL.\n\n        Takes the matched URL conf arguments, and should return an\n        object instance, or raise an `ObjectDoesNotExist` exception.\n        \"\"\"\n        lookup_value = view_kwargs[self.lookup_url_kwarg]\n        lookup_kwargs = {self.lookup_field: lookup_value}\n        queryset = self.get_queryset()\n\n        try:\n            return queryset.get(**lookup_kwargs)\n        except ValueError:\n            exc = ObjectValueError(str(sys.exc_info()[1]))\n            raise exc.with_traceback(sys.exc_info()[2])\n        except TypeError:\n            exc = ObjectTypeError(str(sys.exc_info()[1]))\n            raise exc.with_traceback(sys.exc_info()[2])\n\n    def get_url(self, obj, view_name, request, format):\n        \"\"\"\n        Given an object, return the URL that hyperlinks to the object.\n\n        May raise a `NoReverseMatch` if the `view_name` and `lookup_field`\n        attributes are not configured to correctly match the URL conf.\n        \"\"\"\n        # Unsaved objects will not yet have a valid URL.\n        if hasattr(obj, 'pk') and obj.pk in (None, ''):\n            return None\n\n        lookup_value = getattr(obj, self.lookup_field)\n        kwargs = {self.lookup_url_kwarg: lookup_value}\n        return self.reverse(view_name, kwargs=kwargs, request=request, format=format)\n\n    def to_internal_value(self, data):\n        request = self.context.get('request')\n        try:\n            http_prefix = data.startswith(('http:', 'https:'))\n        except AttributeError:\n            self.fail('incorrect_type', data_type=type(data).__name__)\n\n        if http_prefix:\n            # If needed convert absolute URLs to relative path\n            data = parse.urlparse(data).path\n            prefix = get_script_prefix()\n            if data.startswith(prefix):\n                data = '/' + data[len(prefix):]\n\n        data = uri_to_iri(parse.unquote(data))\n\n        try:\n            match = resolve(data)\n        except Resolver404:\n            self.fail('no_match')\n\n        try:\n            expected_viewname = request.versioning_scheme.get_versioned_viewname(\n                self.view_name, request\n            )\n        except AttributeError:\n            expected_viewname = self.view_name\n\n        if match.view_name != expected_viewname:\n            self.fail('incorrect_match')\n\n        try:\n            return self.get_object(match.view_name, match.args, match.kwargs)\n        except (ObjectDoesNotExist, ObjectValueError, ObjectTypeError):\n            self.fail('does_not_exist')\n\n    def to_representation(self, value):\n        assert 'request' in self.context, (\n            \"`%s` requires the request in the serializer\"\n            \" context. Add `context={'request': request}` when instantiating \"\n            \"the serializer.\" % self.__class__.__name__\n        )\n\n        request = self.context['request']\n        format = self.context.get('format')\n\n        # By default use whatever format is given for the current context\n        # unless the target is a different type to the source.\n        #\n        # Eg. Consider a HyperlinkedIdentityField pointing from a json\n        # representation to an html property of that representation...\n        #\n        # '/snippets/1/' should link to '/snippets/1/highlight/'\n        # ...but...\n        # '/snippets/1/.json' should link to '/snippets/1/highlight/.html'\n        if format and self.format and self.format != format:\n            format = self.format\n\n        # Return the hyperlink, or error if incorrectly configured.\n        try:\n            url = self.get_url(value, self.view_name, request, format)\n        except NoReverseMatch:\n            msg = (\n                'Could not resolve URL for hyperlinked relationship using '\n                'view name \"%s\". You may have failed to include the related '\n                'model in your API, or incorrectly configured the '\n                '`lookup_field` attribute on this field.'\n            )\n            if value in ('', None):\n                value_string = {'': 'the empty string', None: 'None'}[value]\n                msg += (\n                    \" WARNING: The value of the field on the model instance \"\n                    \"was %s, which may be why it didn't match any \"\n                    \"entries in your URL conf.\" % value_string\n                )\n            raise ImproperlyConfigured(msg % self.view_name)\n\n        if url is None:\n            return None\n\n        return Hyperlink(url, value)\n\n\nclass HyperlinkedIdentityField(HyperlinkedRelatedField):\n    \"\"\"\n    A read-only field that represents the identity URL for an object, itself.\n\n    This is in contrast to `HyperlinkedRelatedField` which represents the\n    URL of relationships to other objects.\n    \"\"\"\n\n    def __init__(self, view_name=None, **kwargs):\n        assert view_name is not None, 'The `view_name` argument is required.'\n        kwargs['read_only'] = True\n        kwargs['source'] = '*'\n        super().__init__(view_name, **kwargs)\n\n    def use_pk_only_optimization(self):\n        # We have the complete object instance already. We don't need\n        # to run the 'only get the pk for this relationship' code.\n        return False\n\n\nclass SlugRelatedField(RelatedField):\n    \"\"\"\n    A read-write field that represents the target of the relationship\n    by a unique 'slug' attribute.\n    \"\"\"\n    default_error_messages = {\n        'does_not_exist': _('Object with {slug_name}={value} does not exist.'),\n        'invalid': _('Invalid value.'),\n    }\n\n    def __init__(self, slug_field=None, **kwargs):\n        assert slug_field is not None, 'The `slug_field` argument is required.'\n        self.slug_field = slug_field\n        super().__init__(**kwargs)\n\n    def to_internal_value(self, data):\n        queryset = self.get_queryset()\n        try:\n            return queryset.get(**{self.slug_field: data})\n        except ObjectDoesNotExist:\n            self.fail('does_not_exist', slug_name=self.slug_field, value=smart_str(data))\n        except (TypeError, ValueError):\n            self.fail('invalid')\n\n    def to_representation(self, obj):\n        slug = self.slug_field\n        if \"__\" in slug:\n            # handling nested relationship if defined\n            slug = slug.replace('__', '.')\n        return attrgetter(slug)(obj)\n\n\nclass ManyRelatedField(Field):\n    \"\"\"\n    Relationships with `many=True` transparently get coerced into instead being\n    a ManyRelatedField with a child relationship.\n\n    The `ManyRelatedField` class is responsible for handling iterating through\n    the values and passing each one to the child relationship.\n\n    This class is treated as private API.\n    You shouldn't generally need to be using this class directly yourself,\n    and should instead simply set 'many=True' on the relationship.\n    \"\"\"\n    initial = []\n    default_empty_html = []\n    default_error_messages = {\n        'not_a_list': _('Expected a list of items but got type \"{input_type}\".'),\n        'empty': _('This list may not be empty.')\n    }\n    html_cutoff = None\n    html_cutoff_text = None\n\n    def __init__(self, child_relation=None, *args, **kwargs):\n        self.child_relation = child_relation\n        self.allow_empty = kwargs.pop('allow_empty', True)\n\n        cutoff_from_settings = api_settings.HTML_SELECT_CUTOFF\n        if cutoff_from_settings is not None:\n            cutoff_from_settings = int(cutoff_from_settings)\n        self.html_cutoff = kwargs.pop('html_cutoff', cutoff_from_settings)\n\n        self.html_cutoff_text = kwargs.pop(\n            'html_cutoff_text',\n            self.html_cutoff_text or _(api_settings.HTML_SELECT_CUTOFF_TEXT)\n        )\n        assert child_relation is not None, '`child_relation` is a required argument.'\n        super().__init__(*args, **kwargs)\n        self.child_relation.bind(field_name='', parent=self)\n\n    def get_value(self, dictionary):\n        # We override the default field access in order to support\n        # lists in HTML forms.\n        if html.is_html_input(dictionary):\n            # Don't return [] if the update is partial\n            if self.field_name not in dictionary:\n                if getattr(self.root, 'partial', False):\n                    return empty\n            return dictionary.getlist(self.field_name)\n\n        return dictionary.get(self.field_name, empty)\n\n    def to_internal_value(self, data):\n        if isinstance(data, str) or not hasattr(data, '__iter__'):\n            self.fail('not_a_list', input_type=type(data).__name__)\n        if not self.allow_empty and len(data) == 0:\n            self.fail('empty')\n\n        return [\n            self.child_relation.to_internal_value(item)\n            for item in data\n        ]\n\n    def get_attribute(self, instance):\n        # Can't have any relationships if not created\n        if hasattr(instance, 'pk') and instance.pk is None:\n            return []\n\n        try:\n            relationship = get_attribute(instance, self.source_attrs)\n        except (KeyError, AttributeError) as exc:\n            if self.default is not empty:\n                return self.get_default()\n            if self.allow_null:\n                return None\n            if not self.required:\n                raise SkipField()\n            msg = (\n                'Got {exc_type} when attempting to get a value for field '\n                '`{field}` on serializer `{serializer}`.\\nThe serializer '\n                'field might be named incorrectly and not match '\n                'any attribute or key on the `{instance}` instance.\\n'\n                'Original exception text was: {exc}.'.format(\n                    exc_type=type(exc).__name__,\n                    field=self.field_name,\n                    serializer=self.parent.__class__.__name__,\n                    instance=instance.__class__.__name__,\n                    exc=exc\n                )\n            )\n            raise type(exc)(msg)\n\n        return relationship.all() if hasattr(relationship, 'all') else relationship\n\n    def to_representation(self, iterable):\n        return [\n            self.child_relation.to_representation(value)\n            for value in iterable\n        ]\n\n    def get_choices(self, cutoff=None):\n        return self.child_relation.get_choices(cutoff)\n\n    @property\n    def choices(self):\n        return self.get_choices()\n\n    @property\n    def grouped_choices(self):\n        return self.choices\n\n    def iter_options(self):\n        return iter_options(\n            self.get_choices(cutoff=self.html_cutoff),\n            cutoff=self.html_cutoff,\n            cutoff_text=self.html_cutoff_text\n        )\n"
  },
  {
    "path": "rest_framework/renderers.py",
    "content": "\"\"\"\nRenderers are used to serialize a response into specific media types.\n\nThey give us a generic way of being able to handle various media types\non the response, such as JSON encoded data or HTML output.\n\nREST framework also provides an HTML renderer that renders the browsable API.\n\"\"\"\n\nimport contextlib\nimport datetime\nimport sys\n\nfrom django import forms\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.paginator import Page\nfrom django.template import engines, loader\nfrom django.urls import NoReverseMatch\nfrom django.utils.http import parse_header_parameters\nfrom django.utils.safestring import SafeString\n\nfrom rest_framework import ISO_8601, VERSION, exceptions, serializers, status\nfrom rest_framework.compat import (\n    INDENT_SEPARATORS, LONG_SEPARATORS, SHORT_SEPARATORS, pygments_css, yaml\n)\nfrom rest_framework.exceptions import ParseError\nfrom rest_framework.request import is_form_media_type, override_method\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils import encoders, json\nfrom rest_framework.utils.breadcrumbs import get_breadcrumbs\nfrom rest_framework.utils.field_mapping import ClassLookupDict\n\n\ndef zero_as_none(value):\n    return None if value == 0 else value\n\n\nclass BaseRenderer:\n    \"\"\"\n    All renderers should extend this class, setting the `media_type`\n    and `format` attributes, and override the `.render()` method.\n    \"\"\"\n    media_type = None\n    format = None\n    charset = 'utf-8'\n    render_style = 'text'\n\n    def render(self, data, accepted_media_type=None, renderer_context=None):\n        raise NotImplementedError('Renderer class requires .render() to be implemented')\n\n\nclass JSONRenderer(BaseRenderer):\n    \"\"\"\n    Renderer which serializes to JSON.\n    \"\"\"\n    media_type = 'application/json'\n    format = 'json'\n    encoder_class = encoders.JSONEncoder\n    ensure_ascii = not api_settings.UNICODE_JSON\n    compact = api_settings.COMPACT_JSON\n    strict = api_settings.STRICT_JSON\n\n    # We don't set a charset because JSON is a binary encoding,\n    # that can be encoded as utf-8, utf-16 or utf-32.\n    # See: https://www.ietf.org/rfc/rfc4627.txt\n    # Also: http://lucumr.pocoo.org/2013/7/19/application-mimetypes-and-encodings/\n    charset = None\n\n    def get_indent(self, accepted_media_type, renderer_context):\n        if accepted_media_type:\n            # If the media type looks like 'application/json; indent=4',\n            # then pretty print the result.\n            # Note that we coerce `indent=0` into `indent=None`.\n            base_media_type, params = parse_header_parameters(accepted_media_type)\n            with contextlib.suppress(KeyError, ValueError, TypeError):\n                return zero_as_none(max(min(int(params['indent']), 8), 0))\n        # If 'indent' is provided in the context, then pretty print the result.\n        # E.g. If we're being called by the BrowsableAPIRenderer.\n        return renderer_context.get('indent', None)\n\n    def render(self, data, accepted_media_type=None, renderer_context=None):\n        \"\"\"\n        Render `data` into JSON, returning a bytestring.\n        \"\"\"\n        if data is None:\n            return b''\n\n        renderer_context = renderer_context or {}\n        indent = self.get_indent(accepted_media_type, renderer_context)\n\n        if indent is None:\n            separators = SHORT_SEPARATORS if self.compact else LONG_SEPARATORS\n        else:\n            separators = INDENT_SEPARATORS\n\n        ret = json.dumps(\n            data, cls=self.encoder_class,\n            indent=indent, ensure_ascii=self.ensure_ascii,\n            allow_nan=not self.strict, separators=separators\n        )\n\n        # We always fully escape \\u2028 and \\u2029 to ensure we output JSON\n        # that is a strict javascript subset.\n        # See: https://gist.github.com/damncabbage/623b879af56f850a6ddc\n        ret = ret.replace('\\u2028', '\\\\u2028').replace('\\u2029', '\\\\u2029')\n        return ret.encode()\n\n\nclass TemplateHTMLRenderer(BaseRenderer):\n    \"\"\"\n    An HTML renderer for use with templates.\n\n    The data supplied to the Response object should be a dictionary that will\n    be used as context for the template.\n\n    The template name is determined by (in order of preference):\n\n    1. An explicit `.template_name` attribute set on the response.\n    2. An explicit `.template_name` attribute set on this class.\n    3. The return result of calling `view.get_template_names()`.\n\n    For example:\n        data = {'users': User.objects.all()}\n        return Response(data, template_name='users.html')\n\n    For pre-rendered HTML, see StaticHTMLRenderer.\n    \"\"\"\n    media_type = 'text/html'\n    format = 'html'\n    template_name = None\n    exception_template_names = [\n        '%(status_code)s.html',\n        'api_exception.html'\n    ]\n    charset = 'utf-8'\n\n    def render(self, data, accepted_media_type=None, renderer_context=None):\n        \"\"\"\n        Renders data to HTML, using Django's standard template rendering.\n\n        The template name is determined by (in order of preference):\n\n        1. An explicit .template_name set on the response.\n        2. An explicit .template_name set on this class.\n        3. The return result of calling view.get_template_names().\n        \"\"\"\n        renderer_context = renderer_context or {}\n        view = renderer_context['view']\n        request = renderer_context['request']\n        response = renderer_context['response']\n\n        if response.exception:\n            template = self.get_exception_template(response)\n        else:\n            template_names = self.get_template_names(response, view)\n            template = self.resolve_template(template_names)\n\n        if hasattr(self, 'resolve_context'):\n            # Fallback for older versions.\n            context = self.resolve_context(data, request, response)\n        else:\n            context = self.get_template_context(data, renderer_context)\n        return template.render(context, request=request)\n\n    def resolve_template(self, template_names):\n        return loader.select_template(template_names)\n\n    def get_template_context(self, data, renderer_context):\n        response = renderer_context['response']\n        # in case a ValidationError is caught the data parameter may be a list\n        # see rest_framework.views.exception_handler\n        if isinstance(data, list):\n            return {'details': data, 'status_code': response.status_code}\n        if response.exception:\n            data['status_code'] = response.status_code\n        return data\n\n    def get_template_names(self, response, view):\n        if response.template_name:\n            return [response.template_name]\n        elif self.template_name:\n            return [self.template_name]\n        elif hasattr(view, 'get_template_names'):\n            return view.get_template_names()\n        elif hasattr(view, 'template_name'):\n            return [view.template_name]\n        raise ImproperlyConfigured(\n            'Returned a template response with no `template_name` attribute set on either the view or response'\n        )\n\n    def get_exception_template(self, response):\n        template_names = [name % {'status_code': response.status_code}\n                          for name in self.exception_template_names]\n\n        try:\n            # Try to find an appropriate error template\n            return self.resolve_template(template_names)\n        except Exception:\n            # Fall back to using eg '404 Not Found'\n            body = '%d %s' % (response.status_code, response.status_text.title())\n            template = engines['django'].from_string(body)\n            return template\n\n\n# Note, subclass TemplateHTMLRenderer simply for the exception behavior\nclass StaticHTMLRenderer(TemplateHTMLRenderer):\n    \"\"\"\n    An HTML renderer class that simply returns pre-rendered HTML.\n\n    The data supplied to the Response object should be a string representing\n    the pre-rendered HTML content.\n\n    For example:\n        data = '<html><body>example</body></html>'\n        return Response(data)\n\n    For template rendered HTML, see TemplateHTMLRenderer.\n    \"\"\"\n    media_type = 'text/html'\n    format = 'html'\n    charset = 'utf-8'\n\n    def render(self, data, accepted_media_type=None, renderer_context=None):\n        renderer_context = renderer_context or {}\n        response = renderer_context.get('response')\n\n        if response and response.exception:\n            request = renderer_context['request']\n            template = self.get_exception_template(response)\n            if hasattr(self, 'resolve_context'):\n                context = self.resolve_context(data, request, response)\n            else:\n                context = self.get_template_context(data, renderer_context)\n            return template.render(context, request=request)\n\n        return data\n\n\nclass HTMLFormRenderer(BaseRenderer):\n    \"\"\"\n    Renderers serializer data into an HTML form.\n\n    If the serializer was instantiated without an object then this will\n    return an HTML form not bound to any object,\n    otherwise it will return an HTML form with the appropriate initial data\n    populated from the object.\n\n    Note that rendering of field and form errors is not currently supported.\n    \"\"\"\n    media_type = 'text/html'\n    format = 'form'\n    charset = 'utf-8'\n    template_pack = 'rest_framework/vertical/'\n    base_template = 'form.html'\n\n    default_style = ClassLookupDict({\n        serializers.Field: {\n            'base_template': 'input.html',\n            'input_type': 'text'\n        },\n        serializers.EmailField: {\n            'base_template': 'input.html',\n            'input_type': 'email'\n        },\n        serializers.URLField: {\n            'base_template': 'input.html',\n            'input_type': 'url'\n        },\n        serializers.IntegerField: {\n            'base_template': 'input.html',\n            'input_type': 'number'\n        },\n        serializers.FloatField: {\n            'base_template': 'input.html',\n            'input_type': 'number'\n        },\n        serializers.DateTimeField: {\n            'base_template': 'input.html',\n            'input_type': 'datetime-local'\n        },\n        serializers.DateField: {\n            'base_template': 'input.html',\n            'input_type': 'date'\n        },\n        serializers.TimeField: {\n            'base_template': 'input.html',\n            'input_type': 'time'\n        },\n        serializers.FileField: {\n            'base_template': 'input.html',\n            'input_type': 'file'\n        },\n        serializers.BooleanField: {\n            'base_template': 'checkbox.html'\n        },\n        serializers.ChoiceField: {\n            'base_template': 'select.html',  # Also valid: 'radio.html'\n        },\n        serializers.MultipleChoiceField: {\n            'base_template': 'select_multiple.html',  # Also valid: 'checkbox_multiple.html'\n        },\n        serializers.RelatedField: {\n            'base_template': 'select.html',  # Also valid: 'radio.html'\n        },\n        serializers.ManyRelatedField: {\n            'base_template': 'select_multiple.html',  # Also valid: 'checkbox_multiple.html'\n        },\n        serializers.Serializer: {\n            'base_template': 'fieldset.html'\n        },\n        serializers.ListSerializer: {\n            'base_template': 'list_fieldset.html'\n        },\n        serializers.ListField: {\n            'base_template': 'list_field.html'\n        },\n        serializers.DictField: {\n            'base_template': 'dict_field.html'\n        },\n        serializers.FilePathField: {\n            'base_template': 'select.html',\n        },\n        serializers.JSONField: {\n            'base_template': 'textarea.html',\n        },\n    })\n\n    def render_field(self, field, parent_style):\n        if isinstance(field._field, serializers.HiddenField):\n            return ''\n\n        style = self.default_style[field].copy()\n        style.update(field.style)\n        if 'template_pack' not in style:\n            style['template_pack'] = parent_style.get('template_pack', self.template_pack)\n        style['renderer'] = self\n\n        # Get a clone of the field with text-only value representation ('' if None or False).\n        field = field.as_form_field()\n\n        if style.get('input_type') == 'datetime-local':\n            try:\n                format_ = field._field.format\n            except AttributeError:\n                format_ = api_settings.DATETIME_FORMAT\n\n            if format_ is not None:\n                # field.value is expected to be a string\n                # https://www.django-rest-framework.org/api-guide/fields/#datetimefield\n                field_value = field.value\n                if format_ == ISO_8601 and sys.version_info < (3, 11):\n                    # We can drop this branch once we drop support for Python < 3.11\n                    # https://docs.python.org/3/whatsnew/3.11.html#datetime\n                    field_value = field_value.rstrip('Z')\n                field.value = (\n                    datetime.datetime.fromisoformat(field_value) if format_ == ISO_8601\n                    else datetime.datetime.strptime(field_value, format_)\n                )\n\n            # The format of an input type=\"datetime-local\" is \"yyyy-MM-ddThh:mm\"\n            # followed by optional \":ss\" or \":ss.SSS\", so keep only the first three\n            # digits of milliseconds to avoid browser console error.\n            field.value = field.value.replace(tzinfo=None).isoformat(timespec=\"milliseconds\")\n\n        if 'template' in style:\n            template_name = style['template']\n        else:\n            template_name = style['template_pack'].strip('/') + '/' + style['base_template']\n\n        template = loader.get_template(template_name)\n        context = {'field': field, 'style': style}\n        return template.render(context)\n\n    def render(self, data, accepted_media_type=None, renderer_context=None):\n        \"\"\"\n        Render serializer data and return an HTML form, as a string.\n        \"\"\"\n        renderer_context = renderer_context or {}\n        form = data.serializer\n\n        style = renderer_context.get('style', {})\n        if 'template_pack' not in style:\n            style['template_pack'] = self.template_pack\n        style['renderer'] = self\n\n        template_pack = style['template_pack'].strip('/')\n        template_name = template_pack + '/' + self.base_template\n        template = loader.get_template(template_name)\n        context = {\n            'form': form,\n            'style': style\n        }\n        return template.render(context)\n\n\nclass BrowsableAPIRenderer(BaseRenderer):\n    \"\"\"\n    HTML renderer used to self-document the API.\n    \"\"\"\n    media_type = 'text/html'\n    format = 'api'\n    template = 'rest_framework/api.html'\n    filter_template = 'rest_framework/filters/base.html'\n    code_style = 'emacs'\n    charset = 'utf-8'\n    form_renderer_class = HTMLFormRenderer\n\n    def get_default_renderer(self, view):\n        \"\"\"\n        Return an instance of the first valid renderer.\n        (Don't use another documenting renderer.)\n        \"\"\"\n        renderers = [renderer for renderer in view.renderer_classes\n                     if not issubclass(renderer, BrowsableAPIRenderer)]\n        non_template_renderers = [renderer for renderer in renderers\n                                  if not hasattr(renderer, 'get_template_names')]\n\n        if not renderers:\n            return None\n        elif non_template_renderers:\n            return non_template_renderers[0]()\n        return renderers[0]()\n\n    def get_content(self, renderer, data,\n                    accepted_media_type, renderer_context):\n        \"\"\"\n        Get the content as if it had been rendered by the default\n        non-documenting renderer.\n        \"\"\"\n        if not renderer:\n            return '[No renderers were found]'\n\n        renderer_context['indent'] = 4\n        content = renderer.render(data, accepted_media_type, renderer_context)\n\n        render_style = getattr(renderer, 'render_style', 'text')\n        assert render_style in ['text', 'binary'], 'Expected .render_style ' \\\n            '\"text\" or \"binary\", but got \"%s\"' % render_style\n        if render_style == 'binary':\n            return '[%d bytes of binary content]' % len(content)\n\n        return content.decode('utf-8') if isinstance(content, bytes) else content\n\n    def show_form_for_method(self, view, method, request, obj):\n        \"\"\"\n        Returns True if a form should be shown for this method.\n        \"\"\"\n        if method not in view.allowed_methods:\n            return  # Not a valid method\n\n        try:\n            view.check_permissions(request)\n            if obj is not None:\n                view.check_object_permissions(request, obj)\n        except exceptions.APIException:\n            return False  # Doesn't have permissions\n        return True\n\n    def _get_serializer(self, serializer_class, view_instance, request, *args, **kwargs):\n        kwargs['context'] = {\n            'request': request,\n            'format': self.format,\n            'view': view_instance\n        }\n        return serializer_class(*args, **kwargs)\n\n    def get_rendered_html_form(self, data, view, method, request):\n        \"\"\"\n        Return a string representing a rendered HTML form, possibly bound to\n        either the input or output data.\n\n        In the absence of the View having an associated form then return None.\n        \"\"\"\n        # See issue #2089 for refactoring this.\n        serializer = getattr(data, 'serializer', None)\n        if serializer and not getattr(serializer, 'many', False):\n            instance = getattr(serializer, 'instance', None)\n            if isinstance(instance, Page):\n                instance = None\n        else:\n            instance = None\n\n        # If this is valid serializer data, and the form is for the same\n        # HTTP method as was used in the request then use the existing\n        # serializer instance, rather than dynamically creating a new one.\n        if request.method == method and serializer is not None:\n            try:\n                kwargs = {'data': request.data}\n            except ParseError:\n                kwargs = {}\n            existing_serializer = serializer\n        else:\n            kwargs = {}\n            existing_serializer = None\n\n        with override_method(view, request, method) as request:\n            if not self.show_form_for_method(view, method, request, instance):\n                return\n\n            if method in ('DELETE', 'OPTIONS'):\n                return True  # Don't actually need to return a form\n\n            has_serializer = getattr(view, 'get_serializer', None)\n            has_serializer_class = getattr(view, 'serializer_class', None)\n\n            if (\n                (not has_serializer and not has_serializer_class) or\n                not any(is_form_media_type(parser.media_type) for parser in view.parser_classes)\n            ):\n                return\n\n            if existing_serializer is not None:\n                with contextlib.suppress(TypeError):\n                    return self.render_form_for_serializer(existing_serializer)\n            if has_serializer:\n                if method in ('PUT', 'PATCH'):\n                    serializer = view.get_serializer(instance=instance, **kwargs)\n                else:\n                    serializer = view.get_serializer(**kwargs)\n            else:\n                # at this point we must have a serializer_class\n                if method in ('PUT', 'PATCH'):\n                    serializer = self._get_serializer(view.serializer_class, view,\n                                                      request, instance=instance, **kwargs)\n                else:\n                    serializer = self._get_serializer(view.serializer_class, view,\n                                                      request, **kwargs)\n\n            return self.render_form_for_serializer(serializer)\n\n    def render_form_for_serializer(self, serializer):\n        if isinstance(serializer, serializers.ListSerializer):\n            return None\n\n        if hasattr(serializer, 'initial_data'):\n            serializer.is_valid()\n\n        form_renderer = self.form_renderer_class()\n        return form_renderer.render(\n            serializer.data,\n            self.accepted_media_type,\n            {'style': {'template_pack': 'rest_framework/horizontal'}}\n        )\n\n    def get_raw_data_form(self, data, view, method, request):\n        \"\"\"\n        Returns a form that allows for arbitrary content types to be tunneled\n        via standard HTML forms.\n        (Which are typically application/x-www-form-urlencoded)\n        \"\"\"\n        # See issue #2089 for refactoring this.\n        serializer = getattr(data, 'serializer', None)\n        if serializer and not getattr(serializer, 'many', False):\n            instance = getattr(serializer, 'instance', None)\n            if isinstance(instance, Page):\n                instance = None\n        else:\n            instance = None\n\n        with override_method(view, request, method) as request:\n            # Check permissions\n            if not self.show_form_for_method(view, method, request, instance):\n                return\n\n            # If possible, serialize the initial content for the generic form\n            default_parser = view.parser_classes[0]\n            renderer_class = getattr(default_parser, 'renderer_class', None)\n            if hasattr(view, 'get_serializer') and renderer_class:\n                # View has a serializer defined and parser class has a\n                # corresponding renderer that can be used to render the data.\n\n                if method in ('PUT', 'PATCH'):\n                    serializer = view.get_serializer(instance=instance)\n                else:\n                    serializer = view.get_serializer()\n\n                # Render the raw data content\n                renderer = renderer_class()\n                accepted = self.accepted_media_type\n                context = self.renderer_context.copy()\n                context['indent'] = 4\n\n                # strip HiddenField from output\n                is_list_serializer = isinstance(serializer, serializers.ListSerializer)\n                serializer = serializer.child if is_list_serializer else serializer\n                data = serializer.data.copy()\n                for name, field in serializer.fields.items():\n                    if isinstance(field, serializers.HiddenField):\n                        data.pop(name, None)\n                data = [data] if is_list_serializer else data\n                content = renderer.render(data, accepted, context)\n                # Renders returns bytes, but CharField expects a str.\n                content = content.decode()\n            else:\n                content = None\n\n            # Generate a generic form that includes a content type field,\n            # and a content field.\n            media_types = [parser.media_type for parser in view.parser_classes]\n            choices = [(media_type, media_type) for media_type in media_types]\n            initial = media_types[0]\n\n            class GenericContentForm(forms.Form):\n                _content_type = forms.ChoiceField(\n                    label='Media type',\n                    choices=choices,\n                    initial=initial,\n                    widget=forms.Select(attrs={'data-override': 'content-type'})\n                )\n                _content = forms.CharField(\n                    label='Content',\n                    widget=forms.Textarea(attrs={'data-override': 'content'}),\n                    initial=content,\n                    required=False\n                )\n\n            return GenericContentForm()\n\n    def get_name(self, view):\n        return view.get_view_name()\n\n    def get_description(self, view, status_code):\n        if status_code in (status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN):\n            return ''\n        return view.get_view_description(html=True)\n\n    def get_breadcrumbs(self, request):\n        return get_breadcrumbs(request.path, request)\n\n    def get_extra_actions(self, view, status_code):\n        if (status_code in (status.HTTP_401_UNAUTHORIZED, status.HTTP_403_FORBIDDEN)):\n            return None\n        elif not hasattr(view, 'get_extra_action_url_map'):\n            return None\n\n        return view.get_extra_action_url_map()\n\n    def get_filter_form(self, data, view, request):\n        if not hasattr(view, 'get_queryset') or not hasattr(view, 'filter_backends'):\n            return\n\n        # Infer if this is a list view or not.\n        paginator = getattr(view, 'paginator', None)\n        if isinstance(data, list):\n            pass\n        elif paginator is not None and data is not None:\n            try:\n                paginator.get_results(data)\n            except (TypeError, KeyError):\n                return\n        elif not isinstance(data, list):\n            return\n\n        queryset = view.get_queryset()\n        elements = []\n        for backend in view.filter_backends:\n            if hasattr(backend, 'to_html'):\n                html = backend().to_html(request, queryset, view)\n                if html:\n                    elements.append(html)\n\n        if not elements:\n            return\n\n        template = loader.get_template(self.filter_template)\n        context = {'elements': elements}\n        return template.render(context)\n\n    def get_context(self, data, accepted_media_type, renderer_context):\n        \"\"\"\n        Returns the context used to render.\n        \"\"\"\n        view = renderer_context['view']\n        request = renderer_context['request']\n        response = renderer_context['response']\n\n        renderer = self.get_default_renderer(view)\n\n        raw_data_post_form = self.get_raw_data_form(data, view, 'POST', request)\n        raw_data_put_form = self.get_raw_data_form(data, view, 'PUT', request)\n        raw_data_patch_form = self.get_raw_data_form(data, view, 'PATCH', request)\n        raw_data_put_or_patch_form = raw_data_put_form or raw_data_patch_form\n\n        response_headers = dict(sorted(response.items()))\n        renderer_content_type = ''\n        if renderer:\n            renderer_content_type = '%s' % renderer.media_type\n            if renderer.charset:\n                renderer_content_type += ' ;%s' % renderer.charset\n        response_headers['Content-Type'] = renderer_content_type\n\n        if getattr(view, 'paginator', None) and view.paginator.display_page_controls:\n            paginator = view.paginator\n        else:\n            paginator = None\n\n        csrf_cookie_name = settings.CSRF_COOKIE_NAME\n        csrf_header_name = settings.CSRF_HEADER_NAME\n        if csrf_header_name.startswith('HTTP_'):\n            csrf_header_name = csrf_header_name[5:]\n        csrf_header_name = csrf_header_name.replace('_', '-')\n\n        return {\n            'content': self.get_content(renderer, data, accepted_media_type, renderer_context),\n            'code_style': pygments_css(self.code_style),\n            'view': view,\n            'request': request,\n            'response': response,\n            'user': request.user,\n            'description': self.get_description(view, response.status_code),\n            'name': self.get_name(view),\n            'version': VERSION,\n            'paginator': paginator,\n            'breadcrumblist': self.get_breadcrumbs(request),\n            'allowed_methods': view.allowed_methods,\n            'available_formats': [renderer_cls.format for renderer_cls in view.renderer_classes],\n            'response_headers': response_headers,\n\n            'put_form': self.get_rendered_html_form(data, view, 'PUT', request),\n            'post_form': self.get_rendered_html_form(data, view, 'POST', request),\n            'delete_form': self.get_rendered_html_form(data, view, 'DELETE', request),\n            'options_form': self.get_rendered_html_form(data, view, 'OPTIONS', request),\n\n            'extra_actions': self.get_extra_actions(view, response.status_code),\n\n            'filter_form': self.get_filter_form(data, view, request),\n\n            'raw_data_put_form': raw_data_put_form,\n            'raw_data_post_form': raw_data_post_form,\n            'raw_data_patch_form': raw_data_patch_form,\n            'raw_data_put_or_patch_form': raw_data_put_or_patch_form,\n\n            'display_edit_forms': bool(response.status_code != 403),\n\n            'api_settings': api_settings,\n            'csrf_cookie_name': csrf_cookie_name,\n            'csrf_header_name': csrf_header_name\n        }\n\n    def render(self, data, accepted_media_type=None, renderer_context=None):\n        \"\"\"\n        Render the HTML for the browsable API representation.\n        \"\"\"\n        self.accepted_media_type = accepted_media_type or ''\n        self.renderer_context = renderer_context or {}\n\n        template = loader.get_template(self.template)\n        context = self.get_context(data, accepted_media_type, renderer_context)\n        ret = template.render(context, request=renderer_context['request'])\n\n        # Munge DELETE Response code to allow us to return content\n        # (Do this *after* we've rendered the template so that we include\n        # the normal deletion response code in the output)\n        response = renderer_context['response']\n        if response.status_code == status.HTTP_204_NO_CONTENT:\n            response.status_code = status.HTTP_200_OK\n\n        return ret\n\n\nclass AdminRenderer(BrowsableAPIRenderer):\n    template = 'rest_framework/admin.html'\n    format = 'admin'\n\n    def render(self, data, accepted_media_type=None, renderer_context=None):\n        self.accepted_media_type = accepted_media_type or ''\n        self.renderer_context = renderer_context or {}\n\n        response = renderer_context['response']\n        request = renderer_context['request']\n        view = self.renderer_context['view']\n\n        if response.status_code == status.HTTP_400_BAD_REQUEST:\n            # Errors still need to display the list or detail information.\n            # The only way we can get at that is to simulate a GET request.\n            self.error_form = self.get_rendered_html_form(data, view, request.method, request)\n            self.error_title = {'POST': 'Create', 'PUT': 'Edit'}.get(request.method, 'Errors')\n\n            with override_method(view, request, 'GET') as request:\n                response = view.get(request, *view.args, **view.kwargs)\n            data = response.data\n\n        template = loader.get_template(self.template)\n        context = self.get_context(data, accepted_media_type, renderer_context)\n        ret = template.render(context, request=renderer_context['request'])\n\n        # Creation and deletion should use redirects in the admin style.\n        if response.status_code == status.HTTP_201_CREATED and 'Location' in response:\n            response.status_code = status.HTTP_303_SEE_OTHER\n            response['Location'] = request.build_absolute_uri()\n            ret = ''\n\n        if response.status_code == status.HTTP_204_NO_CONTENT:\n            response.status_code = status.HTTP_303_SEE_OTHER\n            try:\n                # Attempt to get the parent breadcrumb URL.\n                response['Location'] = self.get_breadcrumbs(request)[-2][1]\n            except KeyError:\n                # Otherwise reload current URL to get a 'Not Found' page.\n                response['Location'] = request.full_path\n            ret = ''\n\n        return ret\n\n    def get_context(self, data, accepted_media_type, renderer_context):\n        \"\"\"\n        Render the HTML for the browsable API representation.\n        \"\"\"\n        context = super().get_context(\n            data, accepted_media_type, renderer_context\n        )\n\n        paginator = getattr(context['view'], 'paginator', None)\n        if paginator is not None and data is not None:\n            try:\n                results = paginator.get_results(data)\n            except (TypeError, KeyError):\n                results = data\n        else:\n            results = data\n\n        if results is None:\n            header = {}\n            style = 'detail'\n        elif isinstance(results, list):\n            header = results[0] if results else {}\n            style = 'list'\n        else:\n            header = results\n            style = 'detail'\n\n        columns = [key for key in header if key != 'url']\n        details = [key for key in header if key != 'url']\n\n        if isinstance(results, list) and 'view' in renderer_context:\n            for result in results:\n                url = self.get_result_url(result, context['view'])\n                if url is not None:\n                    result.setdefault('url', url)\n\n        context['style'] = style\n        context['columns'] = columns\n        context['details'] = details\n        context['results'] = results\n        context['error_form'] = getattr(self, 'error_form', None)\n        context['error_title'] = getattr(self, 'error_title', None)\n        return context\n\n    def get_result_url(self, result, view):\n        \"\"\"\n        Attempt to reverse the result's detail view URL.\n\n        This only works with views that are generic-like (has `.lookup_field`)\n        and viewset-like (has `.basename` / `.reverse_action()`).\n        \"\"\"\n        if not hasattr(view, 'reverse_action') or \\\n           not hasattr(view, 'lookup_field'):\n            return\n\n        lookup_field = view.lookup_field\n        lookup_url_kwarg = getattr(view, 'lookup_url_kwarg', None) or lookup_field\n\n        try:\n            kwargs = {lookup_url_kwarg: result[lookup_field]}\n            return view.reverse_action('detail', kwargs=kwargs)\n        except (KeyError, NoReverseMatch):\n            return\n\n\nclass MultiPartRenderer(BaseRenderer):\n    media_type = 'multipart/form-data; boundary=BoUnDaRyStRiNg'\n    format = 'multipart'\n    charset = 'utf-8'\n    BOUNDARY = 'BoUnDaRyStRiNg'\n\n    def render(self, data, accepted_media_type=None, renderer_context=None):\n        from django.test.client import encode_multipart\n\n        if hasattr(data, 'items'):\n            for key, value in data.items():\n                assert not isinstance(value, dict), (\n                    \"Test data contained a dictionary value for key '%s', \"\n                    \"but multipart uploads do not support nested data. \"\n                    \"You may want to consider using format='json' in this \"\n                    \"test case.\" % key\n                )\n        return encode_multipart(self.BOUNDARY, data)\n\n\nclass OpenAPIRenderer(BaseRenderer):\n    media_type = 'application/vnd.oai.openapi'\n    charset = None\n    format = 'openapi'\n\n    def __init__(self):\n        assert yaml, 'Using OpenAPIRenderer, but `pyyaml` is not installed.'\n\n    def render(self, data, media_type=None, renderer_context=None):\n        # disable yaml advanced feature 'alias' for clean, portable, and readable output\n        class Dumper(yaml.Dumper):\n            def ignore_aliases(self, data):\n                return True\n        Dumper.add_representer(SafeString, Dumper.represent_str)\n        Dumper.add_representer(datetime.timedelta, encoders.CustomScalar.represent_timedelta)\n        return yaml.dump(data, default_flow_style=False, sort_keys=False, Dumper=Dumper).encode('utf-8')\n\n\nclass JSONOpenAPIRenderer(BaseRenderer):\n    media_type = 'application/vnd.oai.openapi+json'\n    charset = None\n    encoder_class = encoders.JSONEncoder\n    format = 'openapi-json'\n    ensure_ascii = not api_settings.UNICODE_JSON\n\n    def render(self, data, media_type=None, renderer_context=None):\n        return json.dumps(\n            data, cls=self.encoder_class, indent=2,\n            ensure_ascii=self.ensure_ascii).encode('utf-8')\n"
  },
  {
    "path": "rest_framework/request.py",
    "content": "\"\"\"\nThe Request class is used as a wrapper around the standard request object.\n\nThe wrapped request then offers a richer API, in particular :\n\n    - content automatically parsed according to `Content-Type` header,\n      and available as `request.data`\n    - full support of PUT method, including support for file uploads\n    - form overloading of HTTP method, content type and content\n\"\"\"\nimport io\nimport sys\nfrom contextlib import contextmanager\n\nfrom django.conf import settings\nfrom django.http import HttpRequest, QueryDict\nfrom django.http.request import RawPostDataException\nfrom django.utils.datastructures import MultiValueDict\nfrom django.utils.http import parse_header_parameters\n\nfrom rest_framework import exceptions\nfrom rest_framework.settings import api_settings\n\n\ndef is_form_media_type(media_type):\n    \"\"\"\n    Return True if the media type is a valid form media type.\n    \"\"\"\n    base_media_type, params = parse_header_parameters(media_type)\n    return (base_media_type == 'application/x-www-form-urlencoded' or\n            base_media_type == 'multipart/form-data')\n\n\nclass override_method:\n    \"\"\"\n    A context manager that temporarily overrides the method on a request,\n    additionally setting the `view.request` attribute.\n\n    Usage:\n\n        with override_method(view, request, 'POST') as request:\n            ... # Do stuff with `view` and `request`\n    \"\"\"\n\n    def __init__(self, view, request, method):\n        self.view = view\n        self.request = request\n        self.method = method\n        self.action = getattr(view, 'action', None)\n\n    def __enter__(self):\n        self.view.request = clone_request(self.request, self.method)\n        # For viewsets we also set the `.action` attribute.\n        action_map = getattr(self.view, 'action_map', {})\n        self.view.action = action_map.get(self.method.lower())\n        return self.view.request\n\n    def __exit__(self, *args, **kwarg):\n        self.view.request = self.request\n        self.view.action = self.action\n\n\nclass WrappedAttributeError(Exception):\n    pass\n\n\n@contextmanager\ndef wrap_attributeerrors():\n    \"\"\"\n    Used to re-raise AttributeErrors caught during authentication, preventing\n    these errors from otherwise being handled by the attribute access protocol.\n    \"\"\"\n    try:\n        yield\n    except AttributeError:\n        info = sys.exc_info()\n        exc = WrappedAttributeError(str(info[1]))\n        raise exc.with_traceback(info[2])\n\n\nclass Empty:\n    \"\"\"\n    Placeholder for unset attributes.\n    Cannot use `None`, as that may be a valid value.\n    \"\"\"\n    pass\n\n\ndef _hasattr(obj, name):\n    return not getattr(obj, name) is Empty\n\n\ndef clone_request(request, method):\n    \"\"\"\n    Internal helper method to clone a request, replacing with a different\n    HTTP method.  Used for checking permissions against other methods.\n    \"\"\"\n    ret = Request(request=request._request,\n                  parsers=request.parsers,\n                  authenticators=request.authenticators,\n                  negotiator=request.negotiator,\n                  parser_context=request.parser_context)\n    ret._data = request._data\n    ret._files = request._files\n    ret._full_data = request._full_data\n    ret._content_type = request._content_type\n    ret._stream = request._stream\n    ret.method = method\n    if hasattr(request, '_user'):\n        ret._user = request._user\n    if hasattr(request, '_auth'):\n        ret._auth = request._auth\n    if hasattr(request, '_authenticator'):\n        ret._authenticator = request._authenticator\n    if hasattr(request, 'accepted_renderer'):\n        ret.accepted_renderer = request.accepted_renderer\n    if hasattr(request, 'accepted_media_type'):\n        ret.accepted_media_type = request.accepted_media_type\n    if hasattr(request, 'version'):\n        ret.version = request.version\n    if hasattr(request, 'versioning_scheme'):\n        ret.versioning_scheme = request.versioning_scheme\n    return ret\n\n\nclass ForcedAuthentication:\n    \"\"\"\n    This authentication class is used if the test client or request factory\n    forcibly authenticated the request.\n    \"\"\"\n\n    def __init__(self, force_user, force_token):\n        self.force_user = force_user\n        self.force_token = force_token\n\n    def authenticate(self, request):\n        return (self.force_user, self.force_token)\n\n\nclass Request:\n    \"\"\"\n    Wrapper allowing to enhance a standard `HttpRequest` instance.\n\n    Kwargs:\n        - request(HttpRequest). The original request instance.\n        - parsers(list/tuple). The parsers to use for parsing the\n          request content.\n        - authenticators(list/tuple). The authenticators used to try\n          authenticating the request's user.\n    \"\"\"\n\n    def __init__(self, request, parsers=None, authenticators=None,\n                 negotiator=None, parser_context=None):\n        assert isinstance(request, HttpRequest), (\n            'The `request` argument must be an instance of '\n            '`django.http.HttpRequest`, not `{}.{}`.'\n            .format(request.__class__.__module__, request.__class__.__name__)\n        )\n\n        self._request = request\n        self.parsers = parsers or ()\n        self.authenticators = authenticators or ()\n        self.negotiator = negotiator or self._default_negotiator()\n        self.parser_context = parser_context\n        self._data = Empty\n        self._files = Empty\n        self._full_data = Empty\n        self._content_type = Empty\n        self._stream = Empty\n\n        if self.parser_context is None:\n            self.parser_context = {}\n        self.parser_context['request'] = self\n        self.parser_context['encoding'] = request.encoding or settings.DEFAULT_CHARSET\n\n        force_user = getattr(request, '_force_auth_user', None)\n        force_token = getattr(request, '_force_auth_token', None)\n        if force_user is not None or force_token is not None:\n            forced_auth = ForcedAuthentication(force_user, force_token)\n            self.authenticators = (forced_auth,)\n\n    def __repr__(self):\n        return '<%s.%s: %s %r>' % (\n            self.__class__.__module__,\n            self.__class__.__name__,\n            self.method,\n            self.get_full_path())\n\n    # Allow generic typing checking for requests.\n    def __class_getitem__(cls, *args, **kwargs):\n        return cls\n\n    def _default_negotiator(self):\n        return api_settings.DEFAULT_CONTENT_NEGOTIATION_CLASS()\n\n    @property\n    def content_type(self):\n        meta = self._request.META\n        return meta.get('CONTENT_TYPE', meta.get('HTTP_CONTENT_TYPE', ''))\n\n    @property\n    def stream(self):\n        \"\"\"\n        Returns an object that may be used to stream the request content.\n        \"\"\"\n        if not _hasattr(self, '_stream'):\n            self._load_stream()\n        return self._stream\n\n    @property\n    def query_params(self):\n        \"\"\"\n        More semantically correct name for request.GET.\n        \"\"\"\n        return self._request.GET\n\n    @property\n    def data(self):\n        if not _hasattr(self, '_full_data'):\n            with wrap_attributeerrors():\n                self._load_data_and_files()\n        return self._full_data\n\n    @property\n    def user(self):\n        \"\"\"\n        Returns the user associated with the current request, as authenticated\n        by the authentication classes provided to the request.\n        \"\"\"\n        if not hasattr(self, '_user'):\n            with wrap_attributeerrors():\n                self._authenticate()\n        return self._user\n\n    @user.setter\n    def user(self, value):\n        \"\"\"\n        Sets the user on the current request. This is necessary to maintain\n        compatibility with django.contrib.auth where the user property is\n        set in the login and logout functions.\n\n        Note that we also set the user on Django's underlying `HttpRequest`\n        instance, ensuring that it is available to any middleware in the stack.\n        \"\"\"\n        self._user = value\n        self._request.user = value\n\n    @property\n    def auth(self):\n        \"\"\"\n        Returns any non-user authentication information associated with the\n        request, such as an authentication token.\n        \"\"\"\n        if not hasattr(self, '_auth'):\n            with wrap_attributeerrors():\n                self._authenticate()\n        return self._auth\n\n    @auth.setter\n    def auth(self, value):\n        \"\"\"\n        Sets any non-user authentication information associated with the\n        request, such as an authentication token.\n        \"\"\"\n        self._auth = value\n        self._request.auth = value\n\n    @property\n    def successful_authenticator(self):\n        \"\"\"\n        Return the instance of the authentication instance class that was used\n        to authenticate the request, or `None`.\n        \"\"\"\n        if not hasattr(self, '_authenticator'):\n            with wrap_attributeerrors():\n                self._authenticate()\n        return self._authenticator\n\n    def _load_data_and_files(self):\n        \"\"\"\n        Parses the request content into `self.data`.\n        \"\"\"\n        if not _hasattr(self, '_data'):\n            self._data, self._files = self._parse()\n            if self._files:\n                self._full_data = self._data.copy()\n                self._full_data.update(self._files)\n            else:\n                self._full_data = self._data\n\n            # if a form media type, copy data & files refs to the underlying\n            # http request so that closable objects are handled appropriately.\n            if is_form_media_type(self.content_type):\n                self._request._post = self.POST\n                self._request._files = self.FILES\n\n    def _load_stream(self):\n        \"\"\"\n        Return the content body of the request, as a stream.\n        \"\"\"\n        meta = self._request.META\n        try:\n            content_length = int(\n                meta.get('CONTENT_LENGTH', meta.get('HTTP_CONTENT_LENGTH', 0))\n            )\n        except (ValueError, TypeError):\n            content_length = 0\n\n        if content_length == 0:\n            self._stream = None\n        elif not self._request._read_started:\n            self._stream = self._request\n        else:\n            self._stream = io.BytesIO(self.body)\n\n    def _supports_form_parsing(self):\n        \"\"\"\n        Return True if this requests supports parsing form data.\n        \"\"\"\n        form_media = (\n            'application/x-www-form-urlencoded',\n            'multipart/form-data'\n        )\n        return any(parser.media_type in form_media for parser in self.parsers)\n\n    def _parse(self):\n        \"\"\"\n        Parse the request content, returning a two-tuple of (data, files)\n\n        May raise an `UnsupportedMediaType`, or `ParseError` exception.\n        \"\"\"\n        media_type = self.content_type\n        try:\n            stream = self.stream\n        except RawPostDataException:\n            if not hasattr(self._request, '_post'):\n                raise\n            # If request.POST has been accessed in middleware, and a method='POST'\n            # request was made with 'multipart/form-data', then the request stream\n            # will already have been exhausted.\n            if self._supports_form_parsing():\n                return (self._request.POST, self._request.FILES)\n            stream = None\n\n        if stream is None or media_type is None:\n            if media_type and is_form_media_type(media_type):\n                empty_data = QueryDict('', encoding=self._request._encoding)\n            else:\n                empty_data = {}\n            empty_files = MultiValueDict()\n            return (empty_data, empty_files)\n\n        parser = self.negotiator.select_parser(self, self.parsers)\n\n        if not parser:\n            raise exceptions.UnsupportedMediaType(media_type)\n\n        try:\n            parsed = parser.parse(stream, media_type, self.parser_context)\n        except Exception:\n            # If we get an exception during parsing, fill in empty data and\n            # re-raise.  Ensures we don't simply repeat the error when\n            # attempting to render the browsable renderer response, or when\n            # logging the request or similar.\n            self._data = QueryDict('', encoding=self._request._encoding)\n            self._files = MultiValueDict()\n            self._full_data = self._data\n            raise\n\n        # Parser classes may return the raw data, or a\n        # DataAndFiles object.  Unpack the result as required.\n        try:\n            return (parsed.data, parsed.files)\n        except AttributeError:\n            empty_files = MultiValueDict()\n            return (parsed, empty_files)\n\n    def _authenticate(self):\n        \"\"\"\n        Attempt to authenticate the request using each authentication instance\n        in turn.\n        \"\"\"\n        for authenticator in self.authenticators:\n            try:\n                user_auth_tuple = authenticator.authenticate(self)\n            except exceptions.APIException:\n                self._not_authenticated()\n                raise\n\n            if user_auth_tuple is not None:\n                self._authenticator = authenticator\n                self.user, self.auth = user_auth_tuple\n                return\n\n        self._not_authenticated()\n\n    def _not_authenticated(self):\n        \"\"\"\n        Set authenticator, user & authtoken representing an unauthenticated request.\n\n        Defaults are None, AnonymousUser & None.\n        \"\"\"\n        self._authenticator = None\n\n        if api_settings.UNAUTHENTICATED_USER:\n            self.user = api_settings.UNAUTHENTICATED_USER()\n        else:\n            self.user = None\n\n        if api_settings.UNAUTHENTICATED_TOKEN:\n            self.auth = api_settings.UNAUTHENTICATED_TOKEN()\n        else:\n            self.auth = None\n\n    def __getattr__(self, attr):\n        \"\"\"\n        If an attribute does not exist on this instance, then we also attempt\n        to proxy it to the underlying HttpRequest object.\n        \"\"\"\n        try:\n            _request = self.__getattribute__(\"_request\")\n            return getattr(_request, attr)\n        except AttributeError:\n            raise AttributeError(f\"'{self.__class__.__name__}' object has no attribute '{attr}'\")\n\n    @property\n    def POST(self):\n        # Ensure that request.POST uses our request parsing.\n        if not _hasattr(self, '_data'):\n            with wrap_attributeerrors():\n                self._load_data_and_files()\n        if is_form_media_type(self.content_type):\n            return self._data\n        return QueryDict('', encoding=self._request._encoding)\n\n    @property\n    def FILES(self):\n        # Leave this one alone for backwards compat with Django's request.FILES\n        # Different from the other two cases, which are not valid property\n        # names on the WSGIRequest class.\n        if not _hasattr(self, '_files'):\n            with wrap_attributeerrors():\n                self._load_data_and_files()\n        return self._files\n\n    def force_plaintext_errors(self, value):\n        # Hack to allow our exception handler to force choice of\n        # plaintext or html error responses.\n        self._request.is_ajax = lambda: value\n"
  },
  {
    "path": "rest_framework/response.py",
    "content": "\"\"\"\nThe Response class in REST framework is similar to HTTPResponse, except that\nit is initialized with unrendered data, instead of a pre-rendered string.\n\nThe appropriate renderer is called during Django's template response rendering.\n\"\"\"\nfrom http.client import responses\n\nfrom django.template.response import SimpleTemplateResponse\n\nfrom rest_framework.serializers import Serializer\n\n\nclass Response(SimpleTemplateResponse):\n    \"\"\"\n    An HttpResponse that allows its data to be rendered into\n    arbitrary media types.\n    \"\"\"\n\n    def __init__(self, data=None, status=None,\n                 template_name=None, headers=None,\n                 exception=False, content_type=None):\n        \"\"\"\n        Alters the init arguments slightly.\n        For example, drop 'template_name', and instead use 'data'.\n\n        Setting 'renderer' and 'media_type' will typically be deferred,\n        For example being set automatically by the `APIView`.\n        \"\"\"\n        super().__init__(None, status=status)\n\n        if isinstance(data, Serializer):\n            msg = (\n                'You passed a Serializer instance as data, but '\n                'probably meant to pass serialized `.data` or '\n                '`.error`. representation.'\n            )\n            raise AssertionError(msg)\n\n        self.data = data\n        self.template_name = template_name\n        self.exception = exception\n        self.content_type = content_type\n\n        if headers:\n            for name, value in headers.items():\n                self[name] = value\n\n    # Allow generic typing checking for responses.\n    def __class_getitem__(cls, *args, **kwargs):\n        return cls\n\n    @property\n    def rendered_content(self):\n        renderer = getattr(self, 'accepted_renderer', None)\n        accepted_media_type = getattr(self, 'accepted_media_type', None)\n        context = getattr(self, 'renderer_context', None)\n\n        assert renderer, \".accepted_renderer not set on Response\"\n        assert accepted_media_type, \".accepted_media_type not set on Response\"\n        assert context is not None, \".renderer_context not set on Response\"\n        context['response'] = self\n\n        media_type = renderer.media_type\n        charset = renderer.charset\n        content_type = self.content_type\n\n        if content_type is None and charset is not None:\n            content_type = f\"{media_type}; charset={charset}\"\n        elif content_type is None:\n            content_type = media_type\n        self['Content-Type'] = content_type\n\n        ret = renderer.render(self.data, accepted_media_type, context)\n        if isinstance(ret, str):\n            assert charset, (\n                'renderer returned unicode, and did not specify '\n                'a charset value.'\n            )\n            return ret.encode(charset)\n\n        if not ret:\n            del self['Content-Type']\n\n        return ret\n\n    @property\n    def status_text(self):\n        \"\"\"\n        Returns reason text corresponding to our HTTP response status code.\n        Provided for convenience.\n        \"\"\"\n        return responses.get(self.status_code, '')\n\n    def __getstate__(self):\n        \"\"\"\n        Remove attributes from the response that shouldn't be cached.\n        \"\"\"\n        state = super().__getstate__()\n        for key in (\n            'accepted_renderer', 'renderer_context', 'resolver_match',\n            'client', 'request', 'json', 'wsgi_request'\n        ):\n            if key in state:\n                del state[key]\n        state['_closable_objects'] = []\n        return state\n"
  },
  {
    "path": "rest_framework/reverse.py",
    "content": "\"\"\"\nProvide urlresolver functions that return fully qualified URLs or view names\n\"\"\"\nfrom django.urls import NoReverseMatch\nfrom django.urls import reverse as django_reverse\nfrom django.utils.functional import lazy\n\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils.urls import replace_query_param\n\n\ndef preserve_builtin_query_params(url, request=None):\n    \"\"\"\n    Given an incoming request, and an outgoing URL representation,\n    append the value of any built-in query parameters.\n    \"\"\"\n    if request is None:\n        return url\n\n    overrides = [\n        api_settings.URL_FORMAT_OVERRIDE,\n    ]\n\n    for param in overrides:\n        if param and (param in request.GET):\n            value = request.GET[param]\n            url = replace_query_param(url, param, value)\n\n    return url\n\n\ndef reverse(viewname, args=None, kwargs=None, request=None, format=None, **extra):\n    \"\"\"\n    If versioning is being used then we pass any `reverse` calls through\n    to the versioning scheme instance, so that the resulting URL\n    can be modified if needed.\n    \"\"\"\n    scheme = getattr(request, 'versioning_scheme', None)\n    if scheme is not None:\n        try:\n            url = scheme.reverse(viewname, args, kwargs, request, format, **extra)\n        except NoReverseMatch:\n            # In case the versioning scheme reversal fails, fallback to the\n            # default implementation\n            url = _reverse(viewname, args, kwargs, request, format, **extra)\n    else:\n        url = _reverse(viewname, args, kwargs, request, format, **extra)\n\n    return preserve_builtin_query_params(url, request)\n\n\ndef _reverse(viewname, args=None, kwargs=None, request=None, format=None, **extra):\n    \"\"\"\n    Same as `django.urls.reverse`, but optionally takes a request\n    and returns a fully qualified URL, using the request to get the base URL.\n    \"\"\"\n    if format is not None:\n        kwargs = kwargs or {}\n        kwargs['format'] = format\n    url = django_reverse(viewname, args=args, kwargs=kwargs, **extra)\n    if request:\n        return request.build_absolute_uri(url)\n    return url\n\n\nreverse_lazy = lazy(reverse, str)\n"
  },
  {
    "path": "rest_framework/routers.py",
    "content": "\"\"\"\nRouters provide a convenient and consistent way of automatically\ndetermining the URL conf for your API.\n\nThey are used by simply instantiating a Router class, and then registering\nall the required ViewSets with that router.\n\nFor example, you might have a `urls.py` that looks something like this:\n\n    router = routers.DefaultRouter()\n    router.register('users', UserViewSet, 'user')\n    router.register('accounts', AccountViewSet, 'account')\n\n    urlpatterns = router.urls\n\"\"\"\nimport itertools\nfrom collections import namedtuple\n\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.urls import NoReverseMatch, path, re_path\n\nfrom rest_framework import views\nfrom rest_framework.response import Response\nfrom rest_framework.reverse import reverse\nfrom rest_framework.schemas import SchemaGenerator\nfrom rest_framework.schemas.views import SchemaView\nfrom rest_framework.settings import api_settings\nfrom rest_framework.urlpatterns import format_suffix_patterns\n\nRoute = namedtuple('Route', ['url', 'mapping', 'name', 'detail', 'initkwargs'])\nDynamicRoute = namedtuple('DynamicRoute', ['url', 'name', 'detail', 'initkwargs'])\n\n\ndef escape_curly_brackets(url_path):\n    \"\"\"\n    Double brackets in regex of url_path for escape string formatting\n    \"\"\"\n    return url_path.replace('{', '{{').replace('}', '}}')\n\n\ndef flatten(list_of_lists):\n    \"\"\"\n    Takes an iterable of iterables, returns a single iterable containing all items\n    \"\"\"\n    return itertools.chain(*list_of_lists)\n\n\nclass BaseRouter:\n    def __init__(self):\n        self.registry = []\n\n    def register(self, prefix, viewset, basename=None):\n        if basename is None:\n            basename = self.get_default_basename(viewset)\n\n        if self.is_already_registered(basename):\n            msg = (f'Router with basename \"{basename}\" is already registered. '\n                   f'Please provide a unique basename for viewset \"{viewset}\"')\n            raise ImproperlyConfigured(msg)\n\n        self.registry.append((prefix, viewset, basename))\n\n        # invalidate the urls cache\n        if hasattr(self, '_urls'):\n            del self._urls\n\n    def is_already_registered(self, new_basename):\n        \"\"\"\n        Check if `basename` is already registered\n        \"\"\"\n        return any(basename == new_basename for _prefix, _viewset, basename in self.registry)\n\n    def get_default_basename(self, viewset):\n        \"\"\"\n        If `basename` is not specified, attempt to automatically determine\n        it from the viewset.\n        \"\"\"\n        raise NotImplementedError('get_default_basename must be overridden')\n\n    def get_urls(self):\n        \"\"\"\n        Return a list of URL patterns, given the registered viewsets.\n        \"\"\"\n        raise NotImplementedError('get_urls must be overridden')\n\n    @property\n    def urls(self):\n        if not hasattr(self, '_urls'):\n            self._urls = self.get_urls()\n        return self._urls\n\n\nclass SimpleRouter(BaseRouter):\n\n    routes = [\n        # List route.\n        Route(\n            url=r'^{prefix}{trailing_slash}$',\n            mapping={\n                'get': 'list',\n                'post': 'create'\n            },\n            name='{basename}-list',\n            detail=False,\n            initkwargs={'suffix': 'List'}\n        ),\n        # Dynamically generated list routes. Generated using\n        # @action(detail=False) decorator on methods of the viewset.\n        DynamicRoute(\n            url=r'^{prefix}/{url_path}{trailing_slash}$',\n            name='{basename}-{url_name}',\n            detail=False,\n            initkwargs={}\n        ),\n        # Detail route.\n        Route(\n            url=r'^{prefix}/{lookup}{trailing_slash}$',\n            mapping={\n                'get': 'retrieve',\n                'put': 'update',\n                'patch': 'partial_update',\n                'delete': 'destroy'\n            },\n            name='{basename}-detail',\n            detail=True,\n            initkwargs={'suffix': 'Instance'}\n        ),\n        # Dynamically generated detail routes. Generated using\n        # @action(detail=True) decorator on methods of the viewset.\n        DynamicRoute(\n            url=r'^{prefix}/{lookup}/{url_path}{trailing_slash}$',\n            name='{basename}-{url_name}',\n            detail=True,\n            initkwargs={}\n        ),\n    ]\n\n    def __init__(self, trailing_slash=True, use_regex_path=True):\n        self.trailing_slash = '/' if trailing_slash else ''\n        self._use_regex = use_regex_path\n        if use_regex_path:\n            self._base_pattern = '(?P<{lookup_prefix}{lookup_url_kwarg}>{lookup_value})'\n            self._default_value_pattern = '[^/.]+'\n            self._url_conf = re_path\n        else:\n            self._base_pattern = '<{lookup_value}:{lookup_prefix}{lookup_url_kwarg}>'\n            self._default_value_pattern = 'str'\n            self._url_conf = path\n            # remove regex characters from routes\n            _routes = []\n            for route in self.routes:\n                url_param = route.url\n                if url_param[0] == '^':\n                    url_param = url_param[1:]\n                if url_param[-1] == '$':\n                    url_param = url_param[:-1]\n\n                _routes.append(route._replace(url=url_param))\n            self.routes = _routes\n\n        super().__init__()\n\n    def get_default_basename(self, viewset):\n        \"\"\"\n        If `basename` is not specified, attempt to automatically determine\n        it from the viewset.\n        \"\"\"\n        queryset = getattr(viewset, 'queryset', None)\n\n        assert queryset is not None, '`basename` argument not specified, and could ' \\\n            'not automatically determine the name from the viewset, as ' \\\n            'it does not have a `.queryset` attribute.'\n\n        return queryset.model._meta.object_name.lower()\n\n    def get_routes(self, viewset):\n        \"\"\"\n        Augment `self.routes` with any dynamically generated routes.\n\n        Returns a list of the Route namedtuple.\n        \"\"\"\n        # converting to list as iterables are good for one pass, known host needs to be checked again and again for\n        # different functions.\n        known_actions = list(flatten([route.mapping.values() for route in self.routes if isinstance(route, Route)]))\n        extra_actions = viewset.get_extra_actions()\n\n        # checking action names against the known actions list\n        not_allowed = [\n            action.__name__ for action in extra_actions\n            if action.__name__ in known_actions\n        ]\n        if not_allowed:\n            msg = ('Cannot use the @action decorator on the following '\n                   'methods, as they are existing routes: %s')\n            raise ImproperlyConfigured(msg % ', '.join(not_allowed))\n\n        # partition detail and list actions\n        detail_actions = [action for action in extra_actions if action.detail]\n        list_actions = [action for action in extra_actions if not action.detail]\n\n        routes = []\n        for route in self.routes:\n            if isinstance(route, DynamicRoute) and route.detail:\n                routes += [self._get_dynamic_route(route, action) for action in detail_actions]\n            elif isinstance(route, DynamicRoute) and not route.detail:\n                routes += [self._get_dynamic_route(route, action) for action in list_actions]\n            else:\n                routes.append(route)\n\n        return routes\n\n    def _get_dynamic_route(self, route, action):\n        initkwargs = route.initkwargs.copy()\n        initkwargs.update(action.kwargs)\n\n        url_path = escape_curly_brackets(action.url_path)\n\n        return Route(\n            url=route.url.replace('{url_path}', url_path),\n            mapping=action.mapping,\n            name=route.name.replace('{url_name}', action.url_name),\n            detail=route.detail,\n            initkwargs=initkwargs,\n        )\n\n    def get_method_map(self, viewset, method_map):\n        \"\"\"\n        Given a viewset, and a mapping of http methods to actions,\n        return a new mapping which only includes any mappings that\n        are actually implemented by the viewset.\n        \"\"\"\n        bound_methods = {}\n        for method, action in method_map.items():\n            if hasattr(viewset, action):\n                bound_methods[method] = action\n        return bound_methods\n\n    def get_lookup_regex(self, viewset, lookup_prefix=''):\n        \"\"\"\n        Given a viewset, return the portion of URL regex that is used\n        to match against a single instance.\n\n        Note that lookup_prefix is not used directly inside REST rest_framework\n        itself, but is required in order to nicely support nested router\n        implementations, such as drf-nested-routers.\n\n        https://github.com/alanjds/drf-nested-routers\n        \"\"\"\n        # Use `pk` as default field, unset set.  Default regex should not\n        # consume `.json` style suffixes and should break at '/' boundaries.\n        lookup_field = getattr(viewset, 'lookup_field', 'pk')\n        lookup_url_kwarg = getattr(viewset, 'lookup_url_kwarg', None) or lookup_field\n        lookup_value = None\n        if not self._use_regex:\n            # try to get a more appropriate attribute when not using regex\n            lookup_value = getattr(viewset, 'lookup_value_converter', None)\n        if lookup_value is None:\n            # fallback to legacy\n            lookup_value = getattr(viewset, 'lookup_value_regex', self._default_value_pattern)\n        return self._base_pattern.format(\n            lookup_prefix=lookup_prefix,\n            lookup_url_kwarg=lookup_url_kwarg,\n            lookup_value=lookup_value\n        )\n\n    def get_urls(self):\n        \"\"\"\n        Use the registered viewsets to generate a list of URL patterns.\n        \"\"\"\n        ret = []\n\n        for prefix, viewset, basename in self.registry:\n            lookup = self.get_lookup_regex(viewset)\n            routes = self.get_routes(viewset)\n\n            for route in routes:\n\n                # Only actions which actually exist on the viewset will be bound\n                mapping = self.get_method_map(viewset, route.mapping)\n                if not mapping:\n                    continue\n\n                # Build the url pattern\n                regex = route.url.format(\n                    prefix=prefix,\n                    lookup=lookup,\n                    trailing_slash=self.trailing_slash\n                )\n\n                # If there is no prefix, the first part of the url is probably\n                #   controlled by project's urls.py and the router is in an app,\n                #   so a slash in the beginning will (A) cause Django to give\n                #   warnings and (B) generate URLS that will require using '//'.\n                if not prefix:\n                    if self._url_conf is path:\n                        if regex[0] == '/':\n                            regex = regex[1:]\n                    elif regex[:2] == '^/':\n                        regex = '^' + regex[2:]\n\n                initkwargs = route.initkwargs.copy()\n                initkwargs.update({\n                    'basename': basename,\n                    'detail': route.detail,\n                })\n\n                view = viewset.as_view(mapping, **initkwargs)\n                name = route.name.format(basename=basename)\n                ret.append(self._url_conf(regex, view, name=name))\n\n        return ret\n\n\nclass APIRootView(views.APIView):\n    \"\"\"\n    The default basic root view for DefaultRouter\n    \"\"\"\n    _ignore_model_permissions = True\n    schema = None  # exclude from schema\n    api_root_dict = None\n\n    def get(self, request, *args, **kwargs):\n        # Return a plain {\"name\": \"hyperlink\"} response.\n        ret = {}\n        namespace = request.resolver_match.namespace\n        for key, url_name in self.api_root_dict.items():\n            if namespace:\n                url_name = namespace + ':' + url_name\n            try:\n                ret[key] = reverse(\n                    url_name,\n                    args=args,\n                    kwargs=kwargs,\n                    request=request,\n                    format=kwargs.get('format')\n                )\n            except NoReverseMatch:\n                # Don't bail out if eg. no list routes exist, only detail routes.\n                continue\n\n        return Response(ret)\n\n\nclass DefaultRouter(SimpleRouter):\n    \"\"\"\n    The default router extends the SimpleRouter, but also adds in a default\n    API root view, and adds format suffix patterns to the URLs.\n    \"\"\"\n    include_root_view = True\n    include_format_suffixes = True\n    root_view_name = 'api-root'\n    default_schema_renderers = None\n    APIRootView = APIRootView\n    APISchemaView = SchemaView\n    SchemaGenerator = SchemaGenerator\n\n    def __init__(self, *args, **kwargs):\n        if 'root_renderers' in kwargs:\n            self.root_renderers = kwargs.pop('root_renderers')\n        else:\n            self.root_renderers = list(api_settings.DEFAULT_RENDERER_CLASSES)\n        super().__init__(*args, **kwargs)\n\n    def get_api_root_view(self, api_urls=None):\n        \"\"\"\n        Return a basic root view.\n        \"\"\"\n        api_root_dict = {}\n        list_name = self.routes[0].name\n        for prefix, viewset, basename in self.registry:\n            api_root_dict[prefix] = list_name.format(basename=basename)\n\n        return self.APIRootView.as_view(api_root_dict=api_root_dict)\n\n    def get_urls(self):\n        \"\"\"\n        Generate the list of URL patterns, including a default root view\n        for the API, and appending `.json` style format suffixes.\n        \"\"\"\n        urls = super().get_urls()\n\n        if self.include_root_view:\n            view = self.get_api_root_view(api_urls=urls)\n            root_url = path('', view, name=self.root_view_name)\n            urls.append(root_url)\n\n        if self.include_format_suffixes:\n            urls = format_suffix_patterns(urls)\n\n        return urls\n"
  },
  {
    "path": "rest_framework/schemas/__init__.py",
    "content": "\"\"\"\nrest_framework.schemas\n\nschemas:\n    __init__.py\n    generators.py   # Top-down schema generation\n    inspectors.py   # Per-endpoint view introspection\n    utils.py        # Shared helper functions\n    views.py        # Houses `SchemaView`, `APIView` subclass.\n\nWe expose a minimal \"public\" API directly from `schemas`. This covers the\nbasic use-cases:\n\n    from rest_framework.schemas import (\n        AutoSchema,\n        get_schema_view,\n        SchemaGenerator,\n    )\n\nOther access should target the submodules directly\n\"\"\"\nfrom rest_framework.settings import api_settings\n\nfrom . import openapi\nfrom .inspectors import DefaultSchema  # noqa\nfrom .openapi import AutoSchema, SchemaGenerator  # noqa\n\n\ndef get_schema_view(\n        title=None, url=None, description=None, urlconf=None, renderer_classes=None,\n        public=False, patterns=None, generator_class=None,\n        authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,\n        permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES,\n        version=None):\n    \"\"\"\n    Return a schema view.\n    \"\"\"\n    if generator_class is None:\n        generator_class = openapi.SchemaGenerator\n\n    generator = generator_class(\n        title=title, url=url, description=description,\n        urlconf=urlconf, patterns=patterns, version=version\n    )\n\n    # Avoid import cycle on APIView\n    from .views import SchemaView\n    return SchemaView.as_view(\n        renderer_classes=renderer_classes,\n        schema_generator=generator,\n        public=public,\n        authentication_classes=authentication_classes,\n        permission_classes=permission_classes,\n    )\n"
  },
  {
    "path": "rest_framework/schemas/generators.py",
    "content": "\"\"\"\ngenerators.py   # Top-down schema generation\n\nSee schemas.__init__.py for package overview.\n\"\"\"\nimport re\nfrom importlib import import_module\n\nfrom django.conf import settings\nfrom django.contrib.admindocs.views import simplify_regex\nfrom django.core.exceptions import PermissionDenied\nfrom django.http import Http404\nfrom django.urls import URLPattern, URLResolver\n\nfrom rest_framework import exceptions\nfrom rest_framework.request import clone_request\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils.model_meta import _get_pk\n\n\ndef get_pk_name(model):\n    meta = model._meta.concrete_model._meta\n    return _get_pk(meta).name\n\n\ndef is_api_view(callback):\n    \"\"\"\n    Return `True` if the given view callback is a REST framework view/viewset.\n    \"\"\"\n    # Avoid import cycle on APIView\n    from rest_framework.views import APIView\n    cls = getattr(callback, 'cls', None)\n    return (cls is not None) and issubclass(cls, APIView)\n\n\ndef endpoint_ordering(endpoint):\n    path, method, callback = endpoint\n    method_priority = {\n        'GET': 0,\n        'POST': 1,\n        'PUT': 2,\n        'PATCH': 3,\n        'DELETE': 4\n    }.get(method, 5)\n    return (method_priority,)\n\n\n_PATH_PARAMETER_COMPONENT_RE = re.compile(\n    r'<(?:(?P<converter>[^>:]+):)?(?P<parameter>\\w+)>'\n)\n\n\nclass EndpointEnumerator:\n    \"\"\"\n    A class to determine the available API endpoints that a project exposes.\n    \"\"\"\n    def __init__(self, patterns=None, urlconf=None):\n        if patterns is None:\n            if urlconf is None:\n                # Use the default Django URL conf\n                urlconf = settings.ROOT_URLCONF\n\n            # Load the given URLconf module\n            if isinstance(urlconf, str):\n                urls = import_module(urlconf)\n            else:\n                urls = urlconf\n            patterns = urls.urlpatterns\n\n        self.patterns = patterns\n\n    def get_api_endpoints(self, patterns=None, prefix=''):\n        \"\"\"\n        Return a list of all available API endpoints by inspecting the URL conf.\n        \"\"\"\n        if patterns is None:\n            patterns = self.patterns\n\n        api_endpoints = []\n\n        for pattern in patterns:\n            path_regex = prefix + str(pattern.pattern)\n            if isinstance(pattern, URLPattern):\n                path = self.get_path_from_regex(path_regex)\n                callback = pattern.callback\n                if self.should_include_endpoint(path, callback):\n                    for method in self.get_allowed_methods(callback):\n                        endpoint = (path, method, callback)\n                        api_endpoints.append(endpoint)\n\n            elif isinstance(pattern, URLResolver):\n                nested_endpoints = self.get_api_endpoints(\n                    patterns=pattern.url_patterns,\n                    prefix=path_regex\n                )\n                api_endpoints.extend(nested_endpoints)\n\n        return sorted(api_endpoints, key=endpoint_ordering)\n\n    def get_path_from_regex(self, path_regex):\n        \"\"\"\n        Given a URL conf regex, return a URI template string.\n        \"\"\"\n        # ???: Would it be feasible to adjust this such that we generate the\n        # path, plus the kwargs, plus the type from the converter, such that we\n        # could feed that straight into the parameter schema object?\n\n        path = simplify_regex(path_regex)\n\n        # Strip Django 2.0 converters as they are incompatible with uritemplate format\n        return re.sub(_PATH_PARAMETER_COMPONENT_RE, r'{\\g<parameter>}', path)\n\n    def should_include_endpoint(self, path, callback):\n        \"\"\"\n        Return `True` if the given endpoint should be included.\n        \"\"\"\n        if not is_api_view(callback):\n            return False  # Ignore anything except REST framework views.\n\n        if callback.cls.schema is None:\n            return False\n\n        if 'schema' in callback.initkwargs:\n            if callback.initkwargs['schema'] is None:\n                return False\n\n        if path.endswith('.{format}') or path.endswith('.{format}/'):\n            return False  # Ignore .json style URLs.\n\n        return True\n\n    def get_allowed_methods(self, callback):\n        \"\"\"\n        Return a list of the valid HTTP methods for this endpoint.\n        \"\"\"\n        if hasattr(callback, 'actions'):\n            actions = set(callback.actions)\n            http_method_names = set(callback.cls.http_method_names)\n            methods = [method.upper() for method in actions & http_method_names]\n        else:\n            methods = callback.cls().allowed_methods\n\n        return [method for method in methods if method not in ('OPTIONS', 'HEAD')]\n\n\nclass BaseSchemaGenerator:\n    endpoint_inspector_cls = EndpointEnumerator\n\n    # 'pk' isn't great as an externally exposed name for an identifier,\n    # so by default we prefer to use the actual model field name for schemas.\n    # Set by 'SCHEMA_COERCE_PATH_PK'.\n    coerce_path_pk = None\n\n    def __init__(self, title=None, url=None, description=None, patterns=None, urlconf=None, version=None):\n        if url and not url.endswith('/'):\n            url += '/'\n\n        self.coerce_path_pk = api_settings.SCHEMA_COERCE_PATH_PK\n\n        self.patterns = patterns\n        self.urlconf = urlconf\n        self.title = title\n        self.description = description\n        self.version = version\n        self.url = url\n        self.endpoints = None\n\n    def _initialise_endpoints(self):\n        if self.endpoints is None:\n            inspector = self.endpoint_inspector_cls(self.patterns, self.urlconf)\n            self.endpoints = inspector.get_api_endpoints()\n\n    def _get_paths_and_endpoints(self, request):\n        \"\"\"\n        Generate (path, method, view) given (path, method, callback) for paths.\n        \"\"\"\n        paths = []\n        view_endpoints = []\n        for path, method, callback in self.endpoints:\n            view = self.create_view(callback, method, request)\n            path = self.coerce_path(path, method, view)\n            paths.append(path)\n            view_endpoints.append((path, method, view))\n\n        return paths, view_endpoints\n\n    def create_view(self, callback, method, request=None):\n        \"\"\"\n        Given a callback, return an actual view instance.\n        \"\"\"\n        view = callback.cls(**getattr(callback, 'initkwargs', {}))\n        view.args = ()\n        view.kwargs = {}\n        view.format_kwarg = None\n        view.request = None\n        view.action_map = getattr(callback, 'actions', None)\n\n        actions = getattr(callback, 'actions', None)\n        if actions is not None:\n            if method == 'OPTIONS':\n                view.action = 'metadata'\n            else:\n                view.action = actions.get(method.lower())\n\n        if request is not None:\n            view.request = clone_request(request, method)\n\n        return view\n\n    def coerce_path(self, path, method, view):\n        \"\"\"\n        Coerce {pk} path arguments into the name of the model field,\n        where possible. This is cleaner for an external representation.\n        (Ie. \"this is an identifier\", not \"this is a database primary key\")\n        \"\"\"\n        if not self.coerce_path_pk or '{pk}' not in path:\n            return path\n        model = getattr(getattr(view, 'queryset', None), 'model', None)\n        if model:\n            field_name = get_pk_name(model)\n        else:\n            field_name = 'id'\n        return path.replace('{pk}', '{%s}' % field_name)\n\n    def get_schema(self, request=None, public=False):\n        raise NotImplementedError(\".get_schema() must be implemented in subclasses.\")\n\n    def has_view_permissions(self, path, method, view):\n        \"\"\"\n        Return `True` if the incoming request has the correct view permissions.\n        \"\"\"\n        if view.request is None:\n            return True\n\n        try:\n            view.check_permissions(view.request)\n        except (exceptions.APIException, Http404, PermissionDenied):\n            return False\n        return True\n"
  },
  {
    "path": "rest_framework/schemas/inspectors.py",
    "content": "\"\"\"\ninspectors.py   # Per-endpoint view introspection\n\nSee schemas.__init__.py for package overview.\n\"\"\"\nimport re\nfrom weakref import WeakKeyDictionary\n\nfrom django.utils.encoding import smart_str\n\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils import formatting\n\n\nclass ViewInspector:\n    \"\"\"\n    Descriptor class on APIView.\n\n    Provide subclass for per-view schema generation\n    \"\"\"\n\n    # Used in _get_description_section()\n    header_regex = re.compile('^[a-zA-Z][0-9A-Za-z_]*:')\n\n    def __init__(self):\n        self.instance_schemas = WeakKeyDictionary()\n\n    def __get__(self, instance, owner):\n        \"\"\"\n        Enables `ViewInspector` as a Python _Descriptor_.\n\n        This is how `view.schema` knows about `view`.\n\n        `__get__` is called when the descriptor is accessed on the owner.\n        (That will be when view.schema is called in our case.)\n\n        `owner` is always the owner class. (An APIView, or subclass for us.)\n        `instance` is the view instance or `None` if accessed from the class,\n        rather than an instance.\n\n        See: https://docs.python.org/3/howto/descriptor.html for info on\n        descriptor usage.\n        \"\"\"\n        if instance in self.instance_schemas:\n            return self.instance_schemas[instance]\n\n        self.view = instance\n        return self\n\n    def __set__(self, instance, other):\n        self.instance_schemas[instance] = other\n        if other is not None:\n            other.view = instance\n\n    @property\n    def view(self):\n        \"\"\"View property.\"\"\"\n        assert self._view is not None, (\n            \"Schema generation REQUIRES a view instance. (Hint: you accessed \"\n            \"`schema` from the view class rather than an instance.)\"\n        )\n        return self._view\n\n    @view.setter\n    def view(self, value):\n        self._view = value\n\n    @view.deleter\n    def view(self):\n        self._view = None\n\n    def get_description(self, path, method):\n        \"\"\"\n        Determine a path description.\n\n        This will be based on the method docstring if one exists,\n        or else the class docstring.\n        \"\"\"\n        view = self.view\n\n        method_name = getattr(view, 'action', method.lower())\n        method_func = getattr(view, method_name, None)\n        method_docstring = method_func.__doc__\n        if method_func and method_docstring:\n            # An explicit docstring on the method or action.\n            return self._get_description_section(view, method.lower(), formatting.dedent(smart_str(method_docstring)))\n        else:\n            return self._get_description_section(view, getattr(view, 'action', method.lower()),\n                                                 view.get_view_description())\n\n    def _get_description_section(self, view, header, description):\n        lines = description.splitlines()\n        current_section = ''\n        sections = {'': ''}\n\n        for line in lines:\n            if self.header_regex.match(line):\n                current_section, separator, lead = line.partition(':')\n                sections[current_section] = lead.strip()\n            else:\n                sections[current_section] += '\\n' + line\n\n        # TODO: SCHEMA_COERCE_METHOD_NAMES appears here and in `SchemaGenerator.get_keys`\n        coerce_method_names = api_settings.SCHEMA_COERCE_METHOD_NAMES\n        if header in sections:\n            return sections[header].strip()\n        if header in coerce_method_names:\n            if coerce_method_names[header] in sections:\n                return sections[coerce_method_names[header]].strip()\n        return sections[''].strip()\n\n\nclass DefaultSchema(ViewInspector):\n    \"\"\"Allows overriding AutoSchema using DEFAULT_SCHEMA_CLASS setting\"\"\"\n    def __get__(self, instance, owner):\n        result = super().__get__(instance, owner)\n        if not isinstance(result, DefaultSchema):\n            return result\n\n        inspector_class = api_settings.DEFAULT_SCHEMA_CLASS\n        assert issubclass(inspector_class, ViewInspector), (\n            \"DEFAULT_SCHEMA_CLASS must be set to a ViewInspector (usually an AutoSchema) subclass\"\n        )\n        inspector = inspector_class()\n        inspector.view = instance\n        return inspector\n"
  },
  {
    "path": "rest_framework/schemas/openapi.py",
    "content": "import re\nimport warnings\nfrom decimal import Decimal\nfrom operator import attrgetter\nfrom urllib.parse import urljoin\n\nfrom django.core.validators import (\n    DecimalValidator, EmailValidator, MaxLengthValidator, MaxValueValidator,\n    MinLengthValidator, MinValueValidator, RegexValidator, URLValidator\n)\nfrom django.db import models\nfrom django.utils.encoding import force_str\n\nfrom rest_framework import exceptions, renderers, serializers\nfrom rest_framework.compat import inflection, uritemplate\nfrom rest_framework.fields import _UnvalidatedField, empty\nfrom rest_framework.settings import api_settings\n\nfrom .generators import BaseSchemaGenerator\nfrom .inspectors import ViewInspector\nfrom .utils import get_pk_description, is_list_view\n\n\nclass SchemaGenerator(BaseSchemaGenerator):\n\n    def get_info(self):\n        # Title and version are required by openapi specification 3.x\n        info = {\n            'title': self.title or '',\n            'version': self.version or ''\n        }\n\n        if self.description is not None:\n            info['description'] = self.description\n\n        return info\n\n    def check_duplicate_operation_id(self, paths):\n        ids = {}\n        for route in paths:\n            for method in paths[route]:\n                if 'operationId' not in paths[route][method]:\n                    continue\n                operation_id = paths[route][method]['operationId']\n                if operation_id in ids:\n                    warnings.warn(\n                        'You have a duplicated operationId in your OpenAPI schema: {operation_id}\\n'\n                        '\\tRoute: {route1}, Method: {method1}\\n'\n                        '\\tRoute: {route2}, Method: {method2}\\n'\n                        '\\tAn operationId has to be unique across your schema. Your schema may not work in other tools.'\n                        .format(\n                            route1=ids[operation_id]['route'],\n                            method1=ids[operation_id]['method'],\n                            route2=route,\n                            method2=method,\n                            operation_id=operation_id\n                        )\n                    )\n                ids[operation_id] = {\n                    'route': route,\n                    'method': method\n                }\n\n    def get_schema(self, request=None, public=False):\n        \"\"\"\n        Generate a OpenAPI schema.\n        \"\"\"\n        self._initialise_endpoints()\n        components_schemas = {}\n\n        # Iterate endpoints generating per method path operations.\n        paths = {}\n        _, view_endpoints = self._get_paths_and_endpoints(None if public else request)\n        for path, method, view in view_endpoints:\n            if not self.has_view_permissions(path, method, view):\n                continue\n\n            operation = view.schema.get_operation(path, method)\n            components = view.schema.get_components(path, method)\n            for k in components.keys():\n                if k not in components_schemas:\n                    continue\n                if components_schemas[k] == components[k]:\n                    continue\n                warnings.warn(f'Schema component \"{k}\" has been overridden with a different value.')\n\n            components_schemas.update(components)\n\n            # Normalize path for any provided mount url.\n            if path.startswith('/'):\n                path = path[1:]\n            path = urljoin(self.url or '/', path)\n\n            paths.setdefault(path, {})\n            paths[path][method.lower()] = operation\n\n        self.check_duplicate_operation_id(paths)\n\n        # Compile final schema.\n        schema = {\n            'openapi': '3.0.2',\n            'info': self.get_info(),\n            'paths': paths,\n        }\n\n        if len(components_schemas) > 0:\n            schema['components'] = {\n                'schemas': components_schemas\n            }\n\n        return schema\n\n# View Inspectors\n\n\nclass AutoSchema(ViewInspector):\n\n    def __init__(self, tags=None, operation_id_base=None, component_name=None):\n        \"\"\"\n        :param operation_id_base: user-defined name in operationId. If empty, it will be deducted from the Model/Serializer/View name.\n        :param component_name: user-defined component's name. If empty, it will be deducted from the Serializer's class name.\n        \"\"\"\n        if tags and not all(isinstance(tag, str) for tag in tags):\n            raise ValueError('tags must be a list or tuple of string.')\n        self._tags = tags\n        self.operation_id_base = operation_id_base\n        self.component_name = component_name\n        super().__init__()\n\n    request_media_types = []\n    response_media_types = []\n\n    method_mapping = {\n        'get': 'retrieve',\n        'post': 'create',\n        'put': 'update',\n        'patch': 'partialUpdate',\n        'delete': 'destroy',\n    }\n\n    def get_operation(self, path, method):\n        operation = {}\n\n        operation['operationId'] = self.get_operation_id(path, method)\n        operation['description'] = self.get_description(path, method)\n\n        parameters = []\n        parameters += self.get_path_parameters(path, method)\n        parameters += self.get_pagination_parameters(path, method)\n        parameters += self.get_filter_parameters(path, method)\n        operation['parameters'] = parameters\n\n        request_body = self.get_request_body(path, method)\n        if request_body:\n            operation['requestBody'] = request_body\n        operation['responses'] = self.get_responses(path, method)\n        operation['tags'] = self.get_tags(path, method)\n\n        return operation\n\n    def get_component_name(self, serializer):\n        \"\"\"\n        Compute the component's name from the serializer.\n        Raise an exception if the serializer's class name is \"Serializer\" (case-insensitive).\n        \"\"\"\n        if self.component_name is not None:\n            return self.component_name\n\n        # use the serializer's class name as the component name.\n        component_name = serializer.__class__.__name__\n        # We remove the \"serializer\" string from the class name.\n        pattern = re.compile(\"serializer\", re.IGNORECASE)\n        component_name = pattern.sub(\"\", component_name)\n\n        if component_name == \"\":\n            raise Exception(\n                '\"{}\" is an invalid class name for schema generation. '\n                'Serializer\\'s class name should be unique and explicit. e.g. \"ItemSerializer\"'\n                .format(serializer.__class__.__name__)\n            )\n\n        return component_name\n\n    def get_components(self, path, method):\n        \"\"\"\n        Return components with their properties from the serializer.\n        \"\"\"\n\n        if method.lower() == 'delete':\n            return {}\n\n        request_serializer = self.get_request_serializer(path, method)\n        response_serializer = self.get_response_serializer(path, method)\n\n        components = {}\n\n        if isinstance(request_serializer, serializers.Serializer):\n            component_name = self.get_component_name(request_serializer)\n            content = self.map_serializer(request_serializer)\n            components.setdefault(component_name, content)\n\n        if isinstance(response_serializer, serializers.Serializer):\n            component_name = self.get_component_name(response_serializer)\n            content = self.map_serializer(response_serializer)\n            components.setdefault(component_name, content)\n\n        return components\n\n    def _to_camel_case(self, snake_str):\n        components = snake_str.split('_')\n        # We capitalize the first letter of each component except the first one\n        # with the 'title' method and join them together.\n        return components[0] + ''.join(x.title() for x in components[1:])\n\n    def get_operation_id_base(self, path, method, action):\n        \"\"\"\n        Compute the base part for operation ID from the model, serializer or view name.\n        \"\"\"\n        model = getattr(getattr(self.view, 'queryset', None), 'model', None)\n\n        if self.operation_id_base is not None:\n            name = self.operation_id_base\n\n        # Try to deduce the ID from the view's model\n        elif model is not None:\n            name = model.__name__\n\n        # Try with the serializer class name\n        elif self.get_serializer(path, method) is not None:\n            name = self.get_serializer(path, method).__class__.__name__\n            if name.endswith('Serializer'):\n                name = name[:-10]\n\n        # Fallback to the view name\n        else:\n            name = self.view.__class__.__name__\n            if name.endswith('APIView'):\n                name = name[:-7]\n            elif name.endswith('View'):\n                name = name[:-4]\n\n            # Due to camel-casing of classes and `action` being lowercase, apply title in order to find if action truly\n            # comes at the end of the name\n            if name.endswith(action.title()):  # ListView, UpdateAPIView, ThingDelete ...\n                name = name[:-len(action)]\n\n        if action == 'list':\n            assert inflection, '`inflection` must be installed for OpenAPI schema support.'\n            name = inflection.pluralize(name)\n\n        return name\n\n    def get_operation_id(self, path, method):\n        \"\"\"\n        Compute an operation ID from the view type and get_operation_id_base method.\n        \"\"\"\n        method_name = getattr(self.view, 'action', method.lower())\n        if is_list_view(path, method, self.view):\n            action = 'list'\n        elif method_name not in self.method_mapping:\n            action = self._to_camel_case(method_name)\n        else:\n            action = self.method_mapping[method.lower()]\n\n        name = self.get_operation_id_base(path, method, action)\n\n        return action + name\n\n    def get_path_parameters(self, path, method):\n        \"\"\"\n        Return a list of parameters from templated path variables.\n        \"\"\"\n        assert uritemplate, '`uritemplate` must be installed for OpenAPI schema support.'\n\n        model = getattr(getattr(self.view, 'queryset', None), 'model', None)\n        parameters = []\n\n        for variable in uritemplate.variables(path):\n            description = ''\n            if model is not None:  # TODO: test this.\n                # Attempt to infer a field description if possible.\n                try:\n                    model_field = model._meta.get_field(variable)\n                except Exception:\n                    model_field = None\n\n                if model_field is not None and model_field.help_text:\n                    description = force_str(model_field.help_text)\n                elif model_field is not None and model_field.primary_key:\n                    description = get_pk_description(model, model_field)\n\n            parameter = {\n                \"name\": variable,\n                \"in\": \"path\",\n                \"required\": True,\n                \"description\": description,\n                'schema': {\n                    'type': 'string',  # TODO: integer, pattern, ...\n                },\n            }\n            parameters.append(parameter)\n\n        return parameters\n\n    def get_filter_parameters(self, path, method):\n        if not self.allows_filters(path, method):\n            return []\n        parameters = []\n        for filter_backend in self.view.filter_backends:\n            parameters += filter_backend().get_schema_operation_parameters(self.view)\n        return parameters\n\n    def allows_filters(self, path, method):\n        \"\"\"\n        Determine whether to include filter Fields in schema.\n\n        Default implementation looks for ModelViewSet or GenericAPIView\n        actions/methods that cause filtering on the default implementation.\n        \"\"\"\n        if getattr(self.view, 'filter_backends', None) is None:\n            return False\n        if hasattr(self.view, 'action'):\n            return self.view.action in [\"list\", \"retrieve\", \"update\", \"partial_update\", \"destroy\"]\n        return method.lower() in [\"get\", \"put\", \"patch\", \"delete\"]\n\n    def get_pagination_parameters(self, path, method):\n        view = self.view\n\n        if not is_list_view(path, method, view):\n            return []\n\n        paginator = self.get_paginator()\n        if not paginator:\n            return []\n\n        return paginator.get_schema_operation_parameters(view)\n\n    def map_choicefield(self, field):\n        choices = list(dict.fromkeys(field.choices))  # preserve order and remove duplicates\n        if all(isinstance(choice, bool) for choice in choices):\n            type = 'boolean'\n        elif all(isinstance(choice, int) for choice in choices):\n            type = 'integer'\n        elif all(isinstance(choice, (int, float, Decimal)) for choice in choices):  # `number` includes `integer`\n            # Ref: https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.21\n            type = 'number'\n        elif all(isinstance(choice, str) for choice in choices):\n            type = 'string'\n        else:\n            type = None\n\n        mapping = {\n            # The value of `enum` keyword MUST be an array and SHOULD be unique.\n            # Ref: https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.20\n            'enum': choices\n        }\n\n        # If We figured out `type` then and only then we should set it. It must be a string.\n        # Ref: https://swagger.io/docs/specification/data-models/data-types/#mixed-type\n        # It is optional but it can not be null.\n        # Ref: https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.21\n        if type:\n            mapping['type'] = type\n        return mapping\n\n    def map_field(self, field):\n\n        # Nested Serializers, `many` or not.\n        if isinstance(field, serializers.ListSerializer):\n            return {\n                'type': 'array',\n                'items': self.map_serializer(field.child)\n            }\n        if isinstance(field, serializers.Serializer):\n            data = self.map_serializer(field)\n            data['type'] = 'object'\n            return data\n\n        # Related fields.\n        if isinstance(field, serializers.ManyRelatedField):\n            return {\n                'type': 'array',\n                'items': self.map_field(field.child_relation)\n            }\n        if isinstance(field, serializers.PrimaryKeyRelatedField):\n            if getattr(field, \"pk_field\", False):\n                return self.map_field(field=field.pk_field)\n            model = getattr(field.queryset, 'model', None)\n            if model is not None:\n                model_field = model._meta.pk\n                if isinstance(model_field, models.AutoField):\n                    return {'type': 'integer'}\n\n        # ChoiceFields (single and multiple).\n        # Q:\n        # - Is 'type' required?\n        # - can we determine the TYPE of a choicefield?\n        if isinstance(field, serializers.MultipleChoiceField):\n            return {\n                'type': 'array',\n                'items': self.map_choicefield(field)\n            }\n\n        if isinstance(field, serializers.ChoiceField):\n            return self.map_choicefield(field)\n\n        # ListField.\n        if isinstance(field, serializers.ListField):\n            mapping = {\n                'type': 'array',\n                'items': {},\n            }\n            if not isinstance(field.child, _UnvalidatedField):\n                mapping['items'] = self.map_field(field.child)\n            return mapping\n\n        # DateField and DateTimeField type is string\n        if isinstance(field, serializers.DateField):\n            return {\n                'type': 'string',\n                'format': 'date',\n            }\n\n        if isinstance(field, serializers.DateTimeField):\n            return {\n                'type': 'string',\n                'format': 'date-time',\n            }\n\n        # \"Formats such as \"email\", \"uuid\", and so on, MAY be used even though undefined by this specification.\"\n        # see: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#data-types\n        # see also: https://swagger.io/docs/specification/data-models/data-types/#string\n        if isinstance(field, serializers.EmailField):\n            return {\n                'type': 'string',\n                'format': 'email'\n            }\n\n        if isinstance(field, serializers.URLField):\n            return {\n                'type': 'string',\n                'format': 'uri'\n            }\n\n        if isinstance(field, serializers.UUIDField):\n            return {\n                'type': 'string',\n                'format': 'uuid'\n            }\n\n        if isinstance(field, serializers.IPAddressField):\n            content = {\n                'type': 'string',\n            }\n            if field.protocol != 'both':\n                content['format'] = field.protocol\n            return content\n\n        if isinstance(field, serializers.DecimalField):\n            if getattr(field, 'coerce_to_string', api_settings.COERCE_DECIMAL_TO_STRING):\n                content = {\n                    'type': 'string',\n                    'format': 'decimal',\n                }\n            else:\n                content = {\n                    'type': 'number'\n                }\n\n            if field.decimal_places:\n                content['multipleOf'] = float('.' + (field.decimal_places - 1) * '0' + '1')\n            if field.max_whole_digits:\n                content['maximum'] = int(field.max_whole_digits * '9') + 1\n                content['minimum'] = -content['maximum']\n            self._map_min_max(field, content)\n            return content\n\n        if isinstance(field, serializers.FloatField):\n            content = {\n                'type': 'number',\n            }\n            self._map_min_max(field, content)\n            return content\n\n        if isinstance(field, serializers.IntegerField):\n            content = {\n                'type': 'integer'\n            }\n            self._map_min_max(field, content)\n            # 2147483647 is max for int32_size, so we use int64 for format\n            if int(content.get('maximum', 0)) > 2147483647 or int(content.get('minimum', 0)) > 2147483647:\n                content['format'] = 'int64'\n            return content\n\n        if isinstance(field, serializers.FileField):\n            return {\n                'type': 'string',\n                'format': 'binary'\n            }\n\n        # Simplest cases, default to 'string' type:\n        FIELD_CLASS_SCHEMA_TYPE = {\n            serializers.BooleanField: 'boolean',\n            serializers.JSONField: 'object',\n            serializers.DictField: 'object',\n            serializers.HStoreField: 'object',\n        }\n        return {'type': FIELD_CLASS_SCHEMA_TYPE.get(field.__class__, 'string')}\n\n    def _map_min_max(self, field, content):\n        if field.max_value:\n            content['maximum'] = field.max_value\n        if field.min_value:\n            content['minimum'] = field.min_value\n\n    def map_serializer(self, serializer):\n        # Assuming we have a valid serializer instance.\n        required = []\n        properties = {}\n\n        for field in serializer.fields.values():\n            if isinstance(field, serializers.HiddenField):\n                continue\n\n            if field.required and not serializer.partial:\n                required.append(self.get_field_name(field))\n\n            schema = self.map_field(field)\n            if field.read_only:\n                schema['readOnly'] = True\n            if field.write_only:\n                schema['writeOnly'] = True\n            if field.allow_null:\n                schema['nullable'] = True\n            if field.default is not None and field.default != empty and not callable(field.default):\n                schema['default'] = field.default\n            if field.help_text:\n                schema['description'] = str(field.help_text)\n            self.map_field_validators(field, schema)\n\n            properties[self.get_field_name(field)] = schema\n\n        result = {\n            'type': 'object',\n            'properties': properties\n        }\n        if required:\n            result['required'] = required\n\n        return result\n\n    def map_field_validators(self, field, schema):\n        \"\"\"\n        map field validators\n        \"\"\"\n        for v in field.validators:\n            # \"Formats such as \"email\", \"uuid\", and so on, MAY be used even though undefined by this specification.\"\n            # https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#data-types\n            if isinstance(v, EmailValidator):\n                schema['format'] = 'email'\n            if isinstance(v, URLValidator):\n                schema['format'] = 'uri'\n            if isinstance(v, RegexValidator):\n                # In Python, the token \\Z does what \\z does in other engines.\n                # https://stackoverflow.com/questions/53283160\n                schema['pattern'] = v.regex.pattern.replace('\\\\Z', '\\\\z')\n            elif isinstance(v, MaxLengthValidator):\n                attr_name = 'maxLength'\n                if isinstance(field, serializers.ListField):\n                    attr_name = 'maxItems'\n                schema[attr_name] = v.limit_value\n            elif isinstance(v, MinLengthValidator):\n                attr_name = 'minLength'\n                if isinstance(field, serializers.ListField):\n                    attr_name = 'minItems'\n                schema[attr_name] = v.limit_value\n            elif isinstance(v, MaxValueValidator):\n                schema['maximum'] = v.limit_value\n            elif isinstance(v, MinValueValidator):\n                schema['minimum'] = v.limit_value\n            elif isinstance(v, DecimalValidator) and \\\n                    not getattr(field, 'coerce_to_string', api_settings.COERCE_DECIMAL_TO_STRING):\n                if v.decimal_places:\n                    schema['multipleOf'] = float('.' + (v.decimal_places - 1) * '0' + '1')\n                if v.max_digits:\n                    digits = v.max_digits\n                    if v.decimal_places is not None and v.decimal_places > 0:\n                        digits -= v.decimal_places\n                    schema['maximum'] = int(digits * '9') + 1\n                    schema['minimum'] = -schema['maximum']\n\n    def get_field_name(self, field):\n        \"\"\"\n        Override this method if you want to change schema field name.\n        For example, convert snake_case field name to camelCase.\n        \"\"\"\n        return field.field_name\n\n    def get_paginator(self):\n        pagination_class = getattr(self.view, 'pagination_class', None)\n        if pagination_class:\n            return pagination_class()\n        return None\n\n    def map_parsers(self, path, method):\n        return list(map(attrgetter('media_type'), self.view.parser_classes))\n\n    def map_renderers(self, path, method):\n        media_types = []\n        for renderer in self.view.renderer_classes:\n            # BrowsableAPIRenderer not relevant to OpenAPI spec\n            if issubclass(renderer, renderers.BrowsableAPIRenderer):\n                continue\n            media_types.append(renderer.media_type)\n        return media_types\n\n    def get_serializer(self, path, method):\n        view = self.view\n\n        if not hasattr(view, 'get_serializer'):\n            return None\n\n        try:\n            return view.get_serializer()\n        except exceptions.APIException:\n            warnings.warn('{}.get_serializer() raised an exception during '\n                          'schema generation. Serializer fields will not be '\n                          'generated for {} {}.'\n                          .format(view.__class__.__name__, method, path))\n            return None\n\n    def get_request_serializer(self, path, method):\n        \"\"\"\n        Override this method if your view uses a different serializer for\n        handling request body.\n        \"\"\"\n        return self.get_serializer(path, method)\n\n    def get_response_serializer(self, path, method):\n        \"\"\"\n        Override this method if your view uses a different serializer for\n        populating response data.\n        \"\"\"\n        return self.get_serializer(path, method)\n\n    def get_reference(self, serializer):\n        return {'$ref': f'#/components/schemas/{self.get_component_name(serializer)}'}\n\n    def get_request_body(self, path, method):\n        if method not in ('PUT', 'PATCH', 'POST'):\n            return {}\n\n        self.request_media_types = self.map_parsers(path, method)\n\n        serializer = self.get_request_serializer(path, method)\n\n        if not isinstance(serializer, serializers.Serializer):\n            item_schema = {}\n        else:\n            item_schema = self.get_reference(serializer)\n\n        return {\n            'content': {\n                ct: {'schema': item_schema}\n                for ct in self.request_media_types\n            }\n        }\n\n    def get_responses(self, path, method):\n        if method == 'DELETE':\n            return {\n                '204': {\n                    'description': ''\n                }\n            }\n\n        self.response_media_types = self.map_renderers(path, method)\n\n        serializer = self.get_response_serializer(path, method)\n\n        if not isinstance(serializer, serializers.Serializer):\n            item_schema = {}\n        else:\n            item_schema = self.get_reference(serializer)\n\n        if is_list_view(path, method, self.view):\n            response_schema = {\n                'type': 'array',\n                'items': item_schema,\n            }\n            paginator = self.get_paginator()\n            if paginator:\n                response_schema = paginator.get_paginated_response_schema(response_schema)\n        else:\n            response_schema = item_schema\n        status_code = '201' if method == 'POST' else '200'\n        return {\n            status_code: {\n                'content': {\n                    ct: {'schema': response_schema}\n                    for ct in self.response_media_types\n                },\n                # description is a mandatory property,\n                # https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#responseObject\n                # TODO: put something meaningful into it\n                'description': \"\"\n            }\n        }\n\n    def get_tags(self, path, method):\n        # If user have specified tags, use them.\n        if self._tags:\n            return self._tags\n\n        # First element of a specific path could be valid tag. This is a fallback solution.\n        # PUT, PATCH, GET(Retrieve), DELETE:        /user_profile/{id}/       tags = [user-profile]\n        # POST, GET(List):                          /user_profile/            tags = [user-profile]\n        if path.startswith('/'):\n            path = path[1:]\n\n        return [path.split('/')[0].replace('_', '-')]\n"
  },
  {
    "path": "rest_framework/schemas/utils.py",
    "content": "\"\"\"\nutils.py        # Shared helper functions\n\nSee schemas.__init__.py for package overview.\n\"\"\"\nfrom django.db import models\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework.mixins import RetrieveModelMixin\n\n\ndef is_list_view(path, method, view):\n    \"\"\"\n    Return True if the given path/method appears to represent a list view.\n    \"\"\"\n    if hasattr(view, 'action'):\n        # Viewsets have an explicitly defined action, which we can inspect.\n        return view.action == 'list'\n\n    if method.lower() != 'get':\n        return False\n    if isinstance(view, RetrieveModelMixin):\n        return False\n    path_components = path.strip('/').split('/')\n    if path_components and '{' in path_components[-1]:\n        return False\n    return True\n\n\ndef get_pk_description(model, model_field):\n    if isinstance(model_field, models.AutoField):\n        value_type = _('unique integer value')\n    elif isinstance(model_field, models.UUIDField):\n        value_type = _('UUID string')\n    else:\n        value_type = _('unique value')\n\n    return _('A {value_type} identifying this {name}.').format(\n        value_type=value_type,\n        name=model._meta.verbose_name,\n    )\n"
  },
  {
    "path": "rest_framework/schemas/views.py",
    "content": "\"\"\"\nviews.py        # Houses `SchemaView`, `APIView` subclass.\n\nSee schemas.__init__.py for package overview.\n\"\"\"\nfrom rest_framework import exceptions, renderers\nfrom rest_framework.response import Response\nfrom rest_framework.settings import api_settings\nfrom rest_framework.views import APIView\n\n\nclass SchemaView(APIView):\n    _ignore_model_permissions = True\n    schema = None  # exclude from schema\n    renderer_classes = None\n    schema_generator = None\n    public = False\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        if self.renderer_classes is None:\n            self.renderer_classes = [\n                renderers.OpenAPIRenderer,\n                renderers.JSONOpenAPIRenderer,\n            ]\n            if renderers.BrowsableAPIRenderer in api_settings.DEFAULT_RENDERER_CLASSES:\n                self.renderer_classes += [renderers.BrowsableAPIRenderer]\n\n    def get(self, request, *args, **kwargs):\n        schema = self.schema_generator.get_schema(request, self.public)\n        if schema is None:\n            raise exceptions.PermissionDenied()\n        return Response(schema)\n\n    def handle_exception(self, exc):\n        # Schema renderers do not render exceptions, so re-perform content\n        # negotiation with default renderers.\n        self.renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES\n        neg = self.perform_content_negotiation(self.request, force=True)\n        self.request.accepted_renderer, self.request.accepted_media_type = neg\n        return super().handle_exception(exc)\n"
  },
  {
    "path": "rest_framework/serializers.py",
    "content": "\"\"\"\nSerializers and ModelSerializers are similar to Forms and ModelForms.\nUnlike forms, they are not constrained to dealing with HTML output, and\nform encoded input.\n\nSerialization in REST framework is a two-phase process:\n\n1. Serializers marshal between complex types like model instances, and\npython primitives.\n2. The process of marshaling between python primitives and request and\nresponse content is handled by parsers and renderers.\n\"\"\"\n\nimport contextlib\nimport copy\nimport inspect\nimport traceback\nfrom collections import defaultdict\nfrom collections.abc import Mapping\n\nfrom django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured\nfrom django.core.exceptions import ValidationError as DjangoValidationError\nfrom django.db import models\nfrom django.db.models.fields import Field as DjangoModelField\nfrom django.utils import timezone\nfrom django.utils.functional import cached_property\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework.compat import (\n    get_referenced_base_fields_from_q, postgres_fields\n)\nfrom rest_framework.exceptions import ErrorDetail, ValidationError\nfrom rest_framework.fields import get_error_detail\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils import html, model_meta, representation\nfrom rest_framework.utils.field_mapping import (\n    ClassLookupDict, get_field_kwargs, get_nested_relation_kwargs,\n    get_relation_kwargs, get_url_kwargs\n)\nfrom rest_framework.utils.serializer_helpers import (\n    BindingDict, BoundField, JSONBoundField, NestedBoundField, ReturnDict,\n    ReturnList\n)\nfrom rest_framework.validators import (\n    UniqueForDateValidator, UniqueForMonthValidator, UniqueForYearValidator,\n    UniqueTogetherValidator\n)\n\n# Note: We do the following so that users of the framework can use this style:\n#\n#     example_field = serializers.CharField(...)\n#\n# This helps keep the separation between model fields, form fields, and\n# serializer fields more explicit.\nfrom rest_framework.fields import (  # NOQA # isort:skip\n    BigIntegerField, BooleanField, CharField, ChoiceField, DateField, DateTimeField, DecimalField,\n    DictField, DurationField, EmailField, Field, FileField, FilePathField, FloatField,\n    HiddenField, HStoreField, IPAddressField, ImageField, IntegerField, JSONField,\n    ListField, ModelField, MultipleChoiceField, ReadOnlyField,\n    RegexField, SerializerMethodField, SlugField, TimeField, URLField, UUIDField,\n)\nfrom rest_framework.relations import (  # NOQA # isort:skip\n    HyperlinkedIdentityField, HyperlinkedRelatedField, ManyRelatedField,\n    PrimaryKeyRelatedField, RelatedField, SlugRelatedField, StringRelatedField,\n)\n\n# Non-field imports, but public API\nfrom rest_framework.fields import (  # NOQA # isort:skip\n    CreateOnlyDefault, CurrentUserDefault, SkipField, empty\n)\nfrom rest_framework.relations import Hyperlink, PKOnlyObject  # NOQA # isort:skip\n\n# We assume that 'validators' are intended for the child serializer,\n# rather than the parent serializer.\nLIST_SERIALIZER_KWARGS = (\n    'read_only', 'write_only', 'required', 'default', 'initial', 'source',\n    'label', 'help_text', 'style', 'error_messages', 'allow_empty',\n    'instance', 'data', 'partial', 'context', 'allow_null',\n    'max_length', 'min_length'\n)\nLIST_SERIALIZER_KWARGS_REMOVE = ('allow_empty', 'min_length', 'max_length')\n\nALL_FIELDS = '__all__'\n\n\n# BaseSerializer\n# --------------\n\nclass BaseSerializer(Field):\n    \"\"\"\n    The BaseSerializer class provides a minimal class which may be used\n    for writing custom serializer implementations.\n\n    Note that we strongly restrict the ordering of operations/properties\n    that may be used on the serializer in order to enforce correct usage.\n\n    In particular, if a `data=` argument is passed then:\n\n    .is_valid() - Available.\n    .initial_data - Available.\n    .validated_data - Only available after calling `is_valid()`\n    .errors - Only available after calling `is_valid()`\n    .data - Only available after calling `is_valid()`\n\n    If a `data=` argument is not passed then:\n\n    .is_valid() - Not available.\n    .initial_data - Not available.\n    .validated_data - Not available.\n    .errors - Not available.\n    .data - Available.\n    \"\"\"\n\n    def __init__(self, instance=None, data=empty, **kwargs):\n        self.instance = instance\n        if data is not empty:\n            self.initial_data = data\n        self.partial = kwargs.pop('partial', False)\n        self._context = kwargs.pop('context', {})\n        kwargs.pop('many', None)\n        super().__init__(**kwargs)\n\n    def __new__(cls, *args, **kwargs):\n        # We override this method in order to automatically create\n        # `ListSerializer` classes instead when `many=True` is set.\n        if kwargs.pop('many', False):\n            return cls.many_init(*args, **kwargs)\n        return super().__new__(cls, *args, **kwargs)\n\n    # Allow type checkers to make serializers generic.\n    def __class_getitem__(cls, *args, **kwargs):\n        return cls\n\n    @classmethod\n    def many_init(cls, *args, **kwargs):\n        \"\"\"\n        This method implements the creation of a `ListSerializer` parent\n        class when `many=True` is used. You can customize it if you need to\n        control which keyword arguments are passed to the parent, and\n        which are passed to the child.\n\n        Note that we're over-cautious in passing most arguments to both parent\n        and child classes in order to try to cover the general case. If you're\n        overriding this method you'll probably want something much simpler, eg:\n\n        @classmethod\n        def many_init(cls, *args, **kwargs):\n            kwargs['child'] = cls()\n            return CustomListSerializer(*args, **kwargs)\n        \"\"\"\n        list_kwargs = {}\n        for key in LIST_SERIALIZER_KWARGS_REMOVE:\n            value = kwargs.pop(key, None)\n            if value is not None:\n                list_kwargs[key] = value\n        list_kwargs['child'] = cls(*args, **kwargs)\n        list_kwargs.update({\n            key: value for key, value in kwargs.items()\n            if key in LIST_SERIALIZER_KWARGS\n        })\n        meta = getattr(cls, 'Meta', None)\n        list_serializer_class = getattr(meta, 'list_serializer_class', ListSerializer)\n        return list_serializer_class(*args, **list_kwargs)\n\n    def to_internal_value(self, data):\n        raise NotImplementedError('`to_internal_value()` must be implemented.')\n\n    def to_representation(self, instance):\n        raise NotImplementedError('`to_representation()` must be implemented.')\n\n    def update(self, instance, validated_data):\n        raise NotImplementedError('`update()` must be implemented.')\n\n    def create(self, validated_data):\n        raise NotImplementedError('`create()` must be implemented.')\n\n    def save(self, **kwargs):\n        assert hasattr(self, '_errors'), (\n            'You must call `.is_valid()` before calling `.save()`.'\n        )\n\n        assert not self.errors, (\n            'You cannot call `.save()` on a serializer with invalid data.'\n        )\n\n        # Guard against incorrect use of `serializer.save(commit=False)`\n        assert 'commit' not in kwargs, (\n            \"'commit' is not a valid keyword argument to the 'save()' method. \"\n            \"If you need to access data before committing to the database then \"\n            \"inspect 'serializer.validated_data' instead. \"\n            \"You can also pass additional keyword arguments to 'save()' if you \"\n            \"need to set extra attributes on the saved model instance. \"\n            \"For example: 'serializer.save(owner=request.user)'.'\"\n        )\n\n        assert not hasattr(self, '_data'), (\n            \"You cannot call `.save()` after accessing `serializer.data`.\"\n            \"If you need to access data before committing to the database then \"\n            \"inspect 'serializer.validated_data' instead. \"\n        )\n\n        validated_data = {**self.validated_data, **kwargs}\n\n        if self.instance is not None:\n            self.instance = self.update(self.instance, validated_data)\n            assert self.instance is not None, (\n                '`update()` did not return an object instance.'\n            )\n        else:\n            self.instance = self.create(validated_data)\n            assert self.instance is not None, (\n                '`create()` did not return an object instance.'\n            )\n\n        return self.instance\n\n    def is_valid(self, *, raise_exception=False):\n        assert hasattr(self, 'initial_data'), (\n            'Cannot call `.is_valid()` as no `data=` keyword argument was '\n            'passed when instantiating the serializer instance.'\n        )\n\n        if not hasattr(self, '_validated_data'):\n            try:\n                self._validated_data = self.run_validation(self.initial_data)\n            except ValidationError as exc:\n                self._validated_data = {}\n                self._errors = exc.detail\n            else:\n                self._errors = {}\n\n        if self._errors and raise_exception:\n            raise ValidationError(self.errors)\n\n        return not bool(self._errors)\n\n    @property\n    def data(self):\n        if hasattr(self, 'initial_data') and not hasattr(self, '_validated_data'):\n            msg = (\n                'When a serializer is passed a `data` keyword argument you '\n                'must call `.is_valid()` before attempting to access the '\n                'serialized `.data` representation.\\n'\n                'You should either call `.is_valid()` first, '\n                'or access `.initial_data` instead.'\n            )\n            raise AssertionError(msg)\n\n        if not hasattr(self, '_data'):\n            if self.instance is not None and not getattr(self, '_errors', None):\n                self._data = self.to_representation(self.instance)\n            elif hasattr(self, '_validated_data') and not getattr(self, '_errors', None):\n                self._data = self.to_representation(self.validated_data)\n            else:\n                self._data = self.get_initial()\n        return self._data\n\n    @property\n    def errors(self):\n        if not hasattr(self, '_errors'):\n            msg = 'You must call `.is_valid()` before accessing `.errors`.'\n            raise AssertionError(msg)\n        return self._errors\n\n    @property\n    def validated_data(self):\n        if not hasattr(self, '_validated_data'):\n            msg = 'You must call `.is_valid()` before accessing `.validated_data`.'\n            raise AssertionError(msg)\n        return self._validated_data\n\n\n# Serializer & ListSerializer classes\n# -----------------------------------\n\nclass SerializerMetaclass(type):\n    \"\"\"\n    This metaclass sets a dictionary named `_declared_fields` on the class.\n\n    Any instances of `Field` included as attributes on either the class\n    or on any of its superclasses will be include in the\n    `_declared_fields` dictionary.\n    \"\"\"\n\n    @classmethod\n    def _get_declared_fields(cls, bases, attrs):\n        fields = [(field_name, attrs.pop(field_name))\n                  for field_name, obj in list(attrs.items())\n                  if isinstance(obj, Field)]\n        fields.sort(key=lambda x: x[1]._creation_counter)\n\n        # Ensures a base class field doesn't override cls attrs, and maintains\n        # field precedence when inheriting multiple parents. e.g. if there is a\n        # class C(A, B), and A and B both define 'field', use 'field' from A.\n        known = set(attrs)\n\n        def visit(name):\n            known.add(name)\n            return name\n\n        base_fields = [\n            (visit(name), f)\n            for base in bases if hasattr(base, '_declared_fields')\n            for name, f in base._declared_fields.items() if name not in known\n        ]\n\n        return dict(base_fields + fields)\n\n    def __new__(cls, name, bases, attrs):\n        attrs['_declared_fields'] = cls._get_declared_fields(bases, attrs)\n        return super().__new__(cls, name, bases, attrs)\n\n\ndef as_serializer_error(exc):\n    \"\"\"\n    Coerce validation exceptions into a standardized serialized error format.\n\n    This function normalizes both Django's `ValidationError` and REST\n    framework's `ValidationError` into a dictionary structure compatible\n    with serializer `.errors`, ensuring all values are represented as\n    lists of error details.\n\n    The returned structure conforms to the serializer error contract:\n    - Field-specific errors are returned as '{field-name: [errors]}'\n    - Non-field errors are returned under the 'NON_FIELD_ERRORS_KEY'\n    \"\"\"\n    assert isinstance(exc, (ValidationError, DjangoValidationError))\n\n    if isinstance(exc, DjangoValidationError):\n        detail = get_error_detail(exc)\n    else:\n        detail = exc.detail\n\n    if isinstance(detail, Mapping):\n        # If errors may be a dict we use the standard {key: list of values}.\n        # Here we ensure that all the values are *lists* of errors.\n        return {\n            key: value if isinstance(value, (list, Mapping)) else [value]\n            for key, value in detail.items()\n        }\n    elif isinstance(detail, list):\n        # Errors raised as a list are non-field errors.\n        return {\n            api_settings.NON_FIELD_ERRORS_KEY: detail\n        }\n    # Errors raised as a string are non-field errors.\n    return {\n        api_settings.NON_FIELD_ERRORS_KEY: [detail]\n    }\n\n\nclass Serializer(BaseSerializer, metaclass=SerializerMetaclass):\n    default_error_messages = {\n        'invalid': _('Invalid data. Expected a dictionary, but got {datatype}.')\n    }\n\n    def set_value(self, dictionary, keys, value):\n        \"\"\"\n        Similar to Python's built in `dictionary[key] = value`,\n        but takes a list of nested keys instead of a single key.\n\n        set_value({'a': 1}, [], {'b': 2}) -> {'a': 1, 'b': 2}\n        set_value({'a': 1}, ['x'], 2) -> {'a': 1, 'x': 2}\n        set_value({'a': 1}, ['x', 'y'], 2) -> {'a': 1, 'x': {'y': 2}}\n        \"\"\"\n        if not keys:\n            dictionary.update(value)\n            return\n\n        for key in keys[:-1]:\n            if key not in dictionary:\n                dictionary[key] = {}\n            dictionary = dictionary[key]\n\n        dictionary[keys[-1]] = value\n\n    @cached_property\n    def fields(self):\n        \"\"\"\n        A dictionary of {field_name: field_instance}.\n        \"\"\"\n        # `fields` is evaluated lazily. We do this to ensure that we don't\n        # have issues importing modules that use ModelSerializers as fields,\n        # even if Django's app-loading stage has not yet run.\n        fields = BindingDict(self)\n        for key, value in self.get_fields().items():\n            fields[key] = value\n        return fields\n\n    @property\n    def _writable_fields(self):\n        for field in self.fields.values():\n            if not field.read_only:\n                yield field\n\n    @property\n    def _readable_fields(self):\n        for field in self.fields.values():\n            if not field.write_only:\n                yield field\n\n    def get_fields(self):\n        \"\"\"\n        Returns a dictionary of {field_name: field_instance}.\n        \"\"\"\n        # Every new serializer is created with a clone of the field instances.\n        # This allows users to dynamically modify the fields on a serializer\n        # instance without affecting every other serializer instance.\n        return copy.deepcopy(self._declared_fields)\n\n    def get_validators(self):\n        \"\"\"\n        Returns a list of validator callables.\n        \"\"\"\n        # Used by the lazily-evaluated `validators` property.\n        meta = getattr(self, 'Meta', None)\n        validators = getattr(meta, 'validators', None)\n        return list(validators) if validators else []\n\n    def get_initial(self):\n        if hasattr(self, 'initial_data'):\n            # initial_data may not be a valid type\n            if not isinstance(self.initial_data, Mapping):\n                return {}\n\n            return {\n                field_name: field.get_value(self.initial_data)\n                for field_name, field in self.fields.items()\n                if (field.get_value(self.initial_data) is not empty) and\n                not field.read_only\n            }\n\n        return {\n            field.field_name: field.get_initial()\n            for field in self.fields.values()\n            if not field.read_only\n        }\n\n    def get_value(self, dictionary):\n        # We override the default field access in order to support\n        # nested HTML forms.\n        if html.is_html_input(dictionary):\n            return html.parse_html_dict(dictionary, prefix=self.field_name) or empty\n        return dictionary.get(self.field_name, empty)\n\n    def run_validation(self, data=empty):\n        \"\"\"\n        We override the default `run_validation`, because the validation\n        performed by validators and the `.validate()` method should\n        be coerced into an error dictionary with a 'non_fields_error' key.\n        \"\"\"\n        (is_empty_value, data) = self.validate_empty_values(data)\n        if is_empty_value:\n            return data\n\n        value = self.to_internal_value(data)\n        try:\n            self.run_validators(value)\n            value = self.validate(value)\n            assert value is not None, '.validate() should return the validated data'\n        except (ValidationError, DjangoValidationError) as exc:\n            raise ValidationError(detail=as_serializer_error(exc))\n\n        return value\n\n    def _read_only_defaults(self):\n        fields = [\n            field for field in self.fields.values()\n            if (field.read_only) and (field.default != empty) and (field.source != '*') and ('.' not in field.source)\n        ]\n\n        defaults = {}\n        for field in fields:\n            try:\n                default = field.get_default()\n            except SkipField:\n                continue\n            defaults[field.source] = default\n\n        return defaults\n\n    def run_validators(self, value):\n        \"\"\"\n        Add read_only fields with defaults to value before running validators.\n        \"\"\"\n        if isinstance(value, dict):\n            to_validate = self._read_only_defaults()\n            to_validate.update(value)\n        else:\n            to_validate = value\n        super().run_validators(to_validate)\n\n    def to_internal_value(self, data):\n        \"\"\"\n        Dict of native values <- Dict of primitive datatypes.\n        \"\"\"\n        if not isinstance(data, Mapping):\n            message = self.error_messages['invalid'].format(\n                datatype=type(data).__name__\n            )\n            raise ValidationError({\n                api_settings.NON_FIELD_ERRORS_KEY: [message]\n            }, code='invalid')\n\n        ret = {}\n        errors = {}\n        fields = self._writable_fields\n\n        for field in fields:\n            validate_method = getattr(self, 'validate_' + field.field_name, None)\n            primitive_value = field.get_value(data)\n            try:\n                validated_value = field.run_validation(primitive_value)\n                if validate_method is not None:\n                    validated_value = validate_method(validated_value)\n            except ValidationError as exc:\n                errors[field.field_name] = exc.detail\n            except DjangoValidationError as exc:\n                errors[field.field_name] = get_error_detail(exc)\n            except SkipField:\n                pass\n            else:\n                self.set_value(ret, field.source_attrs, validated_value)\n\n        if errors:\n            raise ValidationError(errors)\n\n        return ret\n\n    def to_representation(self, instance):\n        \"\"\"\n        Object instance -> Dict of primitive datatypes.\n        \"\"\"\n        ret = {}\n        fields = self._readable_fields\n\n        for field in fields:\n            try:\n                attribute = field.get_attribute(instance)\n            except SkipField:\n                continue\n\n            # We skip `to_representation` for `None` values so that fields do\n            # not have to explicitly deal with that case.\n            #\n            # For related fields with `use_pk_only_optimization` we need to\n            # resolve the pk value.\n            check_for_none = attribute.pk if isinstance(attribute, PKOnlyObject) else attribute\n            if check_for_none is None:\n                ret[field.field_name] = None\n            else:\n                ret[field.field_name] = field.to_representation(attribute)\n\n        return ret\n\n    def validate(self, attrs):\n        return attrs\n\n    def __repr__(self):\n        return representation.serializer_repr(self, indent=1)\n\n    # The following are used for accessing `BoundField` instances on the\n    # serializer, for the purposes of presenting a form-like API onto the\n    # field values and field errors.\n\n    def __iter__(self):\n        for field in self.fields.values():\n            yield self[field.field_name]\n\n    def __getitem__(self, key):\n        field = self.fields[key]\n        value = self.data.get(key)\n        error = self.errors.get(key) if hasattr(self, '_errors') else None\n        if isinstance(field, Serializer):\n            return NestedBoundField(field, value, error)\n        if isinstance(field, JSONField):\n            return JSONBoundField(field, value, error)\n        return BoundField(field, value, error)\n\n    # Include a backlink to the serializer class on return objects.\n    # Allows renderers such as HTMLFormRenderer to get the full field info.\n\n    @property\n    def data(self):\n        ret = super().data\n        return ReturnDict(ret, serializer=self)\n\n    @property\n    def errors(self):\n        ret = super().errors\n        if isinstance(ret, list) and len(ret) == 1 and getattr(ret[0], 'code', None) == 'null':\n            # Edge case. Provide a more descriptive error than\n            # \"this field may not be null\", when no data is passed.\n            detail = ErrorDetail('No data provided', code='null')\n            ret = {api_settings.NON_FIELD_ERRORS_KEY: [detail]}\n        return ReturnDict(ret, serializer=self)\n\n\n# There's some replication of `ListField` here,\n# but that's probably better than obfuscating the call hierarchy.\n\nclass ListSerializer(BaseSerializer):\n    child = None\n    many = True\n\n    default_error_messages = {\n        'not_a_list': _('Expected a list of items but got type \"{input_type}\".'),\n        'empty': _('This list may not be empty.'),\n        'max_length': _('Ensure this field has no more than {max_length} elements.'),\n        'min_length': _('Ensure this field has at least {min_length} elements.')\n    }\n\n    def __init__(self, *args, **kwargs):\n        self.child = kwargs.pop('child', copy.deepcopy(self.child))\n        self.allow_empty = kwargs.pop('allow_empty', True)\n        self.max_length = kwargs.pop('max_length', None)\n        self.min_length = kwargs.pop('min_length', None)\n        assert self.child is not None, '`child` is a required argument.'\n        assert not inspect.isclass(self.child), '`child` has not been instantiated.'\n        super().__init__(*args, **kwargs)\n        self.child.bind(field_name='', parent=self)\n\n    def get_initial(self):\n        if hasattr(self, 'initial_data'):\n            return self.to_representation(self.initial_data)\n        return []\n\n    def get_value(self, dictionary):\n        \"\"\"\n        Given the input dictionary, return the field value.\n        \"\"\"\n        # We override the default field access in order to support\n        # lists in HTML forms.\n        if html.is_html_input(dictionary):\n            return html.parse_html_list(dictionary, prefix=self.field_name, default=empty)\n        return dictionary.get(self.field_name, empty)\n\n    def run_validation(self, data=empty):\n        \"\"\"\n        We override the default `run_validation`, because the validation\n        performed by validators and the `.validate()` method should\n        be coerced into an error dictionary with a 'non_fields_error' key.\n        \"\"\"\n        (is_empty_value, data) = self.validate_empty_values(data)\n        if is_empty_value:\n            return data\n\n        value = self.to_internal_value(data)\n        try:\n            self.run_validators(value)\n            value = self.validate(value)\n            assert value is not None, '.validate() should return the validated data'\n        except (ValidationError, DjangoValidationError) as exc:\n            raise ValidationError(detail=as_serializer_error(exc))\n\n        return value\n\n    def run_child_validation(self, data):\n        \"\"\"\n        Run validation on child serializer.\n        You may need to override this method to support multiple updates. For example:\n\n        self.child.instance = self.instance.get(pk=data['id'])\n        self.child.initial_data = data\n        return super().run_child_validation(data)\n        \"\"\"\n        return self.child.run_validation(data)\n\n    def to_internal_value(self, data):\n        \"\"\"\n        List of dicts of native values <- List of dicts of primitive datatypes.\n        \"\"\"\n        if html.is_html_input(data):\n            data = html.parse_html_list(data, default=[])\n\n        if not isinstance(data, list):\n            message = self.error_messages['not_a_list'].format(\n                input_type=type(data).__name__\n            )\n            raise ValidationError({\n                api_settings.NON_FIELD_ERRORS_KEY: [message]\n            }, code='not_a_list')\n\n        if not self.allow_empty and len(data) == 0:\n            message = self.error_messages['empty']\n            raise ValidationError({\n                api_settings.NON_FIELD_ERRORS_KEY: [message]\n            }, code='empty')\n\n        if self.max_length is not None and len(data) > self.max_length:\n            message = self.error_messages['max_length'].format(max_length=self.max_length)\n            raise ValidationError({\n                api_settings.NON_FIELD_ERRORS_KEY: [message]\n            }, code='max_length')\n\n        if self.min_length is not None and len(data) < self.min_length:\n            message = self.error_messages['min_length'].format(min_length=self.min_length)\n            raise ValidationError({\n                api_settings.NON_FIELD_ERRORS_KEY: [message]\n            }, code='min_length')\n\n        ret = []\n        errors = []\n\n        for item in data:\n            try:\n                validated = self.run_child_validation(item)\n            except ValidationError as exc:\n                errors.append(exc.detail)\n            else:\n                ret.append(validated)\n                errors.append({})\n\n        if any(errors):\n            raise ValidationError(errors)\n\n        return ret\n\n    def to_representation(self, data):\n        \"\"\"\n        List of object instances -> List of dicts of primitive datatypes.\n        \"\"\"\n        # Dealing with nested relationships, data can be a Manager,\n        # so, first get a queryset from the Manager if needed\n        iterable = data.all() if isinstance(data, models.manager.BaseManager) else data\n\n        return [\n            self.child.to_representation(item) for item in iterable\n        ]\n\n    def validate(self, attrs):\n        return attrs\n\n    def update(self, instance, validated_data):\n        raise NotImplementedError(\n            \"Serializers with many=True do not support multiple update by \"\n            \"default, only multiple create. For updates it is unclear how to \"\n            \"deal with insertions and deletions. If you need to support \"\n            \"multiple update, use a `ListSerializer` class and override \"\n            \"`.update()` so you can specify the behavior exactly.\"\n        )\n\n    def create(self, validated_data):\n        return [\n            self.child.create(attrs) for attrs in validated_data\n        ]\n\n    def save(self, **kwargs):\n        \"\"\"\n        Save and return a list of object instances.\n        \"\"\"\n        # Guard against incorrect use of `serializer.save(commit=False)`\n        assert 'commit' not in kwargs, (\n            \"'commit' is not a valid keyword argument to the 'save()' method. \"\n            \"If you need to access data before committing to the database then \"\n            \"inspect 'serializer.validated_data' instead. \"\n            \"You can also pass additional keyword arguments to 'save()' if you \"\n            \"need to set extra attributes on the saved model instance. \"\n            \"For example: 'serializer.save(owner=request.user)'.'\"\n        )\n\n        validated_data = [\n            {**attrs, **kwargs} for attrs in self.validated_data\n        ]\n\n        if self.instance is not None:\n            self.instance = self.update(self.instance, validated_data)\n            assert self.instance is not None, (\n                '`update()` did not return an object instance.'\n            )\n        else:\n            self.instance = self.create(validated_data)\n            assert self.instance is not None, (\n                '`create()` did not return an object instance.'\n            )\n\n        return self.instance\n\n    def is_valid(self, *, raise_exception=False):\n        # This implementation is the same as the default,\n        # except that we use lists, rather than dicts, as the empty case.\n        assert hasattr(self, 'initial_data'), (\n            'Cannot call `.is_valid()` as no `data=` keyword argument was '\n            'passed when instantiating the serializer instance.'\n        )\n\n        if not hasattr(self, '_validated_data'):\n            try:\n                self._validated_data = self.run_validation(self.initial_data)\n            except ValidationError as exc:\n                self._validated_data = []\n                self._errors = exc.detail\n            else:\n                self._errors = []\n\n        if self._errors and raise_exception:\n            raise ValidationError(self.errors)\n\n        return not bool(self._errors)\n\n    def __repr__(self):\n        return representation.list_repr(self, indent=1)\n\n    # Include a backlink to the serializer class on return objects.\n    # Allows renderers such as HTMLFormRenderer to get the full field info.\n\n    @property\n    def data(self):\n        ret = super().data\n        return ReturnList(ret, serializer=self)\n\n    @property\n    def errors(self):\n        ret = super().errors\n        if isinstance(ret, list) and len(ret) == 1 and getattr(ret[0], 'code', None) == 'null':\n            # Edge case. Provide a more descriptive error than\n            # \"this field may not be null\", when no data is passed.\n            detail = ErrorDetail('No data provided', code='null')\n            ret = {api_settings.NON_FIELD_ERRORS_KEY: [detail]}\n        if isinstance(ret, dict):\n            return ReturnDict(ret, serializer=self)\n        return ReturnList(ret, serializer=self)\n\n\n# ModelSerializer & HyperlinkedModelSerializer\n# --------------------------------------------\n\ndef raise_errors_on_nested_writes(method_name, serializer, validated_data):\n    \"\"\"\n    Enforce explicit handling of writable nested and dotted-source fields.\n\n    This helper raises clear and actionable errors when a serializer attempts\n    to perform writable nested updates or creates using the default\n    `ModelSerializer` behavior.\n\n    Writable nested relationships and dotted-source fields are intentionally\n    unsupported by default due to ambiguous persistence semantics. Developers\n    must either:\n    - Override the `.create()` / `.update()` methods explicitly, or\n    - Mark nested serializers as `read_only=True`\n\n    This check is invoked internally by default `ModelSerializer.create()`\n    and `ModelSerializer.update()` implementations.\n\n    Eg. Suppose we have a `UserSerializer` with a nested profile. How should\n    we handle the case of an update, where the `profile` relationship does\n    not exist? Any of the following might be valid:\n    * Raise an application error.\n    * Silently ignore the nested part of the update.\n    * Automatically create a profile instance.\n    \"\"\"\n\n    ModelClass = serializer.Meta.model\n    model_field_info = model_meta.get_field_info(ModelClass)\n\n    # Ensure we don't have a writable nested field. For example:\n    #\n    # class UserSerializer(ModelSerializer):\n    #     ...\n    #     profile = ProfileSerializer()\n    assert not any(\n        isinstance(field, BaseSerializer) and\n        (field.source in validated_data) and\n        (field.source in model_field_info.relations) and\n        isinstance(validated_data[field.source], (list, dict))\n        for field in serializer._writable_fields\n    ), (\n        'The `.{method_name}()` method does not support writable nested '\n        'fields by default.\\nWrite an explicit `.{method_name}()` method for '\n        'serializer `{module}.{class_name}`, or set `read_only=True` on '\n        'nested serializer fields.'.format(\n            method_name=method_name,\n            module=serializer.__class__.__module__,\n            class_name=serializer.__class__.__name__\n        )\n    )\n\n    # Ensure we don't have a writable dotted-source field. For example:\n    #\n    # class UserSerializer(ModelSerializer):\n    #     ...\n    #     address = serializer.CharField('profile.address')\n    #\n    # Though, non-relational fields (e.g., JSONField) are acceptable. For example:\n    #\n    # class NonRelationalPersonModel(models.Model):\n    #     profile = JSONField()\n    #\n    # class UserSerializer(ModelSerializer):\n    #     ...\n    #     address = serializer.CharField('profile.address')\n    assert not any(\n        len(field.source_attrs) > 1 and\n        (field.source_attrs[0] in validated_data) and\n        (field.source_attrs[0] in model_field_info.relations) and\n        isinstance(validated_data[field.source_attrs[0]], (list, dict))\n        for field in serializer._writable_fields\n    ), (\n        'The `.{method_name}()` method does not support writable dotted-source '\n        'fields by default.\\nWrite an explicit `.{method_name}()` method for '\n        'serializer `{module}.{class_name}`, or set `read_only=True` on '\n        'dotted-source serializer fields.'.format(\n            method_name=method_name,\n            module=serializer.__class__.__module__,\n            class_name=serializer.__class__.__name__\n        )\n    )\n\n\nclass ModelSerializer(Serializer):\n    \"\"\"\n    A `ModelSerializer` is just a regular `Serializer`, except that:\n\n    * A set of default fields are automatically populated.\n    * A set of default validators are automatically populated.\n    * Default `.create()` and `.update()` implementations are provided.\n\n    The process of automatically determining a set of serializer fields\n    based on the model fields is reasonably complex, but you almost certainly\n    don't need to dig into the implementation.\n\n    If the `ModelSerializer` class *doesn't* generate the set of fields that\n    you need you should either declare the extra/differing fields explicitly on\n    the serializer class, or simply use a `Serializer` class.\n    \"\"\"\n    serializer_field_mapping = {\n        models.AutoField: IntegerField,\n        models.BigAutoField: BigIntegerField,\n        models.BigIntegerField: BigIntegerField,\n        models.BooleanField: BooleanField,\n        models.CharField: CharField,\n        models.CommaSeparatedIntegerField: CharField,\n        models.DateField: DateField,\n        models.DateTimeField: DateTimeField,\n        models.DecimalField: DecimalField,\n        models.DurationField: DurationField,\n        models.EmailField: EmailField,\n        models.Field: ModelField,\n        models.FileField: FileField,\n        models.FloatField: FloatField,\n        models.ImageField: ImageField,\n        models.IntegerField: IntegerField,\n        models.NullBooleanField: BooleanField,\n        models.PositiveIntegerField: IntegerField,\n        models.PositiveSmallIntegerField: IntegerField,\n        models.SlugField: SlugField,\n        models.SmallIntegerField: IntegerField,\n        models.TextField: CharField,\n        models.TimeField: TimeField,\n        models.URLField: URLField,\n        models.UUIDField: UUIDField,\n        models.GenericIPAddressField: IPAddressField,\n        models.FilePathField: FilePathField,\n    }\n    if hasattr(models, 'JSONField'):\n        serializer_field_mapping[models.JSONField] = JSONField\n    if postgres_fields:\n        serializer_field_mapping[postgres_fields.HStoreField] = HStoreField\n        serializer_field_mapping[postgres_fields.ArrayField] = ListField\n        serializer_field_mapping[postgres_fields.JSONField] = JSONField\n    serializer_related_field = PrimaryKeyRelatedField\n    serializer_related_to_field = SlugRelatedField\n    serializer_url_field = HyperlinkedIdentityField\n    serializer_choice_field = ChoiceField\n\n    # The field name for hyperlinked identity fields. Defaults to 'url'.\n    # You can modify this using the API setting.\n    #\n    # Note that if you instead need modify this on a per-serializer basis,\n    # you'll also need to ensure you update the `create` method on any generic\n    # views, to correctly handle the 'Location' response header for\n    # \"HTTP 201 Created\" responses.\n    url_field_name = None\n\n    # Default `create` and `update` behavior...\n    def create(self, validated_data):\n        \"\"\"\n        We have a bit of extra checking around this in order to provide\n        descriptive messages when something goes wrong, but this method is\n        essentially just:\n\n            return ExampleModel.objects.create(**validated_data)\n\n        If there are many to many fields present on the instance then they\n        cannot be set until the model is instantiated, in which case the\n        implementation is like so:\n\n            example_relationship = validated_data.pop('example_relationship')\n            instance = ExampleModel.objects.create(**validated_data)\n            instance.example_relationship = example_relationship\n            return instance\n\n        The default implementation also does not handle nested relationships.\n        If you want to support writable nested relationships you'll need\n        to write an explicit `.create()` method.\n        \"\"\"\n        raise_errors_on_nested_writes('create', self, validated_data)\n\n        ModelClass = self.Meta.model\n\n        # Remove many-to-many relationships from validated_data.\n        # They are not valid arguments to the default `.create()` method,\n        # as they require that the instance has already been saved.\n        info = model_meta.get_field_info(ModelClass)\n        many_to_many = {}\n        for field_name, relation_info in info.relations.items():\n            if relation_info.to_many and (field_name in validated_data):\n                many_to_many[field_name] = validated_data.pop(field_name)\n\n        try:\n            instance = ModelClass._default_manager.create(**validated_data)\n        except TypeError:\n            tb = traceback.format_exc()\n            msg = (\n                'Got a `TypeError` when calling `%s.%s.create()`. '\n                'This may be because you have a writable field on the '\n                'serializer class that is not a valid argument to '\n                '`%s.%s.create()`. You may need to make the field '\n                'read-only, or override the %s.create() method to handle '\n                'this correctly.\\nOriginal exception was:\\n %s' %\n                (\n                    ModelClass.__name__,\n                    ModelClass._default_manager.name,\n                    ModelClass.__name__,\n                    ModelClass._default_manager.name,\n                    self.__class__.__name__,\n                    tb\n                )\n            )\n            raise TypeError(msg)\n\n        # Save many-to-many relationships after the instance is created.\n        if many_to_many:\n            for field_name, value in many_to_many.items():\n                field = getattr(instance, field_name)\n                field.set(value)\n\n        return instance\n\n    def update(self, instance, validated_data):\n        raise_errors_on_nested_writes('update', self, validated_data)\n        info = model_meta.get_field_info(instance)\n\n        # Simply set each attribute on the instance, and then save it.\n        # Note that unlike `.create()` we don't need to treat many-to-many\n        # relationships as being a special case. During updates we already\n        # have an instance pk for the relationships to be associated with.\n        m2m_fields = []\n        for attr, value in validated_data.items():\n            if attr in info.relations and info.relations[attr].to_many:\n                m2m_fields.append((attr, value))\n            else:\n                setattr(instance, attr, value)\n\n        instance.save()\n\n        # Note that many-to-many fields are set after updating instance.\n        # Setting m2m fields triggers signals which could potentially change\n        # updated instance and we do not want it to collide with .update()\n        for attr, value in m2m_fields:\n            field = getattr(instance, attr)\n            field.set(value)\n\n        return instance\n\n    # Determine the fields to apply...\n\n    def get_fields(self):\n        \"\"\"\n        Return the dict of field names -> field instances that should be\n        used for `self.fields` when instantiating the serializer.\n        \"\"\"\n        if self.url_field_name is None:\n            self.url_field_name = api_settings.URL_FIELD_NAME\n\n        assert hasattr(self, 'Meta'), (\n            'Class {serializer_class} missing \"Meta\" attribute'.format(\n                serializer_class=self.__class__.__name__\n            )\n        )\n        assert hasattr(self.Meta, 'model'), (\n            'Class {serializer_class} missing \"Meta.model\" attribute'.format(\n                serializer_class=self.__class__.__name__\n            )\n        )\n        if model_meta.is_abstract_model(self.Meta.model):\n            raise ValueError(\n                'Cannot use ModelSerializer with Abstract Models.'\n            )\n\n        declared_fields = copy.deepcopy(self._declared_fields)\n        model = getattr(self.Meta, 'model')\n        depth = getattr(self.Meta, 'depth', 0)\n\n        if depth is not None:\n            assert depth >= 0, \"'depth' may not be negative.\"\n            assert depth <= 10, \"'depth' may not be greater than 10.\"\n\n        # Retrieve metadata about fields & relationships on the model class.\n        info = model_meta.get_field_info(model)\n        field_names = self.get_field_names(declared_fields, info)\n\n        # Determine any extra field arguments and hidden fields that\n        # should be included\n        extra_kwargs = self.get_extra_kwargs()\n        extra_kwargs, hidden_fields = self.get_uniqueness_extra_kwargs(\n            field_names, declared_fields, extra_kwargs\n        )\n\n        # Determine the fields that should be included on the serializer.\n        fields = {}\n\n        # If it's a ManyToMany field, and the default is None, then raises an exception to prevent exceptions on .set()\n        for field_name in declared_fields.keys():\n            if field_name in info.relations and info.relations[field_name].to_many and declared_fields[field_name].default is None:\n                raise ValueError(\n                    f\"The field '{field_name}' on serializer '{self.__class__.__name__}' is a ManyToMany field and cannot have a default value of None.\"\n                )\n\n        for field_name in field_names:\n            # If the field is explicitly declared on the class then use that.\n            if field_name in declared_fields:\n                fields[field_name] = declared_fields[field_name]\n                continue\n\n            extra_field_kwargs = extra_kwargs.get(field_name, {})\n            source = extra_field_kwargs.get('source', '*')\n            if source == '*':\n                source = field_name\n\n            # Determine the serializer field class and keyword arguments.\n            field_class, field_kwargs = self.build_field(\n                source, info, model, depth\n            )\n\n            # Include any kwargs defined in `Meta.extra_kwargs`\n            field_kwargs = self.include_extra_kwargs(\n                field_kwargs, extra_field_kwargs\n            )\n\n            # Create the serializer field.\n            fields[field_name] = field_class(**field_kwargs)\n\n        # Add in any hidden fields.\n        fields.update(hidden_fields)\n\n        return fields\n\n    # Methods for determining the set of field names to include...\n\n    def get_field_names(self, declared_fields, info):\n        \"\"\"\n        Returns the list of all field names that should be created when\n        instantiating this serializer class. This is based on the default\n        set of fields, but also takes into account the `Meta.fields` or\n        `Meta.exclude` options if they have been specified.\n        \"\"\"\n        fields = getattr(self.Meta, 'fields', None)\n        exclude = getattr(self.Meta, 'exclude', None)\n\n        if fields and fields != ALL_FIELDS and not isinstance(fields, (list, tuple)):\n            raise TypeError(\n                'The `fields` option must be a list or tuple or \"__all__\". '\n                'Got %s.' % type(fields).__name__\n            )\n\n        if exclude and not isinstance(exclude, (list, tuple)):\n            raise TypeError(\n                'The `exclude` option must be a list or tuple. Got %s.' %\n                type(exclude).__name__\n            )\n\n        assert not (fields and exclude), (\n            \"Cannot set both 'fields' and 'exclude' options on \"\n            \"serializer {serializer_class}.\".format(\n                serializer_class=self.__class__.__name__\n            )\n        )\n\n        assert not (fields is None and exclude is None), (\n            \"Creating a ModelSerializer without either the 'fields' attribute \"\n            \"or the 'exclude' attribute has been deprecated since 3.3.0, \"\n            \"and is now disallowed. Add an explicit fields = '__all__' to the \"\n            \"{serializer_class} serializer.\".format(\n                serializer_class=self.__class__.__name__\n            ),\n        )\n\n        if fields == ALL_FIELDS:\n            fields = None\n\n        if fields is not None:\n            # Ensure that all declared fields have also been included in the\n            # `Meta.fields` option.\n\n            # Do not require any fields that are declared in a parent class,\n            # in order to allow serializer subclasses to only include\n            # a subset of fields.\n            required_field_names = set(declared_fields)\n            for cls in self.__class__.__bases__:\n                required_field_names -= set(getattr(cls, '_declared_fields', []))\n\n            for field_name in required_field_names:\n                assert field_name in fields, (\n                    \"The field '{field_name}' was declared on serializer \"\n                    \"{serializer_class}, but has not been included in the \"\n                    \"'fields' option.\".format(\n                        field_name=field_name,\n                        serializer_class=self.__class__.__name__\n                    )\n                )\n            return fields\n\n        # Use the default set of field names if `Meta.fields` is not specified.\n        fields = self.get_default_field_names(declared_fields, info)\n\n        if exclude is not None:\n            # If `Meta.exclude` is included, then remove those fields.\n            for field_name in exclude:\n                assert field_name not in self._declared_fields, (\n                    \"Cannot both declare the field '{field_name}' and include \"\n                    \"it in the {serializer_class} 'exclude' option. Remove the \"\n                    \"field or, if inherited from a parent serializer, disable \"\n                    \"with `{field_name} = None`.\"\n                    .format(\n                        field_name=field_name,\n                        serializer_class=self.__class__.__name__\n                    )\n                )\n\n                assert field_name in fields, (\n                    \"The field '{field_name}' was included on serializer \"\n                    \"{serializer_class} in the 'exclude' option, but does \"\n                    \"not match any model field.\".format(\n                        field_name=field_name,\n                        serializer_class=self.__class__.__name__\n                    )\n                )\n                fields.remove(field_name)\n\n        return fields\n\n    def get_default_field_names(self, declared_fields, model_info):\n        \"\"\"\n        Return the default list of field names that will be used if the\n        `Meta.fields` option is not specified.\n        \"\"\"\n        return (\n            [model_info.pk.name] +\n            list(declared_fields) +\n            list(model_info.fields) +\n            list(model_info.forward_relations)\n        )\n\n    # Methods for constructing serializer fields...\n\n    def build_field(self, field_name, info, model_class, nested_depth):\n        \"\"\"\n        Return a two tuple of (cls, kwargs) to build a serializer field with.\n        \"\"\"\n        if field_name in info.fields_and_pk:\n            model_field = info.fields_and_pk[field_name]\n            return self.build_standard_field(field_name, model_field)\n\n        elif field_name in info.relations:\n            relation_info = info.relations[field_name]\n            if not nested_depth:\n                return self.build_relational_field(field_name, relation_info)\n            else:\n                return self.build_nested_field(field_name, relation_info, nested_depth)\n\n        elif hasattr(model_class, field_name):\n            return self.build_property_field(field_name, model_class)\n\n        elif field_name == self.url_field_name:\n            return self.build_url_field(field_name, model_class)\n\n        return self.build_unknown_field(field_name, model_class)\n\n    def build_standard_field(self, field_name, model_field):\n        \"\"\"\n        Create regular model fields.\n        \"\"\"\n        field_mapping = ClassLookupDict(self.serializer_field_mapping)\n\n        field_class = field_mapping[model_field]\n        field_kwargs = get_field_kwargs(field_name, model_field)\n\n        # Special case to handle when a OneToOneField is also the primary key\n        if model_field.one_to_one and model_field.primary_key:\n            field_class = self.serializer_related_field\n            field_kwargs['queryset'] = model_field.related_model.objects\n\n        if 'choices' in field_kwargs:\n            # Fields with choices get coerced into `ChoiceField`\n            # instead of using their regular typed field.\n            field_class = self.serializer_choice_field\n            # Some model fields may introduce kwargs that would not be valid\n            # for the choice field. We need to strip these out.\n            # Eg. models.DecimalField(max_digits=3, decimal_places=1, choices=DECIMAL_CHOICES)\n            valid_kwargs = {\n                'read_only', 'write_only',\n                'required', 'default', 'initial', 'source',\n                'label', 'help_text', 'style',\n                'error_messages', 'validators', 'allow_null', 'allow_blank',\n                'choices'\n            }\n            for key in list(field_kwargs):\n                if key not in valid_kwargs:\n                    field_kwargs.pop(key)\n\n        if not issubclass(field_class, ModelField):\n            # `model_field` is only valid for the fallback case of\n            # `ModelField`, which is used when no other typed field\n            # matched to the model field.\n            field_kwargs.pop('model_field', None)\n\n        if not issubclass(field_class, CharField) and not issubclass(field_class, ChoiceField):\n            # `allow_blank` is only valid for textual fields.\n            field_kwargs.pop('allow_blank', None)\n\n        is_django_jsonfield = hasattr(models, 'JSONField') and isinstance(model_field, models.JSONField)\n        if (postgres_fields and isinstance(model_field, postgres_fields.JSONField)) or is_django_jsonfield:\n            # Populate the `encoder` argument of `JSONField` instances generated\n            # for the model `JSONField`.\n            field_kwargs['encoder'] = getattr(model_field, 'encoder', None)\n            if is_django_jsonfield:\n                field_kwargs['decoder'] = getattr(model_field, 'decoder', None)\n\n        if postgres_fields and isinstance(model_field, postgres_fields.ArrayField):\n            # Populate the `child` argument on `ListField` instances generated\n            # for the PostgreSQL specific `ArrayField`.\n            child_model_field = model_field.base_field\n            child_field_class, child_field_kwargs = self.build_standard_field(\n                'child', child_model_field\n            )\n            field_kwargs['child'] = child_field_class(**child_field_kwargs)\n\n        return field_class, field_kwargs\n\n    def build_relational_field(self, field_name, relation_info):\n        \"\"\"\n        Create fields for forward and reverse relationships.\n        \"\"\"\n        field_class = self.serializer_related_field\n        field_kwargs = get_relation_kwargs(field_name, relation_info)\n\n        to_field = field_kwargs.pop('to_field', None)\n        if to_field and not relation_info.reverse and not relation_info.related_model._meta.get_field(to_field).primary_key:\n            field_kwargs['slug_field'] = to_field\n            field_class = self.serializer_related_to_field\n\n        # `view_name` is only valid for hyperlinked relationships.\n        if not issubclass(field_class, HyperlinkedRelatedField):\n            field_kwargs.pop('view_name', None)\n\n        return field_class, field_kwargs\n\n    def build_nested_field(self, field_name, relation_info, nested_depth):\n        \"\"\"\n        Create nested fields for forward and reverse relationships.\n        \"\"\"\n        class NestedSerializer(ModelSerializer):\n            class Meta:\n                model = relation_info.related_model\n                depth = nested_depth - 1\n                fields = '__all__'\n\n        field_class = NestedSerializer\n        field_kwargs = get_nested_relation_kwargs(relation_info)\n\n        return field_class, field_kwargs\n\n    def build_property_field(self, field_name, model_class):\n        \"\"\"\n        Create a read only field for model methods and properties.\n        \"\"\"\n        field_class = ReadOnlyField\n        field_kwargs = {}\n\n        return field_class, field_kwargs\n\n    def build_url_field(self, field_name, model_class):\n        \"\"\"\n        Create a field representing the object's own URL.\n        \"\"\"\n        field_class = self.serializer_url_field\n        field_kwargs = get_url_kwargs(model_class)\n\n        return field_class, field_kwargs\n\n    def build_unknown_field(self, field_name, model_class):\n        \"\"\"\n        Raise an error on any unknown fields.\n        \"\"\"\n        raise ImproperlyConfigured(\n            'Field name `%s` is not valid for model `%s` in `%s.%s`.' %\n            (field_name, model_class.__name__, self.__class__.__module__, self.__class__.__name__)\n        )\n\n    def include_extra_kwargs(self, kwargs, extra_kwargs):\n        \"\"\"\n        Include any 'extra_kwargs' that have been included for this field,\n        possibly removing any incompatible existing keyword arguments.\n        \"\"\"\n        if extra_kwargs.get('read_only', False):\n            for attr in [\n                'required', 'default', 'allow_blank', 'min_length',\n                'max_length', 'min_value', 'max_value', 'validators', 'queryset'\n            ]:\n                kwargs.pop(attr, None)\n\n        if extra_kwargs.get('default') and kwargs.get('required') is False:\n            kwargs.pop('required')\n\n        if extra_kwargs.get('read_only', kwargs.get('read_only', False)):\n            extra_kwargs.pop('required', None)  # Read only fields should always omit the 'required' argument.\n\n        kwargs.update(extra_kwargs)\n\n        return kwargs\n\n    # Methods for determining additional keyword arguments to apply...\n\n    def get_extra_kwargs(self):\n        \"\"\"\n        Return a dictionary mapping field names to a dictionary of\n        additional keyword arguments.\n        \"\"\"\n        extra_kwargs = copy.deepcopy(getattr(self.Meta, 'extra_kwargs', {}))\n\n        read_only_fields = getattr(self.Meta, 'read_only_fields', None)\n        if read_only_fields is not None:\n            if not isinstance(read_only_fields, (list, tuple)):\n                raise TypeError(\n                    'The `read_only_fields` option must be a list or tuple. '\n                    'Got %s.' % type(read_only_fields).__name__\n                )\n            for field_name in read_only_fields:\n                kwargs = extra_kwargs.get(field_name, {})\n                kwargs['read_only'] = True\n                extra_kwargs[field_name] = kwargs\n\n        else:\n            # Guard against the possible misspelling `readonly_fields` (used\n            # by the Django admin and others).\n            assert not hasattr(self.Meta, 'readonly_fields'), (\n                'Serializer `%s.%s` has field `readonly_fields`; '\n                'the correct spelling for the option is `read_only_fields`.' %\n                (self.__class__.__module__, self.__class__.__name__)\n            )\n\n        return extra_kwargs\n\n    def get_unique_together_constraints(self, model):\n        \"\"\"\n        Returns iterator of (fields, queryset, condition_fields, condition),\n        each entry describes an unique together constraint on `fields` in `queryset`\n        with respect of constraint's `condition`.\n        \"\"\"\n        for parent_class in [model] + list(model._meta.parents):\n            for unique_together in parent_class._meta.unique_together:\n                yield unique_together, model._default_manager, [], None\n            for constraint in parent_class._meta.constraints:\n                if isinstance(constraint, models.UniqueConstraint) and len(constraint.fields) > 1:\n                    if constraint.condition is None:\n                        condition_fields = []\n                    else:\n                        condition_fields = list(get_referenced_base_fields_from_q(constraint.condition))\n                    yield (constraint.fields, model._default_manager, condition_fields, constraint.condition)\n\n    def get_uniqueness_extra_kwargs(self, field_names, declared_fields, extra_kwargs):\n        \"\"\"\n        Return any additional field options that need to be included as a\n        result of uniqueness constraints on the model. This is returned as\n        a two-tuple of:\n\n        ('dict of updated extra kwargs', 'mapping of hidden fields')\n        \"\"\"\n        if getattr(self.Meta, 'validators', None) is not None:\n            return (extra_kwargs, {})\n\n        model = getattr(self.Meta, 'model')\n        model_fields = self._get_model_fields(\n            field_names, declared_fields, extra_kwargs\n        )\n\n        # Determine if we need any additional `HiddenField` or extra keyword\n        # arguments to deal with `unique_for` dates that are required to\n        # be in the input data in order to validate it.\n        unique_constraint_names = set()\n\n        for model_field in model_fields.values():\n            # Include each of the `unique_for_*` field names.\n            unique_constraint_names |= {model_field.unique_for_date, model_field.unique_for_month,\n                                        model_field.unique_for_year}\n\n        unique_constraint_names -= {None}\n        model_fields_names = set(model_fields.keys())\n\n        # Include each of the `unique_together` and `UniqueConstraint` field names,\n        # so long as all the field names are included on the serializer.\n        for unique_together_list, queryset, condition_fields, condition in self.get_unique_together_constraints(model):\n            unique_together_list_and_condition_fields = set(unique_together_list) | set(condition_fields)\n            if model_fields_names.issuperset(unique_together_list_and_condition_fields):\n                unique_constraint_names |= unique_together_list_and_condition_fields\n\n        # Now we have all the field names that have uniqueness constraints\n        # applied, we can add the extra 'required=...' or 'default=...'\n        # arguments that are appropriate to these fields, or add a `HiddenField` for it.\n        hidden_fields = {}\n        uniqueness_extra_kwargs = {}\n\n        for unique_constraint_name in unique_constraint_names:\n            # Get the model field that is referred too.\n            unique_constraint_field = model._meta.get_field(unique_constraint_name)\n\n            if getattr(unique_constraint_field, 'auto_now_add', None):\n                default = CreateOnlyDefault(timezone.now)\n            elif getattr(unique_constraint_field, 'auto_now', None):\n                default = timezone.now\n            elif unique_constraint_field.has_default():\n                default = unique_constraint_field.default\n            elif unique_constraint_field.null:\n                default = None\n            else:\n                default = empty\n\n            if unique_constraint_name in model_fields:\n                # The corresponding field is present in the serializer\n                if default is empty:\n                    uniqueness_extra_kwargs[unique_constraint_name] = {'required': True}\n                else:\n                    uniqueness_extra_kwargs[unique_constraint_name] = {'default': default}\n            elif default is not empty:\n                # The corresponding field is not present in the\n                # serializer. We have a default to use for it, so\n                # add in a hidden field that populates it.\n                hidden_fields[unique_constraint_name] = HiddenField(default=default)\n\n        # Update `extra_kwargs` with any new options.\n        for key, value in uniqueness_extra_kwargs.items():\n            if key in extra_kwargs:\n                value.update(extra_kwargs[key])\n            extra_kwargs[key] = value\n\n        return extra_kwargs, hidden_fields\n\n    def _get_model_fields(self, field_names, declared_fields, extra_kwargs):\n        \"\"\"\n        Returns all the model fields that are being mapped to by fields\n        on the serializer class.\n        Returned as a dict of 'model field name' -> 'model field'.\n        Used internally by `get_uniqueness_field_options`.\n        \"\"\"\n        model = getattr(self.Meta, 'model')\n        model_fields = {}\n\n        for field_name in field_names:\n            if field_name in declared_fields:\n                # If the field is declared on the serializer\n                field = declared_fields[field_name]\n                source = field.source or field_name\n            else:\n                try:\n                    source = extra_kwargs[field_name]['source']\n                except KeyError:\n                    source = field_name\n\n            if '.' in source or source == '*':\n                # Model fields will always have a simple source mapping,\n                # they can't be nested attribute lookups.\n                continue\n\n            with contextlib.suppress(FieldDoesNotExist):\n                field = model._meta.get_field(source)\n                if isinstance(field, DjangoModelField):\n                    model_fields[source] = field\n\n        return model_fields\n\n    # Determine the validators to apply...\n\n    def get_validators(self):\n        \"\"\"\n        Determine the set of validators to use when instantiating serializer.\n        \"\"\"\n        # If the validators have been declared explicitly then use that.\n        validators = getattr(getattr(self, 'Meta', None), 'validators', None)\n        if validators is not None:\n            return list(validators)\n\n        # Otherwise use the default set of validators.\n        return (\n            self.get_unique_together_validators() +\n            self.get_unique_for_date_validators()\n        )\n\n    def _get_constraint_violation_error_message(self, constraint):\n        \"\"\"\n        Returns the violation error message for the UniqueConstraint,\n        or None if the message is the default.\n        \"\"\"\n        violation_error_message = constraint.get_violation_error_message()\n        default_error_message = constraint.default_violation_error_message % {\"name\": constraint.name}\n        if violation_error_message == default_error_message:\n            return None\n        return violation_error_message\n\n    def get_unique_together_validators(self):\n        \"\"\"\n        Determine a default set of validators for any unique_together constraints.\n        \"\"\"\n        # The field names we're passing though here only include fields\n        # which may map onto a model field. Any dotted field name lookups\n        # cannot map to a field, and must be a traversal, so we're not\n        # including those.\n        field_sources = {\n            field.field_name: field.source for field in self._writable_fields\n            if (field.source != '*') and ('.' not in field.source)\n        }\n\n        # Special Case: Add read_only fields with defaults.\n        field_sources.update({\n            field.field_name: field.source for field in self.fields.values()\n            if (field.read_only) and (field.default != empty) and (field.source != '*') and ('.' not in field.source)\n        })\n\n        # Invert so we can find the serializer field names that correspond to\n        # the model field names in the unique_together sets. This also allows\n        # us to check that multiple fields don't map to the same source.\n        source_map = defaultdict(list)\n        for name, source in field_sources.items():\n            source_map[source].append(name)\n\n        unique_constraint_by_fields = {\n            constraint.fields: constraint\n            for model_cls in (*self.Meta.model._meta.parents, self.Meta.model)\n            for constraint in model_cls._meta.constraints\n            if isinstance(constraint, models.UniqueConstraint)\n        }\n\n        # Note that we make sure to check `unique_together` both on the\n        # base model class, but also on any parent classes.\n        validators = []\n        for unique_together, queryset, condition_fields, condition in self.get_unique_together_constraints(self.Meta.model):\n            # Skip if serializer does not map to all unique together sources\n            unique_together_and_condition_fields = set(unique_together) | set(condition_fields)\n            if not set(source_map).issuperset(unique_together_and_condition_fields):\n                continue\n\n            for source in unique_together_and_condition_fields:\n                assert len(source_map[source]) == 1, (\n                    \"Unable to create `UniqueTogetherValidator` for \"\n                    \"`{model}.{field}` as `{serializer}` has multiple \"\n                    \"fields ({fields}) that map to this model field. \"\n                    \"Either remove the extra fields, or override \"\n                    \"`Meta.validators` with a `UniqueTogetherValidator` \"\n                    \"using the desired field names.\"\n                    .format(\n                        model=self.Meta.model.__name__,\n                        serializer=self.__class__.__name__,\n                        field=source,\n                        fields=', '.join(source_map[source]),\n                    )\n                )\n\n            field_names = tuple(source_map[f][0] for f in unique_together)\n\n            constraint = unique_constraint_by_fields.get(tuple(unique_together))\n            violation_error_message = self._get_constraint_violation_error_message(constraint) if constraint else None\n\n            validator = UniqueTogetherValidator(\n                queryset=queryset,\n                fields=field_names,\n                condition_fields=tuple(source_map[f][0] for f in condition_fields),\n                condition=condition,\n                message=violation_error_message,\n                code=getattr(constraint, 'violation_error_code', None),\n            )\n            validators.append(validator)\n        return validators\n\n    def get_unique_for_date_validators(self):\n        \"\"\"\n        Determine a default set of validators for the following constraints:\n\n        * unique_for_date\n        * unique_for_month\n        * unique_for_year\n        \"\"\"\n        info = model_meta.get_field_info(self.Meta.model)\n        default_manager = self.Meta.model._default_manager\n        field_names = [field.source for field in self.fields.values()]\n\n        validators = []\n\n        for field_name, field in info.fields_and_pk.items():\n            if field.unique_for_date and field_name in field_names:\n                validator = UniqueForDateValidator(\n                    queryset=default_manager,\n                    field=field_name,\n                    date_field=field.unique_for_date\n                )\n                validators.append(validator)\n\n            if field.unique_for_month and field_name in field_names:\n                validator = UniqueForMonthValidator(\n                    queryset=default_manager,\n                    field=field_name,\n                    date_field=field.unique_for_month\n                )\n                validators.append(validator)\n\n            if field.unique_for_year and field_name in field_names:\n                validator = UniqueForYearValidator(\n                    queryset=default_manager,\n                    field=field_name,\n                    date_field=field.unique_for_year\n                )\n                validators.append(validator)\n\n        return validators\n\n\nclass HyperlinkedModelSerializer(ModelSerializer):\n    \"\"\"\n    A type of `ModelSerializer` that uses hyperlinked relationships instead\n    of primary key relationships. Specifically:\n\n    * A 'url' field is included instead of the 'id' field.\n    * Relationships to other instances are hyperlinks, instead of primary keys.\n    \"\"\"\n    serializer_related_field = HyperlinkedRelatedField\n\n    def get_default_field_names(self, declared_fields, model_info):\n        \"\"\"\n        Return the default list of field names that will be used if the\n        `Meta.fields` option is not specified.\n        \"\"\"\n        return (\n            [self.url_field_name] +\n            list(declared_fields) +\n            list(model_info.fields) +\n            list(model_info.forward_relations)\n        )\n\n    def build_nested_field(self, field_name, relation_info, nested_depth):\n        \"\"\"\n        Create nested fields for forward and reverse relationships.\n        \"\"\"\n        class NestedSerializer(HyperlinkedModelSerializer):\n            class Meta:\n                model = relation_info.related_model\n                depth = nested_depth - 1\n                fields = '__all__'\n\n        field_class = NestedSerializer\n        field_kwargs = get_nested_relation_kwargs(relation_info)\n\n        return field_class, field_kwargs\n"
  },
  {
    "path": "rest_framework/settings.py",
    "content": "\"\"\"\nSettings for REST framework are all namespaced in the REST_FRAMEWORK setting.\nFor example your project's `settings.py` file might look like this:\n\nREST_FRAMEWORK = {\n    'DEFAULT_RENDERER_CLASSES': [\n        'rest_framework.renderers.JSONRenderer',\n        'rest_framework.renderers.TemplateHTMLRenderer',\n    ],\n    'DEFAULT_PARSER_CLASSES': [\n        'rest_framework.parsers.JSONParser',\n        'rest_framework.parsers.FormParser',\n        'rest_framework.parsers.MultiPartParser',\n    ],\n}\n\nThis module provides the `api_setting` object, that is used to access\nREST framework settings, checking for user settings first, then falling\nback to the defaults.\n\"\"\"\nfrom django.conf import settings\n# Import from `django.core.signals` instead of the official location\n# `django.test.signals` to avoid importing the test module unnecessarily.\nfrom django.core.signals import setting_changed\nfrom django.utils.module_loading import import_string\n\nfrom rest_framework import DJANGO_DURATION_FORMAT, ISO_8601\n\nDEFAULTS = {\n    # Base API policies\n    'DEFAULT_RENDERER_CLASSES': [\n        'rest_framework.renderers.JSONRenderer',\n        'rest_framework.renderers.BrowsableAPIRenderer',\n    ],\n    'DEFAULT_PARSER_CLASSES': [\n        'rest_framework.parsers.JSONParser',\n        'rest_framework.parsers.FormParser',\n        'rest_framework.parsers.MultiPartParser'\n    ],\n    'DEFAULT_AUTHENTICATION_CLASSES': [\n        'rest_framework.authentication.SessionAuthentication',\n        'rest_framework.authentication.BasicAuthentication'\n    ],\n    'DEFAULT_PERMISSION_CLASSES': [\n        'rest_framework.permissions.AllowAny',\n    ],\n    'DEFAULT_THROTTLE_CLASSES': [],\n    'DEFAULT_CONTENT_NEGOTIATION_CLASS': 'rest_framework.negotiation.DefaultContentNegotiation',\n    'DEFAULT_METADATA_CLASS': 'rest_framework.metadata.SimpleMetadata',\n    'DEFAULT_VERSIONING_CLASS': None,\n\n    # Generic view behavior\n    'DEFAULT_PAGINATION_CLASS': None,\n    'DEFAULT_FILTER_BACKENDS': [],\n\n    # Schema\n    'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.openapi.AutoSchema',\n\n    # Throttling\n    'DEFAULT_THROTTLE_RATES': {\n        'user': None,\n        'anon': None,\n    },\n    'NUM_PROXIES': None,\n\n    # Pagination\n    'PAGE_SIZE': None,\n\n    # Filtering\n    'SEARCH_PARAM': 'search',\n    'ORDERING_PARAM': 'ordering',\n\n    # Versioning\n    'DEFAULT_VERSION': None,\n    'ALLOWED_VERSIONS': None,\n    'VERSION_PARAM': 'version',\n\n    # Authentication\n    'UNAUTHENTICATED_USER': 'django.contrib.auth.models.AnonymousUser',\n    'UNAUTHENTICATED_TOKEN': None,\n\n    # View configuration\n    'VIEW_NAME_FUNCTION': 'rest_framework.views.get_view_name',\n    'VIEW_DESCRIPTION_FUNCTION': 'rest_framework.views.get_view_description',\n\n    # Exception handling\n    'EXCEPTION_HANDLER': 'rest_framework.views.exception_handler',\n    'NON_FIELD_ERRORS_KEY': 'non_field_errors',\n\n    # Testing\n    'TEST_REQUEST_RENDERER_CLASSES': [\n        'rest_framework.renderers.MultiPartRenderer',\n        'rest_framework.renderers.JSONRenderer'\n    ],\n    'TEST_REQUEST_DEFAULT_FORMAT': 'multipart',\n\n    # Hyperlink settings\n    'URL_FORMAT_OVERRIDE': 'format',\n    'FORMAT_SUFFIX_KWARG': 'format',\n    'URL_FIELD_NAME': 'url',\n\n    # Input and output formats\n    'DATE_FORMAT': ISO_8601,\n    'DATE_INPUT_FORMATS': [ISO_8601],\n\n    'DATETIME_FORMAT': ISO_8601,\n    'DATETIME_INPUT_FORMATS': [ISO_8601],\n\n    'TIME_FORMAT': ISO_8601,\n    'TIME_INPUT_FORMATS': [ISO_8601],\n\n    'DURATION_FORMAT': DJANGO_DURATION_FORMAT,\n\n    # Encoding\n    'UNICODE_JSON': True,\n    'COMPACT_JSON': True,\n    'STRICT_JSON': True,\n    'COERCE_DECIMAL_TO_STRING': True,\n    'COERCE_BIGINT_TO_STRING': False,\n    'UPLOADED_FILES_USE_URL': True,\n\n    # Browsable API\n    'HTML_SELECT_CUTOFF': 1000,\n    'HTML_SELECT_CUTOFF_TEXT': \"More than {count} items...\",\n\n    # Schemas\n    'SCHEMA_COERCE_PATH_PK': True,\n    'SCHEMA_COERCE_METHOD_NAMES': {\n        'retrieve': 'read',\n        'destroy': 'delete'\n    },\n}\n\n\n# List of settings that may be in string import notation.\nIMPORT_STRINGS = [\n    'DEFAULT_RENDERER_CLASSES',\n    'DEFAULT_PARSER_CLASSES',\n    'DEFAULT_AUTHENTICATION_CLASSES',\n    'DEFAULT_PERMISSION_CLASSES',\n    'DEFAULT_THROTTLE_CLASSES',\n    'DEFAULT_CONTENT_NEGOTIATION_CLASS',\n    'DEFAULT_METADATA_CLASS',\n    'DEFAULT_VERSIONING_CLASS',\n    'DEFAULT_PAGINATION_CLASS',\n    'DEFAULT_FILTER_BACKENDS',\n    'DEFAULT_SCHEMA_CLASS',\n    'EXCEPTION_HANDLER',\n    'TEST_REQUEST_RENDERER_CLASSES',\n    'UNAUTHENTICATED_USER',\n    'UNAUTHENTICATED_TOKEN',\n    'VIEW_NAME_FUNCTION',\n    'VIEW_DESCRIPTION_FUNCTION'\n]\n\n\n# List of settings that have been removed\nREMOVED_SETTINGS = [\n    'PAGINATE_BY', 'PAGINATE_BY_PARAM', 'MAX_PAGINATE_BY',\n]\n\n\ndef perform_import(val, setting_name):\n    \"\"\"\n    If the given setting is a string import notation,\n    then perform the necessary import or imports.\n    \"\"\"\n    if val is None:\n        return None\n    elif isinstance(val, str):\n        return import_from_string(val, setting_name)\n    elif isinstance(val, (list, tuple)):\n        return [import_from_string(item, setting_name) for item in val]\n    return val\n\n\ndef import_from_string(val, setting_name):\n    \"\"\"\n    Attempt to import a class from a string representation.\n    \"\"\"\n    try:\n        return import_string(val)\n    except ImportError as e:\n        msg = \"Could not import '%s' for API setting '%s'. %s: %s.\" % (val, setting_name, e.__class__.__name__, e)\n        raise ImportError(msg)\n\n\nclass APISettings:\n    \"\"\"\n    A settings object that allows REST Framework settings to be accessed as\n    properties. For example:\n\n        from rest_framework.settings import api_settings\n        print(api_settings.DEFAULT_RENDERER_CLASSES)\n\n    Any setting with string import paths will be automatically resolved\n    and return the class, rather than the string literal.\n\n    Note:\n    This is an internal class that is only compatible with settings namespaced\n    under the REST_FRAMEWORK name. It is not intended to be used by 3rd-party\n    apps, and test helpers like `override_settings` may not work as expected.\n    \"\"\"\n    def __init__(self, user_settings=None, defaults=None, import_strings=None):\n        if user_settings:\n            self._user_settings = self.__check_user_settings(user_settings)\n        self.defaults = defaults or DEFAULTS\n        self.import_strings = import_strings or IMPORT_STRINGS\n        self._cached_attrs = set()\n\n    @property\n    def user_settings(self):\n        if not hasattr(self, '_user_settings'):\n            self._user_settings = getattr(settings, 'REST_FRAMEWORK', {})\n        return self._user_settings\n\n    def __getattr__(self, attr):\n        if attr not in self.defaults:\n            raise AttributeError(\"Invalid API setting: '%s'\" % attr)\n\n        try:\n            # Check if present in user settings\n            val = self.user_settings[attr]\n        except KeyError:\n            # Fall back to defaults\n            val = self.defaults[attr]\n\n        # Coerce import strings into classes\n        if attr in self.import_strings:\n            val = perform_import(val, attr)\n\n        # Cache the result\n        self._cached_attrs.add(attr)\n        setattr(self, attr, val)\n        return val\n\n    def __check_user_settings(self, user_settings):\n        SETTINGS_DOC = \"https://www.django-rest-framework.org/api-guide/settings/\"\n        for setting in REMOVED_SETTINGS:\n            if setting in user_settings:\n                raise RuntimeError(\"The '%s' setting has been removed. Please refer to '%s' for available settings.\" % (setting, SETTINGS_DOC))\n        return user_settings\n\n    def reload(self):\n        for attr in self._cached_attrs:\n            delattr(self, attr)\n        self._cached_attrs.clear()\n        if hasattr(self, '_user_settings'):\n            delattr(self, '_user_settings')\n\n\napi_settings = APISettings(None, DEFAULTS, IMPORT_STRINGS)\n\n\ndef reload_api_settings(*args, **kwargs):\n    setting = kwargs['setting']\n    if setting == 'REST_FRAMEWORK':\n        api_settings.reload()\n\n\nsetting_changed.connect(reload_api_settings)\n"
  },
  {
    "path": "rest_framework/static/rest_framework/css/bootstrap-tweaks.css",
    "content": "/*\n\nThis CSS file contains some tweaks specific to the included Bootstrap theme.\nIt's separate from `style.css` so that it can be easily overridden by replacing\na single block in the template.\n\n*/\n\n.form-actions {\n  background: transparent;\n  border-top-color: transparent;\n  padding-top: 0;\n  text-align: right;\n}\n\n#generic-content-form textarea {\n  font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;\n  font-size: 80%;\n}\n\n.navbar-inverse .brand a {\n  color: #999999;\n}\n.navbar-inverse .brand:hover a {\n  color: white;\n  text-decoration: none;\n}\n\n/* custom navigation styles */\n.navbar {\n  width: 100%;\n  position: fixed;\n  left: 0;\n  top: 0;\n}\n\n.navbar {\n  background: #2C2C2C;\n  color: white;\n  border: none;\n  border-top: 5px solid #A30000;\n  border-radius: 0px;\n}\n\n.navbar .nav li, .navbar .nav li a, .navbar .brand:hover {\n  color: white;\n}\n\n.nav-list > .active > a, .nav-list > .active > a:hover {\n  background: #2C2C2C;\n}\n\n.navbar .dropdown-menu li a, .navbar .dropdown-menu li {\n  color: #A30000;\n}\n\n.navbar .dropdown-menu li a:hover {\n  background: #EEEEEE;\n  color: #C20000;\n}\n\nul.breadcrumb {\n  margin: 70px 0 0 0;\n}\n\n.breadcrumb li.active a {\n  color: #777;\n}\n\n.pagination>.disabled>a,\n.pagination>.disabled>a:hover,\n.pagination>.disabled>a:focus {\n  cursor: not-allowed;\n  pointer-events: none;\n}\n\n.pager>.disabled>a,\n.pager>.disabled>a:hover,\n.pager>.disabled>a:focus {\n  pointer-events: none;\n}\n\n.pager .next {\n  margin-left: 10px;\n}\n\n/*=== dabapps bootstrap styles ====*/\n\nhtml {\n  width:100%;\n  background: none;\n}\n\n/*body, .navbar .container-fluid {\n  max-width: 1150px;\n  margin: 0 auto;\n}*/\n\nbody {\n  background: url(\"../img/grid.png\") repeat-x;\n  background-attachment: fixed;\n}\n\n#content {\n  margin: 0;\n  padding-bottom: 60px;\n}\n\n/* sticky footer and footer */\nhtml, body {\n  height: 100%;\n}\n\n.wrapper {\n  position: relative;\n  top: 0;\n  left: 0;\n  padding-top: 60px;\n  margin: -60px 0;\n  min-height: 100%;\n}\n\n.form-switcher {\n  margin-bottom: 0;\n}\n\n.well {\n  -webkit-box-shadow: none;\n     -moz-box-shadow: none;\n          box-shadow: none;\n}\n\n.well .form-actions {\n  padding-bottom: 0;\n  margin-bottom: 0;\n}\n\n.well form {\n  margin-bottom: 0;\n}\n\n.nav-tabs {\n  border: 0;\n}\n\n.nav-tabs > li {\n  float: right;\n}\n\n.nav-tabs li a {\n  margin-right: 0;\n}\n\n.nav-tabs > .active > a {\n  background: #F5F5F5;\n}\n\n.nav-tabs > .active > a:hover {\n  background: #F5F5F5;\n}\n\n.tabbable.first-tab-active .tab-content {\n  border-top-right-radius: 0;\n}\n\nfooter {\n  position: absolute;\n  bottom: 0;\n  left: 0;\n  clear: both;\n  z-index: 10;\n  height: 60px;\n  width: 95%;\n  margin: 0 2.5%;\n}\n\nfooter p {\n  text-align: center;\n  color: gray;\n  border-top: 1px solid #DDDDDD;\n  padding-top: 10px;\n}\n\nfooter a {\n  color: gray !important;\n  font-weight: bold;\n}\n\nfooter a:hover {\n  color: gray;\n}\n\n.page-header {\n  border-bottom: none;\n  padding-bottom: 0px;\n  margin: 0;\n}\n\n/* custom general page styles */\n.hero-unit h1, .hero-unit h2 {\n  color: #A30000;\n}\n\nbody a {\n  color: #A30000;\n}\n\nbody a:hover {\n  color: #c20000;\n}\n\n.request-info {\n  clear:both;\n}\n\n.horizontal-checkbox label {\n  padding-top: 0;\n}\n\n.horizontal-checkbox label {\n  padding-top: 0 !important;\n}\n\n.horizontal-checkbox input {\n  float: left;\n  width: 20px;\n  margin-top: 3px;\n}\n\n.modal-footer form {\n  margin-left: 5px;\n  margin-right: 5px;\n}\n\n.pagination {\n  margin: 5px 0 10px 0;\n}\n"
  },
  {
    "path": "rest_framework/static/rest_framework/css/default.css",
    "content": "/* The navbar is fixed at >= 980px wide, so add padding to the body to prevent\ncontent running up underneath it. */\n\nh1 {\n  font-weight: 300;\n}\n\nh2, h3 {\n  font-weight: 300;\n}\n\n.resource-description, .response-info {\n  margin-bottom: 2em;\n}\n\n.version:before {\n  content: \"v\";\n  opacity: 0.6;\n  padding-right: 0.25em;\n}\n\n.version {\n  font-size: 70%;\n}\n\n.format-option {\n  font-family: Menlo, Consolas, \"Andale Mono\", \"Lucida Console\", monospace;\n}\n\n.button-form {\n  float: right;\n  margin-right: 1em;\n}\n\ntd.nested {\n  padding: 0 !important;\n}\n\ntd.nested > table {\n  margin: 0;\n}\n\nform select, form input:not([type=checkbox]), form textarea {\n  width: 90%;\n}\n\nform select[multiple] {\n  height: 150px;\n}\n\n/* To allow tooltips to work on disabled elements */\n.disabled-tooltip-shield {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n}\n\n.errorlist {\n  margin-top: 0.5em;\n}\n\npre {\n  overflow: auto;\n  word-wrap: normal;\n  white-space: pre;\n  font-size: 12px;\n}\n\n.page-header {\n  border-bottom: none;\n  padding-bottom: 0px;\n}\n\n#filtersModal form input[type=submit] {\n    width: auto;\n}\n\n#filtersModal .modal-body h2 {\n    margin-top: 0\n}\n"
  },
  {
    "path": "rest_framework/static/rest_framework/css/font-awesome-4.0.3.css",
    "content": "/*!\n *  Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome\n *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)\n */\n/* FONT PATH\n * -------------------------- */\n@font-face {\n  font-family: 'FontAwesome';\n  src: url('../fonts/fontawesome-webfont.eot?v=4.0.3');\n  src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');\n  font-weight: normal;\n  font-style: normal;\n}\n.fa {\n  display: inline-block;\n  font-family: FontAwesome;\n  font-style: normal;\n  font-weight: normal;\n  line-height: 1;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n/* makes the font 33% larger relative to the icon container */\n.fa-lg {\n  font-size: 1.3333333333333333em;\n  line-height: 0.75em;\n  vertical-align: -15%;\n}\n.fa-2x {\n  font-size: 2em;\n}\n.fa-3x {\n  font-size: 3em;\n}\n.fa-4x {\n  font-size: 4em;\n}\n.fa-5x {\n  font-size: 5em;\n}\n.fa-fw {\n  width: 1.2857142857142858em;\n  text-align: center;\n}\n.fa-ul {\n  padding-left: 0;\n  margin-left: 2.142857142857143em;\n  list-style-type: none;\n}\n.fa-ul > li {\n  position: relative;\n}\n.fa-li {\n  position: absolute;\n  left: -2.142857142857143em;\n  width: 2.142857142857143em;\n  top: 0.14285714285714285em;\n  text-align: center;\n}\n.fa-li.fa-lg {\n  left: -1.8571428571428572em;\n}\n.fa-border {\n  padding: .2em .25em .15em;\n  border: solid 0.08em #eeeeee;\n  border-radius: .1em;\n}\n.pull-right {\n  float: right;\n}\n.pull-left {\n  float: left;\n}\n.fa.pull-left {\n  margin-right: .3em;\n}\n.fa.pull-right {\n  margin-left: .3em;\n}\n.fa-spin {\n  -webkit-animation: spin 2s infinite linear;\n  -moz-animation: spin 2s infinite linear;\n  -o-animation: spin 2s infinite linear;\n  animation: spin 2s infinite linear;\n}\n@-moz-keyframes spin {\n  0% {\n    -moz-transform: rotate(0deg);\n  }\n  100% {\n    -moz-transform: rotate(359deg);\n  }\n}\n@-webkit-keyframes spin {\n  0% {\n    -webkit-transform: rotate(0deg);\n  }\n  100% {\n    -webkit-transform: rotate(359deg);\n  }\n}\n@-o-keyframes spin {\n  0% {\n    -o-transform: rotate(0deg);\n  }\n  100% {\n    -o-transform: rotate(359deg);\n  }\n}\n@-ms-keyframes spin {\n  0% {\n    -ms-transform: rotate(0deg);\n  }\n  100% {\n    -ms-transform: rotate(359deg);\n  }\n}\n@keyframes spin {\n  0% {\n    transform: rotate(0deg);\n  }\n  100% {\n    transform: rotate(359deg);\n  }\n}\n.fa-rotate-90 {\n  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);\n  -webkit-transform: rotate(90deg);\n  -moz-transform: rotate(90deg);\n  -ms-transform: rotate(90deg);\n  -o-transform: rotate(90deg);\n  transform: rotate(90deg);\n}\n.fa-rotate-180 {\n  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);\n  -webkit-transform: rotate(180deg);\n  -moz-transform: rotate(180deg);\n  -ms-transform: rotate(180deg);\n  -o-transform: rotate(180deg);\n  transform: rotate(180deg);\n}\n.fa-rotate-270 {\n  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);\n  -webkit-transform: rotate(270deg);\n  -moz-transform: rotate(270deg);\n  -ms-transform: rotate(270deg);\n  -o-transform: rotate(270deg);\n  transform: rotate(270deg);\n}\n.fa-flip-horizontal {\n  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);\n  -webkit-transform: scale(-1, 1);\n  -moz-transform: scale(-1, 1);\n  -ms-transform: scale(-1, 1);\n  -o-transform: scale(-1, 1);\n  transform: scale(-1, 1);\n}\n.fa-flip-vertical {\n  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);\n  -webkit-transform: scale(1, -1);\n  -moz-transform: scale(1, -1);\n  -ms-transform: scale(1, -1);\n  -o-transform: scale(1, -1);\n  transform: scale(1, -1);\n}\n.fa-stack {\n  position: relative;\n  display: inline-block;\n  width: 2em;\n  height: 2em;\n  line-height: 2em;\n  vertical-align: middle;\n}\n.fa-stack-1x,\n.fa-stack-2x {\n  position: absolute;\n  left: 0;\n  width: 100%;\n  text-align: center;\n}\n.fa-stack-1x {\n  line-height: inherit;\n}\n.fa-stack-2x {\n  font-size: 2em;\n}\n.fa-inverse {\n  color: #ffffff;\n}\n/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen\n   readers do not read off random characters that represent icons */\n.fa-glass:before {\n  content: \"\\f000\";\n}\n.fa-music:before {\n  content: \"\\f001\";\n}\n.fa-search:before {\n  content: \"\\f002\";\n}\n.fa-envelope-o:before {\n  content: \"\\f003\";\n}\n.fa-heart:before {\n  content: \"\\f004\";\n}\n.fa-star:before {\n  content: \"\\f005\";\n}\n.fa-star-o:before {\n  content: \"\\f006\";\n}\n.fa-user:before {\n  content: \"\\f007\";\n}\n.fa-film:before {\n  content: \"\\f008\";\n}\n.fa-th-large:before {\n  content: \"\\f009\";\n}\n.fa-th:before {\n  content: \"\\f00a\";\n}\n.fa-th-list:before {\n  content: \"\\f00b\";\n}\n.fa-check:before {\n  content: \"\\f00c\";\n}\n.fa-times:before {\n  content: \"\\f00d\";\n}\n.fa-search-plus:before {\n  content: \"\\f00e\";\n}\n.fa-search-minus:before {\n  content: \"\\f010\";\n}\n.fa-power-off:before {\n  content: \"\\f011\";\n}\n.fa-signal:before {\n  content: \"\\f012\";\n}\n.fa-gear:before,\n.fa-cog:before {\n  content: \"\\f013\";\n}\n.fa-trash-o:before {\n  content: \"\\f014\";\n}\n.fa-home:before {\n  content: \"\\f015\";\n}\n.fa-file-o:before {\n  content: \"\\f016\";\n}\n.fa-clock-o:before {\n  content: \"\\f017\";\n}\n.fa-road:before {\n  content: \"\\f018\";\n}\n.fa-download:before {\n  content: \"\\f019\";\n}\n.fa-arrow-circle-o-down:before {\n  content: \"\\f01a\";\n}\n.fa-arrow-circle-o-up:before {\n  content: \"\\f01b\";\n}\n.fa-inbox:before {\n  content: \"\\f01c\";\n}\n.fa-play-circle-o:before {\n  content: \"\\f01d\";\n}\n.fa-rotate-right:before,\n.fa-repeat:before {\n  content: \"\\f01e\";\n}\n.fa-refresh:before {\n  content: \"\\f021\";\n}\n.fa-list-alt:before {\n  content: \"\\f022\";\n}\n.fa-lock:before {\n  content: \"\\f023\";\n}\n.fa-flag:before {\n  content: \"\\f024\";\n}\n.fa-headphones:before {\n  content: \"\\f025\";\n}\n.fa-volume-off:before {\n  content: \"\\f026\";\n}\n.fa-volume-down:before {\n  content: \"\\f027\";\n}\n.fa-volume-up:before {\n  content: \"\\f028\";\n}\n.fa-qrcode:before {\n  content: \"\\f029\";\n}\n.fa-barcode:before {\n  content: \"\\f02a\";\n}\n.fa-tag:before {\n  content: \"\\f02b\";\n}\n.fa-tags:before {\n  content: \"\\f02c\";\n}\n.fa-book:before {\n  content: \"\\f02d\";\n}\n.fa-bookmark:before {\n  content: \"\\f02e\";\n}\n.fa-print:before {\n  content: \"\\f02f\";\n}\n.fa-camera:before {\n  content: \"\\f030\";\n}\n.fa-font:before {\n  content: \"\\f031\";\n}\n.fa-bold:before {\n  content: \"\\f032\";\n}\n.fa-italic:before {\n  content: \"\\f033\";\n}\n.fa-text-height:before {\n  content: \"\\f034\";\n}\n.fa-text-width:before {\n  content: \"\\f035\";\n}\n.fa-align-left:before {\n  content: \"\\f036\";\n}\n.fa-align-center:before {\n  content: \"\\f037\";\n}\n.fa-align-right:before {\n  content: \"\\f038\";\n}\n.fa-align-justify:before {\n  content: \"\\f039\";\n}\n.fa-list:before {\n  content: \"\\f03a\";\n}\n.fa-dedent:before,\n.fa-outdent:before {\n  content: \"\\f03b\";\n}\n.fa-indent:before {\n  content: \"\\f03c\";\n}\n.fa-video-camera:before {\n  content: \"\\f03d\";\n}\n.fa-picture-o:before {\n  content: \"\\f03e\";\n}\n.fa-pencil:before {\n  content: \"\\f040\";\n}\n.fa-map-marker:before {\n  content: \"\\f041\";\n}\n.fa-adjust:before {\n  content: \"\\f042\";\n}\n.fa-tint:before {\n  content: \"\\f043\";\n}\n.fa-edit:before,\n.fa-pencil-square-o:before {\n  content: \"\\f044\";\n}\n.fa-share-square-o:before {\n  content: \"\\f045\";\n}\n.fa-check-square-o:before {\n  content: \"\\f046\";\n}\n.fa-arrows:before {\n  content: \"\\f047\";\n}\n.fa-step-backward:before {\n  content: \"\\f048\";\n}\n.fa-fast-backward:before {\n  content: \"\\f049\";\n}\n.fa-backward:before {\n  content: \"\\f04a\";\n}\n.fa-play:before {\n  content: \"\\f04b\";\n}\n.fa-pause:before {\n  content: \"\\f04c\";\n}\n.fa-stop:before {\n  content: \"\\f04d\";\n}\n.fa-forward:before {\n  content: \"\\f04e\";\n}\n.fa-fast-forward:before {\n  content: \"\\f050\";\n}\n.fa-step-forward:before {\n  content: \"\\f051\";\n}\n.fa-eject:before {\n  content: \"\\f052\";\n}\n.fa-chevron-left:before {\n  content: \"\\f053\";\n}\n.fa-chevron-right:before {\n  content: \"\\f054\";\n}\n.fa-plus-circle:before {\n  content: \"\\f055\";\n}\n.fa-minus-circle:before {\n  content: \"\\f056\";\n}\n.fa-times-circle:before {\n  content: \"\\f057\";\n}\n.fa-check-circle:before {\n  content: \"\\f058\";\n}\n.fa-question-circle:before {\n  content: \"\\f059\";\n}\n.fa-info-circle:before {\n  content: \"\\f05a\";\n}\n.fa-crosshairs:before {\n  content: \"\\f05b\";\n}\n.fa-times-circle-o:before {\n  content: \"\\f05c\";\n}\n.fa-check-circle-o:before {\n  content: \"\\f05d\";\n}\n.fa-ban:before {\n  content: \"\\f05e\";\n}\n.fa-arrow-left:before {\n  content: \"\\f060\";\n}\n.fa-arrow-right:before {\n  content: \"\\f061\";\n}\n.fa-arrow-up:before {\n  content: \"\\f062\";\n}\n.fa-arrow-down:before {\n  content: \"\\f063\";\n}\n.fa-mail-forward:before,\n.fa-share:before {\n  content: \"\\f064\";\n}\n.fa-expand:before {\n  content: \"\\f065\";\n}\n.fa-compress:before {\n  content: \"\\f066\";\n}\n.fa-plus:before {\n  content: \"\\f067\";\n}\n.fa-minus:before {\n  content: \"\\f068\";\n}\n.fa-asterisk:before {\n  content: \"\\f069\";\n}\n.fa-exclamation-circle:before {\n  content: \"\\f06a\";\n}\n.fa-gift:before {\n  content: \"\\f06b\";\n}\n.fa-leaf:before {\n  content: \"\\f06c\";\n}\n.fa-fire:before {\n  content: \"\\f06d\";\n}\n.fa-eye:before {\n  content: \"\\f06e\";\n}\n.fa-eye-slash:before {\n  content: \"\\f070\";\n}\n.fa-warning:before,\n.fa-exclamation-triangle:before {\n  content: \"\\f071\";\n}\n.fa-plane:before {\n  content: \"\\f072\";\n}\n.fa-calendar:before {\n  content: \"\\f073\";\n}\n.fa-random:before {\n  content: \"\\f074\";\n}\n.fa-comment:before {\n  content: \"\\f075\";\n}\n.fa-magnet:before {\n  content: \"\\f076\";\n}\n.fa-chevron-up:before {\n  content: \"\\f077\";\n}\n.fa-chevron-down:before {\n  content: \"\\f078\";\n}\n.fa-retweet:before {\n  content: \"\\f079\";\n}\n.fa-shopping-cart:before {\n  content: \"\\f07a\";\n}\n.fa-folder:before {\n  content: \"\\f07b\";\n}\n.fa-folder-open:before {\n  content: \"\\f07c\";\n}\n.fa-arrows-v:before {\n  content: \"\\f07d\";\n}\n.fa-arrows-h:before {\n  content: \"\\f07e\";\n}\n.fa-bar-chart-o:before {\n  content: \"\\f080\";\n}\n.fa-twitter-square:before {\n  content: \"\\f081\";\n}\n.fa-facebook-square:before {\n  content: \"\\f082\";\n}\n.fa-camera-retro:before {\n  content: \"\\f083\";\n}\n.fa-key:before {\n  content: \"\\f084\";\n}\n.fa-gears:before,\n.fa-cogs:before {\n  content: \"\\f085\";\n}\n.fa-comments:before {\n  content: \"\\f086\";\n}\n.fa-thumbs-o-up:before {\n  content: \"\\f087\";\n}\n.fa-thumbs-o-down:before {\n  content: \"\\f088\";\n}\n.fa-star-half:before {\n  content: \"\\f089\";\n}\n.fa-heart-o:before {\n  content: \"\\f08a\";\n}\n.fa-sign-out:before {\n  content: \"\\f08b\";\n}\n.fa-linkedin-square:before {\n  content: \"\\f08c\";\n}\n.fa-thumb-tack:before {\n  content: \"\\f08d\";\n}\n.fa-external-link:before {\n  content: \"\\f08e\";\n}\n.fa-sign-in:before {\n  content: \"\\f090\";\n}\n.fa-trophy:before {\n  content: \"\\f091\";\n}\n.fa-github-square:before {\n  content: \"\\f092\";\n}\n.fa-upload:before {\n  content: \"\\f093\";\n}\n.fa-lemon-o:before {\n  content: \"\\f094\";\n}\n.fa-phone:before {\n  content: \"\\f095\";\n}\n.fa-square-o:before {\n  content: \"\\f096\";\n}\n.fa-bookmark-o:before {\n  content: \"\\f097\";\n}\n.fa-phone-square:before {\n  content: \"\\f098\";\n}\n.fa-twitter:before {\n  content: \"\\f099\";\n}\n.fa-facebook:before {\n  content: \"\\f09a\";\n}\n.fa-github:before {\n  content: \"\\f09b\";\n}\n.fa-unlock:before {\n  content: \"\\f09c\";\n}\n.fa-credit-card:before {\n  content: \"\\f09d\";\n}\n.fa-rss:before {\n  content: \"\\f09e\";\n}\n.fa-hdd-o:before {\n  content: \"\\f0a0\";\n}\n.fa-bullhorn:before {\n  content: \"\\f0a1\";\n}\n.fa-bell:before {\n  content: \"\\f0f3\";\n}\n.fa-certificate:before {\n  content: \"\\f0a3\";\n}\n.fa-hand-o-right:before {\n  content: \"\\f0a4\";\n}\n.fa-hand-o-left:before {\n  content: \"\\f0a5\";\n}\n.fa-hand-o-up:before {\n  content: \"\\f0a6\";\n}\n.fa-hand-o-down:before {\n  content: \"\\f0a7\";\n}\n.fa-arrow-circle-left:before {\n  content: \"\\f0a8\";\n}\n.fa-arrow-circle-right:before {\n  content: \"\\f0a9\";\n}\n.fa-arrow-circle-up:before {\n  content: \"\\f0aa\";\n}\n.fa-arrow-circle-down:before {\n  content: \"\\f0ab\";\n}\n.fa-globe:before {\n  content: \"\\f0ac\";\n}\n.fa-wrench:before {\n  content: \"\\f0ad\";\n}\n.fa-tasks:before {\n  content: \"\\f0ae\";\n}\n.fa-filter:before {\n  content: \"\\f0b0\";\n}\n.fa-briefcase:before {\n  content: \"\\f0b1\";\n}\n.fa-arrows-alt:before {\n  content: \"\\f0b2\";\n}\n.fa-group:before,\n.fa-users:before {\n  content: \"\\f0c0\";\n}\n.fa-chain:before,\n.fa-link:before {\n  content: \"\\f0c1\";\n}\n.fa-cloud:before {\n  content: \"\\f0c2\";\n}\n.fa-flask:before {\n  content: \"\\f0c3\";\n}\n.fa-cut:before,\n.fa-scissors:before {\n  content: \"\\f0c4\";\n}\n.fa-copy:before,\n.fa-files-o:before {\n  content: \"\\f0c5\";\n}\n.fa-paperclip:before {\n  content: \"\\f0c6\";\n}\n.fa-save:before,\n.fa-floppy-o:before {\n  content: \"\\f0c7\";\n}\n.fa-square:before {\n  content: \"\\f0c8\";\n}\n.fa-bars:before {\n  content: \"\\f0c9\";\n}\n.fa-list-ul:before {\n  content: \"\\f0ca\";\n}\n.fa-list-ol:before {\n  content: \"\\f0cb\";\n}\n.fa-strikethrough:before {\n  content: \"\\f0cc\";\n}\n.fa-underline:before {\n  content: \"\\f0cd\";\n}\n.fa-table:before {\n  content: \"\\f0ce\";\n}\n.fa-magic:before {\n  content: \"\\f0d0\";\n}\n.fa-truck:before {\n  content: \"\\f0d1\";\n}\n.fa-pinterest:before {\n  content: \"\\f0d2\";\n}\n.fa-pinterest-square:before {\n  content: \"\\f0d3\";\n}\n.fa-google-plus-square:before {\n  content: \"\\f0d4\";\n}\n.fa-google-plus:before {\n  content: \"\\f0d5\";\n}\n.fa-money:before {\n  content: \"\\f0d6\";\n}\n.fa-caret-down:before {\n  content: \"\\f0d7\";\n}\n.fa-caret-up:before {\n  content: \"\\f0d8\";\n}\n.fa-caret-left:before {\n  content: \"\\f0d9\";\n}\n.fa-caret-right:before {\n  content: \"\\f0da\";\n}\n.fa-columns:before {\n  content: \"\\f0db\";\n}\n.fa-unsorted:before,\n.fa-sort:before {\n  content: \"\\f0dc\";\n}\n.fa-sort-down:before,\n.fa-sort-asc:before {\n  content: \"\\f0dd\";\n}\n.fa-sort-up:before,\n.fa-sort-desc:before {\n  content: \"\\f0de\";\n}\n.fa-envelope:before {\n  content: \"\\f0e0\";\n}\n.fa-linkedin:before {\n  content: \"\\f0e1\";\n}\n.fa-rotate-left:before,\n.fa-undo:before {\n  content: \"\\f0e2\";\n}\n.fa-legal:before,\n.fa-gavel:before {\n  content: \"\\f0e3\";\n}\n.fa-dashboard:before,\n.fa-tachometer:before {\n  content: \"\\f0e4\";\n}\n.fa-comment-o:before {\n  content: \"\\f0e5\";\n}\n.fa-comments-o:before {\n  content: \"\\f0e6\";\n}\n.fa-flash:before,\n.fa-bolt:before {\n  content: \"\\f0e7\";\n}\n.fa-sitemap:before {\n  content: \"\\f0e8\";\n}\n.fa-umbrella:before {\n  content: \"\\f0e9\";\n}\n.fa-paste:before,\n.fa-clipboard:before {\n  content: \"\\f0ea\";\n}\n.fa-lightbulb-o:before {\n  content: \"\\f0eb\";\n}\n.fa-exchange:before {\n  content: \"\\f0ec\";\n}\n.fa-cloud-download:before {\n  content: \"\\f0ed\";\n}\n.fa-cloud-upload:before {\n  content: \"\\f0ee\";\n}\n.fa-user-md:before {\n  content: \"\\f0f0\";\n}\n.fa-stethoscope:before {\n  content: \"\\f0f1\";\n}\n.fa-suitcase:before {\n  content: \"\\f0f2\";\n}\n.fa-bell-o:before {\n  content: \"\\f0a2\";\n}\n.fa-coffee:before {\n  content: \"\\f0f4\";\n}\n.fa-cutlery:before {\n  content: \"\\f0f5\";\n}\n.fa-file-text-o:before {\n  content: \"\\f0f6\";\n}\n.fa-building-o:before {\n  content: \"\\f0f7\";\n}\n.fa-hospital-o:before {\n  content: \"\\f0f8\";\n}\n.fa-ambulance:before {\n  content: \"\\f0f9\";\n}\n.fa-medkit:before {\n  content: \"\\f0fa\";\n}\n.fa-fighter-jet:before {\n  content: \"\\f0fb\";\n}\n.fa-beer:before {\n  content: \"\\f0fc\";\n}\n.fa-h-square:before {\n  content: \"\\f0fd\";\n}\n.fa-plus-square:before {\n  content: \"\\f0fe\";\n}\n.fa-angle-double-left:before {\n  content: \"\\f100\";\n}\n.fa-angle-double-right:before {\n  content: \"\\f101\";\n}\n.fa-angle-double-up:before {\n  content: \"\\f102\";\n}\n.fa-angle-double-down:before {\n  content: \"\\f103\";\n}\n.fa-angle-left:before {\n  content: \"\\f104\";\n}\n.fa-angle-right:before {\n  content: \"\\f105\";\n}\n.fa-angle-up:before {\n  content: \"\\f106\";\n}\n.fa-angle-down:before {\n  content: \"\\f107\";\n}\n.fa-desktop:before {\n  content: \"\\f108\";\n}\n.fa-laptop:before {\n  content: \"\\f109\";\n}\n.fa-tablet:before {\n  content: \"\\f10a\";\n}\n.fa-mobile-phone:before,\n.fa-mobile:before {\n  content: \"\\f10b\";\n}\n.fa-circle-o:before {\n  content: \"\\f10c\";\n}\n.fa-quote-left:before {\n  content: \"\\f10d\";\n}\n.fa-quote-right:before {\n  content: \"\\f10e\";\n}\n.fa-spinner:before {\n  content: \"\\f110\";\n}\n.fa-circle:before {\n  content: \"\\f111\";\n}\n.fa-mail-reply:before,\n.fa-reply:before {\n  content: \"\\f112\";\n}\n.fa-github-alt:before {\n  content: \"\\f113\";\n}\n.fa-folder-o:before {\n  content: \"\\f114\";\n}\n.fa-folder-open-o:before {\n  content: \"\\f115\";\n}\n.fa-smile-o:before {\n  content: \"\\f118\";\n}\n.fa-frown-o:before {\n  content: \"\\f119\";\n}\n.fa-meh-o:before {\n  content: \"\\f11a\";\n}\n.fa-gamepad:before {\n  content: \"\\f11b\";\n}\n.fa-keyboard-o:before {\n  content: \"\\f11c\";\n}\n.fa-flag-o:before {\n  content: \"\\f11d\";\n}\n.fa-flag-checkered:before {\n  content: \"\\f11e\";\n}\n.fa-terminal:before {\n  content: \"\\f120\";\n}\n.fa-code:before {\n  content: \"\\f121\";\n}\n.fa-reply-all:before {\n  content: \"\\f122\";\n}\n.fa-mail-reply-all:before {\n  content: \"\\f122\";\n}\n.fa-star-half-empty:before,\n.fa-star-half-full:before,\n.fa-star-half-o:before {\n  content: \"\\f123\";\n}\n.fa-location-arrow:before {\n  content: \"\\f124\";\n}\n.fa-crop:before {\n  content: \"\\f125\";\n}\n.fa-code-fork:before {\n  content: \"\\f126\";\n}\n.fa-unlink:before,\n.fa-chain-broken:before {\n  content: \"\\f127\";\n}\n.fa-question:before {\n  content: \"\\f128\";\n}\n.fa-info:before {\n  content: \"\\f129\";\n}\n.fa-exclamation:before {\n  content: \"\\f12a\";\n}\n.fa-superscript:before {\n  content: \"\\f12b\";\n}\n.fa-subscript:before {\n  content: \"\\f12c\";\n}\n.fa-eraser:before {\n  content: \"\\f12d\";\n}\n.fa-puzzle-piece:before {\n  content: \"\\f12e\";\n}\n.fa-microphone:before {\n  content: \"\\f130\";\n}\n.fa-microphone-slash:before {\n  content: \"\\f131\";\n}\n.fa-shield:before {\n  content: \"\\f132\";\n}\n.fa-calendar-o:before {\n  content: \"\\f133\";\n}\n.fa-fire-extinguisher:before {\n  content: \"\\f134\";\n}\n.fa-rocket:before {\n  content: \"\\f135\";\n}\n.fa-maxcdn:before {\n  content: \"\\f136\";\n}\n.fa-chevron-circle-left:before {\n  content: \"\\f137\";\n}\n.fa-chevron-circle-right:before {\n  content: \"\\f138\";\n}\n.fa-chevron-circle-up:before {\n  content: \"\\f139\";\n}\n.fa-chevron-circle-down:before {\n  content: \"\\f13a\";\n}\n.fa-html5:before {\n  content: \"\\f13b\";\n}\n.fa-css3:before {\n  content: \"\\f13c\";\n}\n.fa-anchor:before {\n  content: \"\\f13d\";\n}\n.fa-unlock-alt:before {\n  content: \"\\f13e\";\n}\n.fa-bullseye:before {\n  content: \"\\f140\";\n}\n.fa-ellipsis-h:before {\n  content: \"\\f141\";\n}\n.fa-ellipsis-v:before {\n  content: \"\\f142\";\n}\n.fa-rss-square:before {\n  content: \"\\f143\";\n}\n.fa-play-circle:before {\n  content: \"\\f144\";\n}\n.fa-ticket:before {\n  content: \"\\f145\";\n}\n.fa-minus-square:before {\n  content: \"\\f146\";\n}\n.fa-minus-square-o:before {\n  content: \"\\f147\";\n}\n.fa-level-up:before {\n  content: \"\\f148\";\n}\n.fa-level-down:before {\n  content: \"\\f149\";\n}\n.fa-check-square:before {\n  content: \"\\f14a\";\n}\n.fa-pencil-square:before {\n  content: \"\\f14b\";\n}\n.fa-external-link-square:before {\n  content: \"\\f14c\";\n}\n.fa-share-square:before {\n  content: \"\\f14d\";\n}\n.fa-compass:before {\n  content: \"\\f14e\";\n}\n.fa-toggle-down:before,\n.fa-caret-square-o-down:before {\n  content: \"\\f150\";\n}\n.fa-toggle-up:before,\n.fa-caret-square-o-up:before {\n  content: \"\\f151\";\n}\n.fa-toggle-right:before,\n.fa-caret-square-o-right:before {\n  content: \"\\f152\";\n}\n.fa-euro:before,\n.fa-eur:before {\n  content: \"\\f153\";\n}\n.fa-gbp:before {\n  content: \"\\f154\";\n}\n.fa-dollar:before,\n.fa-usd:before {\n  content: \"\\f155\";\n}\n.fa-rupee:before,\n.fa-inr:before {\n  content: \"\\f156\";\n}\n.fa-cny:before,\n.fa-rmb:before,\n.fa-yen:before,\n.fa-jpy:before {\n  content: \"\\f157\";\n}\n.fa-ruble:before,\n.fa-rouble:before,\n.fa-rub:before {\n  content: \"\\f158\";\n}\n.fa-won:before,\n.fa-krw:before {\n  content: \"\\f159\";\n}\n.fa-bitcoin:before,\n.fa-btc:before {\n  content: \"\\f15a\";\n}\n.fa-file:before {\n  content: \"\\f15b\";\n}\n.fa-file-text:before {\n  content: \"\\f15c\";\n}\n.fa-sort-alpha-asc:before {\n  content: \"\\f15d\";\n}\n.fa-sort-alpha-desc:before {\n  content: \"\\f15e\";\n}\n.fa-sort-amount-asc:before {\n  content: \"\\f160\";\n}\n.fa-sort-amount-desc:before {\n  content: \"\\f161\";\n}\n.fa-sort-numeric-asc:before {\n  content: \"\\f162\";\n}\n.fa-sort-numeric-desc:before {\n  content: \"\\f163\";\n}\n.fa-thumbs-up:before {\n  content: \"\\f164\";\n}\n.fa-thumbs-down:before {\n  content: \"\\f165\";\n}\n.fa-youtube-square:before {\n  content: \"\\f166\";\n}\n.fa-youtube:before {\n  content: \"\\f167\";\n}\n.fa-xing:before {\n  content: \"\\f168\";\n}\n.fa-xing-square:before {\n  content: \"\\f169\";\n}\n.fa-youtube-play:before {\n  content: \"\\f16a\";\n}\n.fa-dropbox:before {\n  content: \"\\f16b\";\n}\n.fa-stack-overflow:before {\n  content: \"\\f16c\";\n}\n.fa-instagram:before {\n  content: \"\\f16d\";\n}\n.fa-flickr:before {\n  content: \"\\f16e\";\n}\n.fa-adn:before {\n  content: \"\\f170\";\n}\n.fa-bitbucket:before {\n  content: \"\\f171\";\n}\n.fa-bitbucket-square:before {\n  content: \"\\f172\";\n}\n.fa-tumblr:before {\n  content: \"\\f173\";\n}\n.fa-tumblr-square:before {\n  content: \"\\f174\";\n}\n.fa-long-arrow-down:before {\n  content: \"\\f175\";\n}\n.fa-long-arrow-up:before {\n  content: \"\\f176\";\n}\n.fa-long-arrow-left:before {\n  content: \"\\f177\";\n}\n.fa-long-arrow-right:before {\n  content: \"\\f178\";\n}\n.fa-apple:before {\n  content: \"\\f179\";\n}\n.fa-windows:before {\n  content: \"\\f17a\";\n}\n.fa-android:before {\n  content: \"\\f17b\";\n}\n.fa-linux:before {\n  content: \"\\f17c\";\n}\n.fa-dribbble:before {\n  content: \"\\f17d\";\n}\n.fa-skype:before {\n  content: \"\\f17e\";\n}\n.fa-foursquare:before {\n  content: \"\\f180\";\n}\n.fa-trello:before {\n  content: \"\\f181\";\n}\n.fa-female:before {\n  content: \"\\f182\";\n}\n.fa-male:before {\n  content: \"\\f183\";\n}\n.fa-gittip:before {\n  content: \"\\f184\";\n}\n.fa-sun-o:before {\n  content: \"\\f185\";\n}\n.fa-moon-o:before {\n  content: \"\\f186\";\n}\n.fa-archive:before {\n  content: \"\\f187\";\n}\n.fa-bug:before {\n  content: \"\\f188\";\n}\n.fa-vk:before {\n  content: \"\\f189\";\n}\n.fa-weibo:before {\n  content: \"\\f18a\";\n}\n.fa-renren:before {\n  content: \"\\f18b\";\n}\n.fa-pagelines:before {\n  content: \"\\f18c\";\n}\n.fa-stack-exchange:before {\n  content: \"\\f18d\";\n}\n.fa-arrow-circle-o-right:before {\n  content: \"\\f18e\";\n}\n.fa-arrow-circle-o-left:before {\n  content: \"\\f190\";\n}\n.fa-toggle-left:before,\n.fa-caret-square-o-left:before {\n  content: \"\\f191\";\n}\n.fa-dot-circle-o:before {\n  content: \"\\f192\";\n}\n.fa-wheelchair:before {\n  content: \"\\f193\";\n}\n.fa-vimeo-square:before {\n  content: \"\\f194\";\n}\n.fa-turkish-lira:before,\n.fa-try:before {\n  content: \"\\f195\";\n}\n.fa-plus-square-o:before {\n  content: \"\\f196\";\n}\n"
  },
  {
    "path": "rest_framework/static/rest_framework/css/prettify.css",
    "content": ".com { color: #93a1a1; }\n.lit { color: #195f91; }\n.pun, .opn, .clo { color: #93a1a1; }\n.fun { color: #dc322f; }\n.str, .atv { color: #D14; }\n.kwd, .prettyprint .tag { color: #1e347b; }\n.typ, .atn, .dec, .var { color: teal; }\n.pln { color: #48484c; }\n\n.prettyprint {\n  padding: 8px;\n  background-color: #f7f7f9;\n  border: 1px solid #e1e1e8;\n}\n.prettyprint.linenums {\n  -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;\n     -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;\n          box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;\n}\n\n/* Specify class=linenums on a pre to get line numbering */\nol.linenums {\n  margin: 0 0 0 33px; /* IE indents via margin-left */\n}\nol.linenums li {\n  padding-left: 12px;\n  color: #bebec5;\n  line-height: 20px;\n  text-shadow: 0 1px 0 #fff;\n}"
  },
  {
    "path": "rest_framework/static/rest_framework/js/ajax-form.js",
    "content": "function replaceDocument(docString) {\n  var doc = document.open(\"text/html\");\n\n  doc.write(docString);\n  doc.close();\n\n  if (window.djdt) {\n    // If Django Debug Toolbar is available, reinitialize it so that\n    // it can show updated panels from new `docString`.\n    window.addEventListener(\"load\", djdt.init);\n  }\n}\n\nfunction doAjaxSubmit(e) {\n  var form = $(this);\n  var btn = $(this.clk);\n  var method = (\n    btn.data('method') ||\n    form.data('method') ||\n    form.attr('method') || 'GET'\n  ).toUpperCase();\n\n  if (method === 'GET') {\n    // GET requests can always use standard form submits.\n    return;\n  }\n\n  var contentType =\n    form.find('input[data-override=\"content-type\"]').val() ||\n    form.find('select[data-override=\"content-type\"] option:selected').text();\n\n  if (method === 'POST' && !contentType) {\n    // POST requests can use standard form submits, unless we have\n    // overridden the content type.\n    return;\n  }\n\n  // At this point we need to make an AJAX form submission.\n  e.preventDefault();\n\n  var url = form.attr('action');\n  var data;\n\n  if (contentType) {\n    data = form.find('[data-override=\"content\"]').val() || ''\n\n    if (contentType === 'multipart/form-data') {\n      // We need to add a boundary parameter to the header\n      // We assume the first valid-looking boundary line in the body is correct\n      // regex is from RFC 2046 appendix A\n      var boundaryCharNoSpace = \"0-9A-Z'()+_,-./:=?\";\n      var boundaryChar = boundaryCharNoSpace + ' ';\n      var re = new RegExp('^--([' + boundaryChar + ']{0,69}[' + boundaryCharNoSpace + '])[\\\\s]*?$', 'im');\n      var boundary = data.match(re);\n      if (boundary !== null) {\n        contentType += '; boundary=\"' + boundary[1] + '\"';\n      }\n      // Fix textarea.value EOL normalisation (multipart/form-data should use CR+NL, not NL)\n      data = data.replace(/\\n/g, '\\r\\n');\n    }\n  } else {\n    contentType = form.attr('enctype') || form.attr('encoding')\n\n    if (contentType === 'multipart/form-data') {\n      if (!window.FormData) {\n        alert('Your browser does not support AJAX multipart form submissions');\n        return;\n      }\n\n      // Use the FormData API and allow the content type to be set automatically,\n      // so it includes the boundary string.\n      // See https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects\n      contentType = false;\n      data = new FormData(form[0]);\n    } else {\n      contentType = 'application/x-www-form-urlencoded; charset=UTF-8'\n      data = form.serialize();\n    }\n  }\n\n  var ret = $.ajax({\n    url: url,\n    method: method,\n    data: data,\n    contentType: contentType,\n    processData: false,\n    headers: {\n      'Accept': 'text/html; q=1.0, */*'\n    },\n  });\n\n  ret.always(function(data, textStatus, jqXHR) {\n    if (textStatus != 'success') {\n      jqXHR = data;\n    }\n\n    var responseContentType = jqXHR.getResponseHeader(\"content-type\") || \"\";\n\n    if (responseContentType.toLowerCase().indexOf('text/html') === 0) {\n      replaceDocument(jqXHR.responseText);\n\n      try {\n        // Modify the location and scroll to top, as if after page load.\n        history.replaceState({}, '', url);\n        scroll(0, 0);\n      } catch (err) {\n        // History API not supported, so redirect.\n        window.location = url;\n      }\n    } else {\n      // Not HTML content. We can't open this directly, so redirect.\n      window.location = url;\n    }\n  });\n\n  return ret;\n}\n\nfunction captureSubmittingElement(e) {\n  var target = e.target;\n  var form = this;\n\n  form.clk = target;\n}\n\n$.fn.ajaxForm = function() {\n  var options = {}\n\n  return this\n    .unbind('submit.form-plugin  click.form-plugin')\n    .bind('submit.form-plugin', options, doAjaxSubmit)\n    .bind('click.form-plugin', options, captureSubmittingElement);\n};\n"
  },
  {
    "path": "rest_framework/static/rest_framework/js/csrf.js",
    "content": "function getCookie(name) {\n  var cookieValue = null;\n\n  if (document.cookie && document.cookie != '') {\n    var cookies = document.cookie.split(';');\n\n    for (var i = 0; i < cookies.length; i++) {\n      var cookie = jQuery.trim(cookies[i]);\n\n      // Does this cookie string begin with the name we want?\n      if (cookie.substring(0, name.length + 1) == (name + '=')) {\n        cookieValue = decodeURIComponent(cookie.substring(name.length + 1));\n        break;\n      }\n    }\n  }\n\n  return cookieValue;\n}\n\nfunction csrfSafeMethod(method) {\n  // these HTTP methods do not require CSRF protection\n  return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));\n}\n\nfunction sameOrigin(url) {\n  // test that a given url is a same-origin URL\n  // url could be relative or scheme relative or absolute\n  var host = document.location.host; // host + port\n  var protocol = document.location.protocol;\n  var sr_origin = '//' + host;\n  var origin = protocol + sr_origin;\n\n  // Allow absolute or scheme relative URLs to same origin\n  return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||\n    (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') ||\n    // or any other URL that isn't scheme relative or absolute i.e relative.\n    !(/^(\\/\\/|http:|https:).*/.test(url));\n}\n\nwindow.drf = JSON.parse(document.getElementById('drf_csrf').textContent);\nvar csrftoken = window.drf.csrfToken;\n\n$.ajaxSetup({\n  beforeSend: function(xhr, settings) {\n    if (!csrfSafeMethod(settings.type) && sameOrigin(settings.url)) {\n      // Send the token to same-origin, relative URLs only.\n      // Send the token only if the method warrants CSRF protection\n      // Using the CSRFToken value acquired earlier\n      xhr.setRequestHeader(window.drf.csrfHeaderName, csrftoken);\n    }\n  }\n});\n"
  },
  {
    "path": "rest_framework/static/rest_framework/js/default.js",
    "content": "$(document).ready(function() {\n  // JSON highlighting.\n  prettyPrint();\n\n  // Bootstrap tooltips.\n  $('.js-tooltip').tooltip({\n    delay: 1000,\n    container: 'body'\n  });\n\n  // Deal with rounded tab styling after tab clicks.\n  $('a[data-toggle=\"tab\"]:first').on('shown', function(e) {\n    $(e.target).parents('.tabbable').addClass('first-tab-active');\n  });\n\n  $('a[data-toggle=\"tab\"]:not(:first)').on('shown', function(e) {\n    $(e.target).parents('.tabbable').removeClass('first-tab-active');\n  });\n\n  $('a[data-toggle=\"tab\"]').click(function() {\n    document.cookie = \"tabstyle=\" + this.name + \"; path=/\";\n  });\n\n  // Store tab preference in cookies & display appropriate tab on load.\n  var selectedTab = null;\n  var selectedTabName = getCookie('tabstyle');\n\n  if (selectedTabName) {\n    selectedTabName = selectedTabName.replace(/[^a-z-]/g, '');\n  }\n\n  if (selectedTabName) {\n    selectedTab = $('.form-switcher a[name=' + selectedTabName + ']');\n  }\n\n  if (selectedTab && selectedTab.length > 0) {\n    // Display whichever tab is selected.\n    selectedTab.tab('show');\n  } else {\n    // If no tab selected, display rightmost tab.\n    $('.form-switcher a:first').tab('show');\n  }\n\n  $(window).on('load', function() {\n    $('#errorModal').modal('show');\n  });\n});\n"
  },
  {
    "path": "rest_framework/static/rest_framework/js/load-ajax-form.js",
    "content": "$(document).ready(function() {\n  $('form').ajaxForm();\n});\n"
  },
  {
    "path": "rest_framework/static/rest_framework/js/prettify-min.js",
    "content": "var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;\n(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:\"0\"<=b&&b<=\"7\"?parseInt(a.substring(1),8):b===\"u\"||b===\"x\"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?\"\\\\x0\":\"\\\\x\")+a.toString(16);a=String.fromCharCode(a);if(a===\"\\\\\"||a===\"-\"||a===\"[\"||a===\"]\")a=\"\\\\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\\\u[\\dA-Fa-f]{4}|\\\\x[\\dA-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\S\\s]|[^\\\\]/g),a=\n[],b=[],o=f[0]===\"^\",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&\"-\"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=[\"[\"];o&&b.push(\"^\");b.push.apply(b,a);for(c=0;c<\nf.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push(\"-\"),b.push(e(i[1])));b.push(\"]\");return b.join(\"\")}function y(a){for(var f=a.source.match(/\\[(?:[^\\\\\\]]|\\\\[\\S\\s])*]|\\\\u[\\dA-Fa-f]{4}|\\\\x[\\dA-Fa-f]{2}|\\\\\\d+|\\\\[^\\dux]|\\(\\?[!:=]|[()^]|[^()[\\\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j===\"(\"?++i:\"\\\\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j===\"(\"?(++i,d[i]===void 0&&(f[c]=\"(?:\")):\"\\\\\"===j.charAt(0)&&\n(j=+j.substring(1))&&j<=i&&(f[c]=\"\\\\\"+d[i]);for(i=c=0;c<b;++c)\"^\"===f[c]&&\"^\"!==f[c+1]&&(f[c]=\"\");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a===\"[\"?f[c]=h(j):a!==\"\\\\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return\"[\"+String.fromCharCode(a&-33,a|32)+\"]\"}));return f.join(\"\")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\\\u[\\da-f]{4}|\\\\x[\\da-f]{2}|\\\\[^UXux]/gi,\"\"))){s=!0;l=!1;break}}for(var r=\n{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(\"\"+g);n.push(\"(?:\"+y(g)+\")\")}return RegExp(n.join(\"|\"),l?\"gi\":\"g\")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if(\"BR\"===g||\"LI\"===g)h[s]=\"\\n\",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\\r\\n?/g,\"\\n\"):g.replace(/[\\t\\n\\r ]+/g,\" \"),h[s]=g,t[s<<1]=y,y+=g.length,\nt[s++<<1|1]=a)}}var e=/(?:^|\\s)nocode(?:\\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue(\"white-space\"));var p=l&&\"pre\"===l.substring(0,3);m(a);return{a:h.join(\"\").replace(/\\n$/,\"\"),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,\"pln\"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===\n\"string\")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b=\"pln\")}if((c=b.length>=5&&\"lang-\"===b.substring(0,5))&&!(o&&typeof o[1]===\"string\"))c=!1,b=\"src\";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),\nl=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=\"\"+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\\S\\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push([\"str\",/^(?:'''(?:[^'\\\\]|\\\\[\\S\\s]|''?(?=[^']))*(?:'''|$)|\"\"\"(?:[^\"\\\\]|\\\\[\\S\\s]|\"\"?(?=[^\"]))*(?:\"\"\"|$)|'(?:[^'\\\\]|\\\\[\\S\\s])*(?:'|$)|\"(?:[^\"\\\\]|\\\\[\\S\\s])*(?:\"|$))/,q,\"'\\\"\"]):a.multiLineStrings?m.push([\"str\",/^(?:'(?:[^'\\\\]|\\\\[\\S\\s])*(?:'|$)|\"(?:[^\"\\\\]|\\\\[\\S\\s])*(?:\"|$)|`(?:[^\\\\`]|\\\\[\\S\\s])*(?:`|$))/,\nq,\"'\\\"`\"]):m.push([\"str\",/^(?:'(?:[^\\n\\r'\\\\]|\\\\.)*(?:'|$)|\"(?:[^\\n\\r\"\\\\]|\\\\.)*(?:\"|$))/,q,\"\\\"'\"]);a.verbatimStrings&&e.push([\"str\",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push([\"com\",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,\"#\"]):m.push([\"com\",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\\b|[^\\n\\r]*)/,q,\"#\"]),e.push([\"str\",/^<(?:(?:(?:\\.\\.\\/)*|\\/?)(?:[\\w-]+(?:\\/[\\w-]+)+)?[\\w-]+\\.h|[a-z]\\w*)>/,q])):m.push([\"com\",/^#[^\\n\\r]*/,\nq,\"#\"]));a.cStyleComments&&(e.push([\"com\",/^\\/\\/[^\\n\\r]*/,q]),e.push([\"com\",/^\\/\\*[\\S\\s]*?(?:\\*\\/|$)/,q]));a.regexLiterals&&e.push([\"lang-regex\",/^(?:^^\\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|,|-=|->|\\/|\\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\\^=|\\^\\^|\\^\\^=|{|\\||\\|=|\\|\\||\\|\\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*(\\/(?=[^*/])(?:[^/[\\\\]|\\\\[\\S\\s]|\\[(?:[^\\\\\\]]|\\\\[\\S\\s])*(?:]|$))+\\/)/]);(h=a.types)&&e.push([\"typ\",h]);a=(\"\"+a.keywords).replace(/^ | $/g,\n\"\");a.length&&e.push([\"kwd\",RegExp(\"^(?:\"+a.replace(/[\\s,]+/g,\"|\")+\")\\\\b\"),q]);m.push([\"pln\",/^\\s+/,q,\" \\r\\n\\t\\xa0\"]);e.push([\"lit\",/^@[$_a-z][\\w$@]*/i,q],[\"typ\",/^(?:[@_]?[A-Z]+[a-z][\\w$@]*|\\w+_t\\b)/,q],[\"pln\",/^[$_a-z][\\w$@]*/i,q],[\"lit\",/^(?:0x[\\da-f]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+-]?\\d+)?)[a-z]*/i,q,\"0123456789\"],[\"pln\",/^\\\\[\\S\\s]?/,q],[\"pun\",/^.[^\\s\\w\"-$'./@\\\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if(\"BR\"===a.nodeName)h(a),\na.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}\nfor(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\\s)nocode(?:\\s|$)/,t=/\\r\\n?|\\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue(\"white-space\"));var p=l&&\"pre\"===l.substring(0,3);for(l=s.createElement(\"LI\");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute(\"value\",\nm);var r=s.createElement(\"OL\");r.className=\"linenums\";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className=\"L\"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode(\"\\xa0\")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn(\"cannot override language handler %s\",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\\s*</.test(m)?\"default-markup\":\"default-code\";return A[a]}function E(a){var m=\na.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\\bMSIE\\b/.test(navigator.userAgent),m=/\\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,\"\\r\"));i.nodeValue=\nj;var u=i.ownerDocument,v=u.createElement(\"SPAN\");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){\"console\"in window&&console.log(w&&w.stack?w.stack:w)}}var v=[\"break,continue,do,else,for,if,return,while\"],w=[[v,\"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile\"],\n\"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof\"],F=[w,\"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where\"],G=[w,\"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient\"],\nH=[G,\"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var\"],w=[w,\"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN\"],I=[v,\"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None\"],\nJ=[v,\"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END\"],v=[v,\"case,done,elif,esac,eval,fi,function,in,local,set,then,until\"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\\d*)/,N=/\\S/,O=u({keywords:[F,H,w,\"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END\"+\nI,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,[\"default-code\"]);k(x([],[[\"pln\",/^[^<?]+/],[\"dec\",/^<!\\w[^>]*(?:>|$)/],[\"com\",/^<\\!--[\\S\\s]*?(?:--\\>|$)/],[\"lang-\",/^<\\?([\\S\\s]+?)(?:\\?>|$)/],[\"lang-\",/^<%([\\S\\s]+?)(?:%>|$)/],[\"pun\",/^(?:<[%?]|[%?]>)/],[\"lang-\",/^<xmp\\b[^>]*>([\\S\\s]+?)<\\/xmp\\b[^>]*>/i],[\"lang-js\",/^<script\\b[^>]*>([\\S\\s]*?)(<\\/script\\b[^>]*>)/i],[\"lang-css\",/^<style\\b[^>]*>([\\S\\s]*?)(<\\/style\\b[^>]*>)/i],[\"lang-in.tag\",/^(<\\/?[a-z][^<>]*>)/i]]),\n[\"default-markup\",\"htm\",\"html\",\"mxml\",\"xhtml\",\"xml\",\"xsl\"]);k(x([[\"pln\",/^\\s+/,q,\" \\t\\r\\n\"],[\"atv\",/^(?:\"[^\"]*\"?|'[^']*'?)/,q,\"\\\"'\"]],[[\"tag\",/^^<\\/?[a-z](?:[\\w-.:]*\\w)?|\\/?>$/i],[\"atn\",/^(?!style[\\s=]|on)[a-z](?:[\\w:-]*\\w)?/i],[\"lang-uq.val\",/^=\\s*([^\\s\"'>]*(?:[^\\s\"'/>]|\\/(?=\\s)))/],[\"pun\",/^[/<->]+/],[\"lang-js\",/^on\\w+\\s*=\\s*\"([^\"]+)\"/i],[\"lang-js\",/^on\\w+\\s*=\\s*'([^']+)'/i],[\"lang-js\",/^on\\w+\\s*=\\s*([^\\s\"'>]+)/i],[\"lang-css\",/^style\\s*=\\s*\"([^\"]+)\"/i],[\"lang-css\",/^style\\s*=\\s*'([^']+)'/i],[\"lang-css\",\n/^style\\s*=\\s*([^\\s\"'>]+)/i]]),[\"in.tag\"]);k(x([],[[\"atv\",/^[\\S\\s]+/]]),[\"uq.val\"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),[\"c\",\"cc\",\"cpp\",\"cxx\",\"cyc\",\"m\"]);k(u({keywords:\"null,true,false\"}),[\"json\"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),[\"cs\"]);k(u({keywords:G,cStyleComments:!0}),[\"java\"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),[\"bsh\",\"csh\",\"sh\"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),\n[\"cv\",\"py\"]);k(u({keywords:\"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END\",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),[\"perl\",\"pl\",\"pm\"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),[\"rb\"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),[\"js\"]);k(u({keywords:\"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes\",\nhashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),[\"coffee\"]);k(x([],[[\"str\",/^[\\S\\s]+/]]),[\"regex\"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement(\"PRE\");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf(\"prettyprint\")>=0){var k=k.match(g),f,b;if(b=\n!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&\"CODE\"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName===\"pre\"||o.tagName===\"code\"||o.tagName===\"xmp\")&&o.className&&o.className.indexOf(\"prettyprint\")>=0){b=!0;break}b||((b=(b=n.className.match(/\\blinenums\\b(?::(\\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,\n250):a&&a()}for(var e=[document.getElementsByTagName(\"pre\"),document.getElementsByTagName(\"code\"),document.getElementsByTagName(\"xmp\")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\\blang(?:uage)?-([\\w.]+)(?!\\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:\"atn\",PR_ATTRIB_VALUE:\"atv\",PR_COMMENT:\"com\",PR_DECLARATION:\"dec\",PR_KEYWORD:\"kwd\",PR_LITERAL:\"lit\",\nPR_NOCODE:\"nocode\",PR_PLAIN:\"pln\",PR_PUNCTUATION:\"pun\",PR_SOURCE:\"src\",PR_STRING:\"str\",PR_TAG:\"tag\",PR_TYPE:\"typ\"}})();\n"
  },
  {
    "path": "rest_framework/status.py",
    "content": "\"\"\"\nDescriptive HTTP status codes, for code readability.\n\nSee RFC 2616 - https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html\nAnd RFC 6585 - https://tools.ietf.org/html/rfc6585\nAnd RFC 4918 - https://tools.ietf.org/html/rfc4918\n\"\"\"\n\n\ndef is_informational(code):\n    return 100 <= code <= 199\n\n\ndef is_success(code):\n    return 200 <= code <= 299\n\n\ndef is_redirect(code):\n    return 300 <= code <= 399\n\n\ndef is_client_error(code):\n    return 400 <= code <= 499\n\n\ndef is_server_error(code):\n    return 500 <= code <= 599\n\n\nHTTP_100_CONTINUE = 100\nHTTP_101_SWITCHING_PROTOCOLS = 101\nHTTP_102_PROCESSING = 102\nHTTP_103_EARLY_HINTS = 103\nHTTP_200_OK = 200\nHTTP_201_CREATED = 201\nHTTP_202_ACCEPTED = 202\nHTTP_203_NON_AUTHORITATIVE_INFORMATION = 203\nHTTP_204_NO_CONTENT = 204\nHTTP_205_RESET_CONTENT = 205\nHTTP_206_PARTIAL_CONTENT = 206\nHTTP_207_MULTI_STATUS = 207\nHTTP_208_ALREADY_REPORTED = 208\nHTTP_226_IM_USED = 226\nHTTP_300_MULTIPLE_CHOICES = 300\nHTTP_301_MOVED_PERMANENTLY = 301\nHTTP_302_FOUND = 302\nHTTP_303_SEE_OTHER = 303\nHTTP_304_NOT_MODIFIED = 304\nHTTP_305_USE_PROXY = 305\nHTTP_306_RESERVED = 306\nHTTP_307_TEMPORARY_REDIRECT = 307\nHTTP_308_PERMANENT_REDIRECT = 308\nHTTP_400_BAD_REQUEST = 400\nHTTP_401_UNAUTHORIZED = 401\nHTTP_402_PAYMENT_REQUIRED = 402\nHTTP_403_FORBIDDEN = 403\nHTTP_404_NOT_FOUND = 404\nHTTP_405_METHOD_NOT_ALLOWED = 405\nHTTP_406_NOT_ACCEPTABLE = 406\nHTTP_407_PROXY_AUTHENTICATION_REQUIRED = 407\nHTTP_408_REQUEST_TIMEOUT = 408\nHTTP_409_CONFLICT = 409\nHTTP_410_GONE = 410\nHTTP_411_LENGTH_REQUIRED = 411\nHTTP_412_PRECONDITION_FAILED = 412\nHTTP_413_REQUEST_ENTITY_TOO_LARGE = 413\nHTTP_414_REQUEST_URI_TOO_LONG = 414\nHTTP_415_UNSUPPORTED_MEDIA_TYPE = 415\nHTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE = 416\nHTTP_417_EXPECTATION_FAILED = 417\nHTTP_418_IM_A_TEAPOT = 418\nHTTP_421_MISDIRECTED_REQUEST = 421\nHTTP_422_UNPROCESSABLE_ENTITY = 422\nHTTP_423_LOCKED = 423\nHTTP_424_FAILED_DEPENDENCY = 424\nHTTP_425_TOO_EARLY = 425\nHTTP_426_UPGRADE_REQUIRED = 426\nHTTP_428_PRECONDITION_REQUIRED = 428\nHTTP_429_TOO_MANY_REQUESTS = 429\nHTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE = 431\nHTTP_451_UNAVAILABLE_FOR_LEGAL_REASONS = 451\nHTTP_500_INTERNAL_SERVER_ERROR = 500\nHTTP_501_NOT_IMPLEMENTED = 501\nHTTP_502_BAD_GATEWAY = 502\nHTTP_503_SERVICE_UNAVAILABLE = 503\nHTTP_504_GATEWAY_TIMEOUT = 504\nHTTP_505_HTTP_VERSION_NOT_SUPPORTED = 505\nHTTP_506_VARIANT_ALSO_NEGOTIATES = 506\nHTTP_507_INSUFFICIENT_STORAGE = 507\nHTTP_508_LOOP_DETECTED = 508\nHTTP_509_BANDWIDTH_LIMIT_EXCEEDED = 509\nHTTP_510_NOT_EXTENDED = 510\nHTTP_511_NETWORK_AUTHENTICATION_REQUIRED = 511\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/admin/detail.html",
    "content": "{% load rest_framework %}\n<table class=\"table table-striped\">\n  <tbody>\n    {% for key, value in results|items %}\n      {% if key in details %}\n        <tr><th>{{ key|capfirst }}</th><td {{ value|add_nested_class }}>{{ value|format_value }}</td></tr>\n      {% endif %}\n    {% endfor %}\n  </tbody>\n</table>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/admin/dict_value.html",
    "content": "{% load rest_framework %}\n<table class=\"table table-striped\">\n  <tbody>\n    {% for k, v in value|items %}\n      <tr>\n        <th>{{ k|format_value }}</th>\n        <td>{{ v|format_value }}</td>\n      </tr>\n    {% endfor %}\n  </tbody>\n</table>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/admin/list.html",
    "content": "{% load rest_framework %}\n<table class=\"table table-striped\">\n  <thead>\n    <tr>{% for column in columns%}<th>{{ column|capfirst }}</th>{% endfor %}<th class=\"col-xs-1\"></th></tr>\n  </thead>\n  <tbody>\n    {% for row in results %}\n      <tr>\n        {% for key, value in row|items %}\n          {% if key in columns %}\n            <td {{ value|add_nested_class }} >\n              {{ value|format_value }}\n            </td>\n          {% endif %}\n        {% endfor %}\n        <td>\n          {% if row.url %}\n          <a href=\"{{ row.url }}\"><span class=\"glyphicon glyphicon-chevron-right\" aria-hidden=\"true\"></span></a>\n          {% else %}\n          <span class=\"glyphicon glyphicon-chevron-right text-muted\" aria-hidden=\"true\"></span>\n          {% endif %}\n        </td>\n      </tr>\n    {% endfor %}\n  </tbody>\n</table>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/admin/list_value.html",
    "content": "{% load rest_framework %}\n<table class=\"table table-striped\">\n  <tbody>\n    {% for item in value %}\n      <tr>\n        <th>{{ forloop.counter0 }}</th>\n        <td>{{ item|format_value }}</td>\n      </tr>\n    {% endfor %}\n  </tbody>\n</table>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/admin/simple_list_value.html",
    "content": "{% load rest_framework %}\n{% for item in value %}{% if not forloop.first%},{% endif %} {{item|format_value}}{% endfor %}\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/admin.html",
    "content": "{% load static %}\n{% load i18n %}\n{% load rest_framework %}\n\n<!DOCTYPE html>\n<html>\n  <head>\n    {% block head %}\n\n      {% block meta %}\n        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n        <meta name=\"robots\" content=\"NONE,NOARCHIVE\" />\n      {% endblock %}\n\n      <title>{% block title %}Django REST framework{% endblock %}</title>\n\n      {% block style %}\n        {% block bootstrap_theme %}\n          <link rel=\"stylesheet\" type=\"text/css\" href=\"{% static \"rest_framework/css/bootstrap.min.css\" %}\"/>\n          <link rel=\"stylesheet\" type=\"text/css\" href=\"{% static \"rest_framework/css/bootstrap-tweaks.css\" %}\"/>\n        {% endblock %}\n        <link rel=\"stylesheet\" type=\"text/css\" href=\"{% static \"rest_framework/css/prettify.css\" %}\"/>\n        <link rel=\"stylesheet\" type=\"text/css\" href=\"{% static \"rest_framework/css/default.css\" %}\"/>\n      {% endblock %}\n\n    {% endblock %}\n  </head>\n\n  {% block body %}\n    <body class=\"{% block bodyclass %}{% endblock %}\">\n      <div class=\"wrapper\">\n          {% block navbar %}\n            <div class=\"navbar navbar-static-top {% block bootstrap_navbar_variant %}navbar-inverse{% endblock %}\">\n              <div class=\"container\">\n                <span>\n                  {% block branding %}\n                    <a class='navbar-brand' rel=\"nofollow\" href='https://www.django-rest-framework.org/'>\n                      Django REST framework\n                    </a>\n                  {% endblock %}\n                </span>\n                <ul class=\"nav navbar-nav pull-right\">\n                  {% block userlinks %}\n                    {% if user.is_authenticated %}\n                      {% optional_logout request user csrf_token %}\n                    {% else %}\n                      {% optional_login request %}\n                    {% endif %}\n                  {% endblock %}\n                </ul>\n              </div>\n            </div>\n          {% endblock %}\n\n          <div class=\"container\">\n            {% block breadcrumbs %}\n              <ul class=\"breadcrumb\">\n                {% for breadcrumb_name, breadcrumb_url in breadcrumblist %}\n                  {% if forloop.last %}\n                    <li class=\"active\"><a href=\"{{ breadcrumb_url }}\">{{ breadcrumb_name }}</a></li>\n                  {% else %}\n                    <li><a href=\"{{ breadcrumb_url }}\">{{ breadcrumb_name }}</a></li>\n                  {% endif %}\n                {% endfor %}\n              </ul>\n            {% endblock %}\n\n          <!-- Content -->\n          <div id=\"content\">\n            {% if 'GET' in allowed_methods %}\n              <form id=\"get-form\" class=\"pull-right\">\n                <fieldset>\n                  <div class=\"btn-group format-selection\">\n                    <button class=\"btn btn-primary dropdown-toggle\" data-toggle=\"dropdown\">\n                      Format <span class=\"caret\"></span>\n                    </button>\n                    <ul class=\"dropdown-menu\">\n                      {% for format in available_formats %}\n                        <li>\n                          <a class=\"format-option\"\n                              href='{% add_query_param request api_settings.URL_FORMAT_OVERRIDE format %}'\n                               rel=\"nofollow\">\n                              {{ format }}\n                          </a>\n                        </li>\n                      {% endfor %}\n                    </ul>\n                  </div>\n                </fieldset>\n              </form>\n            {% endif %}\n\n            {% if post_form %}\n              <button type=\"button\" class=\"button-form btn btn-primary\" data-toggle=\"modal\" data-target=\"#createModal\">\n                <span class=\"glyphicon glyphicon-plus\" aria-hidden=\"true\"></span> Create\n              </button>\n            {% endif %}\n\n            {% if put_form %}\n              <button type=\"button\" class=\"button-form btn btn-primary\" data-toggle=\"modal\" data-target=\"#editModal\">\n                <span class=\"glyphicon glyphicon-pencil\" aria-hidden=\"true\"></span> Edit\n              </button>\n            {% endif %}\n\n            {% if delete_form %}\n              <form class=\"button-form\" action=\"{{ request.get_full_path }}\" data-method=\"DELETE\">\n                <button class=\"btn btn-danger\">\n                  <span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span> Delete\n                </button>\n              </form>\n            {% endif %}\n\n            {% if extra_actions %}\n              <div class=\"dropdown\" style=\"float: right; margin-right: 10px\">\n                <button class=\"btn btn-default\" id=\"extra-actions-menu\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"true\">\n                  {% trans \"Extra Actions\" %}\n                  <span class=\"caret\"></span>\n                </button>\n                <ul class=\"dropdown-menu\" aria-labelledby=\"extra-actions-menu\">\n                  {% for action_name, url in extra_actions|items %}\n                  <li><a href=\"{{ url }}\">{{ action_name }}</a></li>\n                  {% endfor %}\n                </ul>\n              </div>\n            {% endif %}\n\n            {% if filter_form %}\n              <button style=\"float: right; margin-right: 10px\" data-toggle=\"modal\" data-target=\"#filtersModal\" class=\"btn btn-default\">\n                <span class=\"glyphicon glyphicon-wrench\" aria-hidden=\"true\"></span>\n                {% trans \"Filters\" %}\n              </button>\n            {% endif %}\n\n            <div class=\"content-main\">\n              <div class=\"page-header\">\n                <h1>{{ name }}</h1>\n              </div>\n\n              <div style=\"float:left\">\n                {% block description %}\n                  {{ description }}\n                {% endblock %}\n              </div>\n\n              {% if paginator %}\n                <nav style=\"float: right\">\n                  {% get_pagination_html paginator %}\n                </nav>\n              {% endif %}\n\n              <div class=\"request-info\" style=\"clear: both\" >\n                {% if style == 'list' %}\n                  {% include \"rest_framework/admin/list.html\" %}\n                {% else %}\n                  {% include \"rest_framework/admin/detail.html\" %}\n                {% endif %}\n              </div>\n\n              {% if paginator %}\n                <nav style=\"float: right\">\n                  {% get_pagination_html paginator %}\n                </nav>\n              {% endif %}\n            </div>\n          </div>\n          <!-- END Content -->\n        </div><!-- /.container -->\n      </div><!-- ./wrapper -->\n\n      <!-- Create Modal -->\n      <div class=\"modal fade\" id=\"createModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n        <div class=\"modal-dialog\">\n          <div class=\"modal-content\">\n            <div class=\"modal-header\">\n              <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>\n              <h4 class=\"modal-title\" id=\"myModalLabel\">Create</h4>\n            </div>\n            <form action=\"{{ request.get_full_path }}\" method=\"POST\" enctype=\"multipart/form-data\" class=\"form-horizontal\" novalidate>\n              <div class=\"modal-body\">\n                <fieldset>\n                  {% csrf_token %}\n                  {{ post_form }}\n                </fieldset>\n              </div>\n              <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>\n                <button type=\"submit\" class=\"btn btn-primary\">Save</button>\n              </div>\n            </form>\n          </div>\n        </div>\n      </div>\n\n      <!-- Edit Modal -->\n      <div class=\"modal fade\" id=\"editModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n        <div class=\"modal-dialog\">\n          <div class=\"modal-content\">\n            <div class=\"modal-header\">\n              <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>\n              <h4 class=\"modal-title\" id=\"myModalLabel\">Edit</h4>\n            </div>\n            <form action=\"{{ request.get_full_path }}\" data-method=\"PUT\" enctype=\"multipart/form-data\" class=\"form-horizontal\" novalidate>\n              <div class=\"modal-body\">\n                <fieldset>\n                  {{ put_form }}\n                </fieldset>\n              </div>\n              <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>\n                <button type=\"submit\" class=\"btn btn-primary\">Save</button>\n              </div>\n            </form>\n          </div>\n        </div>\n      </div>\n\n      {% if error_form %}\n        <!-- Errors Modal -->\n        <div class=\"modal\" id=\"errorModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n          <div class=\"modal-dialog\">\n            <div class=\"modal-content\">\n              <div class=\"modal-header\">\n                <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>\n                <h4 class=\"modal-title\" id=\"myModalLabel\">{{ error_title }}</h4>\n              </div>\n              <form action=\"{{ request.get_full_path }}\" data-method=\"{{ request.method }}\" enctype=\"multipart/form-data\" class=\"form-horizontal\" novalidate>\n                <div class=\"modal-body\">\n                  <fieldset>\n                    {{ error_form }}\n                  </fieldset>\n                </div>\n                <div class=\"modal-footer\">\n                  <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>\n                  <button type=\"submit\" class=\"btn btn-primary\">Save</button>\n                </div>\n              </form>\n            </div>\n          </div>\n        </div>\n      {% endif %}\n\n      {% if filter_form %}\n        {{ filter_form }}\n      {% endif %}\n\n      {% block script %}\n        <script type=\"application/json\" id=\"drf_csrf\">\n          {\n            \"csrfHeaderName\": \"{{ csrf_header_name|default:'X-CSRFToken' }}\",\n            \"csrfToken\": \"{{ csrf_token }}\"\n          }\n        </script>\n        <script src=\"{% static \"rest_framework/js/jquery-3.7.1.min.js\" %}\"></script>\n        <script src=\"{% static \"rest_framework/js/ajax-form.js\" %}\"></script>\n        <script src=\"{% static \"rest_framework/js/csrf.js\" %}\"></script>\n        <script src=\"{% static \"rest_framework/js/bootstrap.min.js\" %}\"></script>\n        <script src=\"{% static \"rest_framework/js/prettify-min.js\" %}\"></script>\n        <script src=\"{% static \"rest_framework/js/default.js\" %}\"></script>\n        <script src=\"{% static \"rest_framework/js/load-ajax-form.js\" %}\"></script>\n      {% endblock %}\n    </body>\n  {% endblock %}\n</html>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/api.html",
    "content": "{% extends \"rest_framework/base.html\" %}\n\n{# Override this template in your own templates directory to customize #}\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/base.html",
    "content": "{% load static %}\n{% load i18n %}\n{% load rest_framework %}\n\n<!DOCTYPE html>\n<html>\n  <head>\n    {% block head %}\n\n      {% block meta %}\n        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n        <meta name=\"robots\" content=\"NONE,NOARCHIVE\" />\n      {% endblock %}\n\n      <title>{% block title %}{% if name %}{{ name }} – {% endif %}Django REST framework{% endblock %}</title>\n\n      {% block style %}\n        {% block bootstrap_theme %}\n          <link rel=\"stylesheet\" type=\"text/css\" href=\"{% static \"rest_framework/css/bootstrap.min.css\" %}\"/>\n          <link rel=\"stylesheet\" type=\"text/css\" href=\"{% static \"rest_framework/css/bootstrap-tweaks.css\" %}\"/>\n        {% endblock %}\n\n        <link rel=\"stylesheet\" type=\"text/css\" href=\"{% static \"rest_framework/css/prettify.css\" %}\"/>\n        <link rel=\"stylesheet\" type=\"text/css\" href=\"{% static \"rest_framework/css/default.css\" %}\"/>\n        {% if code_style %}<style>{{ code_style }}</style>{% endif %}\n      {% endblock %}\n\n    {% endblock %}\n  </head>\n\n  {% block body %}\n  <body class=\"{% block bodyclass %}{% endblock %}\">\n\n    <div class=\"wrapper\">\n      {% block navbar %}\n        <div class=\"navbar navbar-static-top {% block bootstrap_navbar_variant %}navbar-inverse{% endblock %}\"\n             role=\"navigation\" aria-label=\"{% trans \"navbar\" %}\">\n          <div class=\"container\">\n            <span>\n              {% block branding %}\n                <a class='navbar-brand' rel=\"nofollow\" href='https://www.django-rest-framework.org/'>\n                    Django REST framework\n                </a>\n              {% endblock %}\n            </span>\n            <ul class=\"nav navbar-nav pull-right\">\n              {% block userlinks %}\n                {% if user.is_authenticated %}\n                  {% optional_logout request user csrf_token %}\n                {% else %}\n                  {% optional_login request %}\n                {% endif %}\n              {% endblock %}\n            </ul>\n          </div>\n        </div>\n      {% endblock %}\n\n      <div class=\"container\">\n        {% block breadcrumbs %}\n          <ul class=\"breadcrumb\">\n            {% for breadcrumb_name, breadcrumb_url in breadcrumblist %}\n              {% if forloop.last %}\n                <li class=\"active\"><a href=\"{{ breadcrumb_url }}\">{{ breadcrumb_name }}</a></li>\n              {% else %}\n                <li><a href=\"{{ breadcrumb_url }}\">{{ breadcrumb_name }}</a></li>\n              {% endif %}\n            {% empty %}\n              {% block breadcrumbs_empty %}&nbsp;{% endblock breadcrumbs_empty %}\n            {% endfor %}\n          </ul>\n        {% endblock %}\n\n        <!-- Content -->\n        <div id=\"content\" role=\"main\" aria-label=\"{% trans \"content\" %}\">\n          {% block content %}\n\n          <div class=\"region\"  aria-label=\"{% trans \"request form\" %}\">\n          {% block request_forms %}\n\n          {% if 'GET' in allowed_methods %}\n            <form id=\"get-form\" class=\"pull-right\">\n              <fieldset>\n                {% if api_settings.URL_FORMAT_OVERRIDE %}\n                  <div class=\"btn-group format-selection\">\n                    <a class=\"btn btn-primary js-tooltip\" href=\"{{ request.get_full_path }}\" rel=\"nofollow\" title=\"Make a GET request on the {{ name }} resource\">GET</a>\n\n                    <button class=\"btn btn-primary dropdown-toggle js-tooltip\" data-toggle=\"dropdown\" title=\"Specify a format for the GET request\">\n                      <span class=\"caret\"></span>\n                    </button>\n                    <ul class=\"dropdown-menu\">\n                      {% for format in available_formats %}\n                        <li>\n                          <a class=\"js-tooltip format-option\" href=\"{% add_query_param request api_settings.URL_FORMAT_OVERRIDE format %}\" rel=\"nofollow\" title=\"Make a GET request on the {{ name }} resource with the format set to `{{ format }}`\">{{ format }}</a>\n                        </li>\n                      {% endfor %}\n                    </ul>\n                  </div>\n                {% else %}\n                  <a class=\"btn btn-primary js-tooltip\" href=\"{{ request.get_full_path }}\" rel=\"nofollow\" title=\"Make a GET request on the {{ name }} resource\">GET</a>\n                {% endif %}\n              </fieldset>\n            </form>\n          {% endif %}\n\n          {% if options_form %}\n            <form class=\"button-form\" action=\"{{ request.get_full_path }}\" data-method=\"OPTIONS\">\n              <button class=\"btn btn-primary js-tooltip\" title=\"Make an OPTIONS request on the {{ name }} resource\">OPTIONS</button>\n            </form>\n          {% endif %}\n\n          {% if delete_form %}\n            <button class=\"btn btn-danger button-form js-tooltip\" title=\"Make a DELETE request on the {{ name }} resource\" data-toggle=\"modal\" data-target=\"#deleteModal\">DELETE</button>\n\n            <!-- Delete Modal -->\n            <div class=\"modal fade\" id=\"deleteModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n              <div class=\"modal-dialog\">\n                <div class=\"modal-content\">\n                  <div class=\"modal-body\">\n                    <h4 class=\"text-center\">Are you sure you want to delete this {{ name }}?</h4>\n                  </div>\n                  <div class=\"modal-footer\">\n                    <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Cancel</button>\n                    <form class=\"button-form\" action=\"{{ request.get_full_path }}\" data-method=\"DELETE\">\n                      <button class=\"btn btn-danger\">Delete</button>\n                    </form>\n                  </div>\n                </div>\n              </div>\n            </div>\n          {% endif %}\n\n          {% if extra_actions %}\n            <div class=\"dropdown\" style=\"float: right; margin-right: 10px\">\n              <button class=\"btn btn-default\" id=\"extra-actions-menu\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"true\">\n                {% trans \"Extra Actions\" %}\n                <span class=\"caret\"></span>\n              </button>\n              <ul class=\"dropdown-menu\" aria-labelledby=\"extra-actions-menu\">\n                {% for action_name, url in extra_actions|items %}\n                <li><a href=\"{{ url }}\">{{ action_name }}</a></li>\n                {% endfor %}\n              </ul>\n            </div>\n          {% endif %}\n\n          {% if filter_form %}\n            <button style=\"float: right; margin-right: 10px\" data-toggle=\"modal\" data-target=\"#filtersModal\" class=\"btn btn-default\">\n              <span class=\"glyphicon glyphicon-wrench\" aria-hidden=\"true\"></span>\n              {% trans \"Filters\" %}\n            </button>\n          {% endif %}\n\n          {% endblock request_forms %}\n          </div>\n\n            <div class=\"content-main\" role=\"main\"  aria-label=\"{% trans \"main content\" %}\">\n              <div class=\"page-header\">\n                <h1>{{ name }}</h1>\n              </div>\n              <div class=\"pull-left\">\n                {% block description %}\n                  {{ description }}\n                {% endblock %}\n              </div>\n\n              {% if paginator %}\n                <nav class=\"pull-right\">\n                  {% get_pagination_html paginator %}\n                </nav>\n              {% endif %}\n\n              <div class=\"request-info\" aria-label=\"{% trans \"request info\" %}\">\n                <pre class=\"prettyprint\"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre>\n              </div>\n\n              <div class=\"response-info\" aria-label=\"{% trans \"response info\" %}\">\n                <pre class=\"prettyprint\"><span class=\"meta nocode\"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% for key, val in response_headers|items %}\n<b>{{ key }}:</b> <span class=\"lit\">{{ val|urlize }}</span>{% endfor %}\n\n</span>{{ content|urlize }}</pre>\n              </div>\n            </div>\n\n            {% if display_edit_forms %}\n              {% if post_form or raw_data_post_form %}\n                <div {% if post_form %}class=\"tabbable\"{% endif %}>\n                  {% if post_form %}\n                    <ul class=\"nav nav-tabs form-switcher\">\n                      <li>\n                        <a name='html-tab' href=\"#post-object-form\" data-toggle=\"tab\">HTML form</a>\n                      </li>\n                      <li>\n                        <a name='raw-tab' href=\"#post-generic-content-form\" data-toggle=\"tab\">Raw data</a>\n                      </li>\n                    </ul>\n                  {% endif %}\n\n                  <div class=\"well tab-content\">\n                    {% if post_form %}\n                      <div class=\"tab-pane\" id=\"post-object-form\">\n                        {% with form=post_form %}\n                          <form action=\"{{ request.get_full_path }}\" method=\"POST\" enctype=\"multipart/form-data\" class=\"form-horizontal\" novalidate>\n                            <fieldset>\n                              {% csrf_token %}\n                              {{ post_form }}\n                              <div class=\"form-actions\">\n                                <button class=\"btn btn-primary js-tooltip\" title=\"Make a POST request on the {{ name }} resource\">POST</button>\n                              </div>\n                            </fieldset>\n                          </form>\n                        {% endwith %}\n                      </div>\n                    {% endif %}\n\n                    <div {% if post_form %}class=\"tab-pane\"{% endif %} id=\"post-generic-content-form\">\n                      {% with form=raw_data_post_form %}\n                        <form action=\"{{ request.get_full_path }}\" method=\"POST\" class=\"form-horizontal\">\n                          <fieldset>\n                            {% include \"rest_framework/raw_data_form.html\" %}\n                            <div class=\"form-actions\">\n                              <button class=\"btn btn-primary js-tooltip\" title=\"Make a POST request on the {{ name }} resource\">POST</button>\n                            </div>\n                          </fieldset>\n                        </form>\n                      {% endwith %}\n                    </div>\n                  </div>\n                </div>\n              {% endif %}\n\n              {% if put_form or raw_data_put_form or raw_data_patch_form %}\n                <div {% if put_form %}class=\"tabbable\"{% endif %}>\n                  {% if put_form %}\n                    <ul class=\"nav nav-tabs form-switcher\">\n                      <li>\n                        <a name='html-tab' href=\"#put-object-form\" data-toggle=\"tab\">HTML form</a>\n                      </li>\n                      <li>\n                        <a  name='raw-tab' href=\"#put-generic-content-form\" data-toggle=\"tab\">Raw data</a>\n                      </li>\n                    </ul>\n                  {% endif %}\n\n                  <div class=\"well tab-content\">\n                    {% if put_form %}\n                      <div class=\"tab-pane\" id=\"put-object-form\">\n                        <form action=\"{{ request.get_full_path }}\" data-method=\"PUT\" enctype=\"multipart/form-data\" class=\"form-horizontal\" novalidate>\n                          <fieldset>\n                            {{ put_form }}\n                            <div class=\"form-actions\">\n                              <button class=\"btn btn-primary js-tooltip\" title=\"Make a PUT request on the {{ name }} resource\">PUT</button>\n                            </div>\n                          </fieldset>\n                        </form>\n                      </div>\n                    {% endif %}\n\n                    <div {% if put_form %}class=\"tab-pane\"{% endif %} id=\"put-generic-content-form\">\n                      {% with form=raw_data_put_or_patch_form %}\n                        <form action=\"{{ request.get_full_path }}\" data-method=\"PUT\" class=\"form-horizontal\">\n                          <fieldset>\n                            {% include \"rest_framework/raw_data_form.html\" %}\n                            <div class=\"form-actions\">\n                              {% if raw_data_put_form %}\n                                <button class=\"btn btn-primary js-tooltip\" title=\"Make a PUT request on the {{ name }} resource\">PUT</button>\n                              {% endif %}\n                              {% if raw_data_patch_form %}\n                              <button data-method=\"PATCH\" class=\"btn btn-primary js-tooltip\" title=\"Make a PATCH request on the {{ name }} resource\">PATCH</button>\n                                {% endif %}\n                            </div>\n                          </fieldset>\n                        </form>\n                      {% endwith %}\n                    </div>\n                  </div>\n                </div>\n              {% endif %}\n            {% endif %}\n          {% endblock content %}\n        </div><!-- /.content -->\n      </div><!-- /.container -->\n    </div><!-- ./wrapper -->\n\n    {% if filter_form %}\n      {{ filter_form }}\n    {% endif %}\n\n    {% block script %}\n      <script type=\"application/json\" id=\"drf_csrf\">\n        {\n          \"csrfHeaderName\": \"{{ csrf_header_name|default:'X-CSRFToken' }}\",\n          \"csrfToken\": \"{% if request %}{{ csrf_token }}{% endif %}\"\n        }\n      </script>\n      <script src=\"{% static \"rest_framework/js/jquery-3.7.1.min.js\" %}\"></script>\n      <script src=\"{% static \"rest_framework/js/ajax-form.js\" %}\"></script>\n      <script src=\"{% static \"rest_framework/js/csrf.js\" %}\"></script>\n      <script src=\"{% static \"rest_framework/js/bootstrap.min.js\" %}\"></script>\n      <script src=\"{% static \"rest_framework/js/prettify-min.js\" %}\"></script>\n      <script src=\"{% static \"rest_framework/js/default.js\" %}\"></script>\n      <script src=\"{% static \"rest_framework/js/load-ajax-form.js\" %}\"></script>\n    {% endblock %}\n\n  </body>\n  {% endblock %}\n</html>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/filters/base.html",
    "content": "<div class=\"modal fade\" id=\"filtersModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"filters\" aria-hidden=\"true\">\n  <div class=\"modal-dialog\">\n    <div class=\"modal-content\">\n      <div class=\"modal-header\">\n        <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>\n        <h4 class=\"modal-title\">Filters</h4>\n    </div>\n      <div class=\"modal-body\">\n          {% for element in elements %}\n          {% if not forloop.first %}<hr/>{% endif %}\n          {{ element }}\n          {% endfor %}\n      </div>\n    </div>\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/filters/ordering.html",
    "content": "{% load rest_framework %}\n{% load i18n %}\n<h2>{% trans \"Ordering\" %}</h2>\n<div class=\"list-group\">\n    {% for key, label in options %}\n        {% if key == current %}\n            <a href=\"{% add_query_param request param key %}\" class=\"list-group-item active\">\n                <span class=\"glyphicon glyphicon-ok\" style=\"float: right\" aria-hidden=\"true\"></span> {{ label }}\n            </a>\n        {% else %}\n            <a href=\"{% add_query_param request param key %}\" class=\"list-group-item\">{{ label }}</a>\n        {% endif %}\n    {% endfor %}\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/filters/search.html",
    "content": "{% load i18n %}\n<h2>{% trans \"Search\" %}</h2>\n<form class=\"form-inline\">\n  <div class=\"form-group\">\n    <div class=\"input-group\">\n      <input type=\"text\" class=\"form-control\" style=\"width: 350px\" name=\"{{ param }}\" value=\"{{ term }}\">\n      <span class=\"input-group-btn\">\n        <button class=\"btn btn-default\" type=\"submit\"><span class=\"glyphicon glyphicon-search\" aria-hidden=\"true\"></span> {% trans \"Search\" %}</button>\n      </span>\n    </div>\n  </div>\n</form>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/checkbox.html",
    "content": "<div class=\"form-group horizontal-checkbox {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label class=\"col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <div class=\"col-sm-10\">\n    <input type=\"checkbox\" name=\"{{ field.name }}\" value=\"true\" {% if field.value %}checked{% endif %}>\n\n    {% if field.errors %}\n      {% for error in field.errors %}\n        <span class=\"help-block\">{{ error }}</span>\n      {% endfor %}\n    {% endif %}\n\n    {% if field.help_text %}\n      <span class=\"help-block\">{{ field.help_text|safe }}</span>\n    {% endif %}\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/checkbox_multiple.html",
    "content": "{% load rest_framework %}\n\n<div class=\"form-group\">\n  {% if field.label %}\n    <label class=\"col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <div class=\"col-sm-10\">\n    {% if style.inline %}\n      {% for key, text in field.choices|items %}\n        <label class=\"checkbox-inline\">\n          <input type=\"checkbox\" name=\"{{ field.name }}\" value=\"{{ key }}\" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>\n          {{ text }}\n        </label>\n      {% endfor %}\n    {% else %}\n      {% for key, text in field.choices|items %}\n        <div class=\"checkbox\">\n          <label>\n            <input type=\"checkbox\" name=\"{{ field.name }}\" value=\"{{ key }}\" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>\n            {{ text }}\n          </label>\n        </div>\n      {% endfor %}\n    {% endif %}\n\n  {% if field.errors %}\n    {% for error in field.errors %}\n      <span class=\"help-block\">{{ error }}</span>\n    {% endfor %}\n  {% endif %}\n\n  {% if field.help_text %}\n    <span class=\"help-block\">{{ field.help_text|safe }}</span>\n  {% endif %}\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/dict_field.html",
    "content": "<div class=\"form-group\">\n  {% if field.label %}\n    <label class=\"col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <div class=\"col-sm-10\">\n    <p class=\"form-control-static\">Dictionaries are not currently supported in HTML input.</p>\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/fieldset.html",
    "content": "{% load rest_framework %}\n<fieldset>\n  {% if field.label %}\n    <div class=\"form-group\" style=\"border-bottom: 1px solid #e5e5e5\">\n      <legend class=\"control-label col-sm-2 {% if style.hide_label %}sr-only{% endif %}\" style=\"border-bottom: 0\">\n        {{ field.label }}\n      </legend>\n    </div>\n  {% endif %}\n\n  {% for nested_field in field %}\n    {% if not nested_field.read_only %}\n      {% render_field nested_field style=style %}\n    {% endif %}\n  {% endfor %}\n</fieldset>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/form.html",
    "content": "{% load rest_framework %}\n{% for field in form %}\n  {% if not field.read_only %}\n    {% render_field field style=style %}\n  {% endif %}\n{% endfor %}\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/input.html",
    "content": "<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label class=\"col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <div class=\"col-sm-10\">\n    <input name=\"{{ field.name }}\" {% if style.input_type != \"file\" %}class=\"form-control\"{% endif %} type=\"{{ style.input_type }}\" {% if style.placeholder %}placeholder=\"{{ style.placeholder }}\"{% endif %} {% if field.value is not None %}value=\"{{ field.value }}\"{% endif %} {% if style.autofocus and style.input_type != \"hidden\" %}autofocus{% endif %}>\n\n    {% if field.errors %}\n      {% for error in field.errors %}\n        <span class=\"help-block\">{{ error }}</span>\n      {% endfor %}\n    {% endif %}\n\n    {% if field.help_text %}\n      <span class=\"help-block\">{{ field.help_text|safe }}</span>\n    {% endif %}\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/list_field.html",
    "content": "<div class=\"form-group\">\n  {% if field.label %}\n    <label class=\"col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <div class=\"col-sm-10\">\n    <p class=\"form-control-static\">Lists are not currently supported in HTML input.</p>\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/list_fieldset.html",
    "content": "{% load rest_framework %}\n\n<fieldset>\n  {% if field.label %}\n    <div class=\"form-group\" style=\"border-bottom: 1px solid #e5e5e5\">\n      <legend class=\"control-label col-sm-2 {% if style.hide_label %}sr-only{% endif %}\" style=\"border-bottom: 0\">\n        {{ field.label }}\n      </legend>\n    </div>\n  {% endif %}\n\n  <p>Lists are not currently supported in HTML input.</p>\n</fieldset>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/radio.html",
    "content": "{% load i18n %}\n{% load rest_framework %}\n\n{% trans \"None\" as none_choice %}\n\n<div class=\"form-group\">\n  {% if field.label %}\n    <label class=\"col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <div class=\"col-sm-10\">\n    {% if style.inline %}\n      {% if field.allow_null or field.allow_blank %}\n        <label class=\"radio-inline\">\n          <input type=\"radio\" name=\"{{ field.name }}\" value=\"\" {% if not field.value %}checked{% endif %} />\n          {{ none_choice }}\n        </label>\n      {% endif %}\n\n      {% for key, text in field.choices|items %}\n        <label class=\"radio-inline\">\n          <input type=\"radio\" name=\"{{ field.name }}\" value=\"{{ key }}\" {% if key|as_string == field.value|as_string %}checked{% endif %} />\n          {{ text }}\n        </label>\n      {% endfor %}\n    {% else %}\n      {% if field.allow_null or field.allow_blank %}\n        <div class=\"radio\">\n          <label>\n            <input type=\"radio\" name=\"{{ field.name }}\" value=\"\" {% if not field.value %}checked{% endif %} />\n            {{ none_choice }}\n          </label>\n        </div>\n      {% endif %}\n        {% for key, text in field.choices|items %}\n          <div class=\"radio\">\n            <label>\n              <input type=\"radio\" name=\"{{ field.name }}\" value=\"{{ key }}\" {% if key|as_string == field.value|as_string %}checked{% endif %} />\n              {{ text }}\n            </label>\n          </div>\n        {% endfor %}\n    {% endif %}\n\n    {% if field.errors %}\n      {% for error in field.errors %}\n        <span class=\"help-block\">{{ error }}</span>\n      {% endfor %}\n    {% endif %}\n\n    {% if field.help_text %}\n      <span class=\"help-block\">{{ field.help_text|safe }}</span>\n    {% endif %}\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/select.html",
    "content": "{% load rest_framework %}\n\n<div class=\"form-group\">\n  {% if field.label %}\n    <label class=\"col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <div class=\"col-sm-10\">\n    <select class=\"form-control\" name=\"{{ field.name }}\">\n      {% if field.allow_null or field.allow_blank %}\n        <option value=\"\" {% if not field.value %}selected{% endif %}>--------</option>\n      {% endif %}\n      {% for select in field.iter_options %}\n          {% if select.start_option_group %}\n            <optgroup label=\"{{ select.label }}\">\n          {% elif select.end_option_group %}\n            </optgroup>\n          {% else %}\n            <option value=\"{{ select.value }}\" {% if select.value|as_string == field.value|as_string %}selected{% endif %} {% if select.disabled %}disabled{% endif %}>{{ select.display_text }}</option>\n          {% endif %}\n      {% endfor %}\n    </select>\n\n    {% if field.errors %}\n      {% for error in field.errors %}\n        <span class=\"help-block\">{{ error }}</span>\n      {% endfor %}\n    {% endif %}\n\n    {% if field.help_text %}\n      <span class=\"help-block\">{{ field.help_text|safe }}</span>\n    {% endif %}\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/select_multiple.html",
    "content": "{% load i18n %}\n{% load rest_framework %}\n\n{% trans \"No items to select.\" as no_items %}\n\n<div class=\"form-group\">\n  {% if field.label %}\n    <label class=\"col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <div class=\"col-sm-10\">\n    <select multiple class=\"form-control\" name=\"{{ field.name }}\">\n      {% for select in field.iter_options %}\n        {% if select.start_option_group %}\n          <optgroup label=\"{{ select.label }}\">\n        {% elif select.end_option_group %}\n          </optgroup>\n        {% else %}\n          <option value=\"{{ select.value }}\" {% if select.value|as_string in field.value|as_list_of_strings %}selected{% endif %} {% if select.disabled %}disabled{% endif %}>{{ select.display_text }}</option>\n        {% endif %}\n      {% empty %}\n          <option>{{ no_items }}</option>\n      {% endfor %}\n    </select>\n\n    {% if field.errors %}\n      {% for error in field.errors %}\n        <span class=\"help-block\">{{ error }}</span>\n      {% endfor %}\n    {% endif %}\n\n    {% if field.help_text %}\n      <span class=\"help-block\">{{ field.help_text|safe }}</span>\n    {% endif %}\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/horizontal/textarea.html",
    "content": "<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label class=\"col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <div class=\"col-sm-10\">\n    <textarea name=\"{{ field.name }}\" class=\"form-control\" {% if style.placeholder %}placeholder=\"{{ style.placeholder }}\"{% endif %} {% if style.rows %}rows=\"{{ style.rows }}\"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea>\n\n    {% if field.errors %}\n      {% for error in field.errors %}\n        <span class=\"help-block\">{{ error }}</span>\n      {% endfor %}\n    {% endif %}\n\n    {% if field.help_text %}\n      <span class=\"help-block\">{{ field.help_text|safe }}</span>\n    {% endif %}\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/checkbox.html",
    "content": "<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  <div class=\"checkbox\">\n    <label>\n      <input type=\"checkbox\" name=\"{{ field.name }}\" value=\"true\" {% if field.value %}checked{% endif %}>\n      {% if field.label %}{{ field.label }}{% endif %}\n    </label>\n  </div>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/checkbox_multiple.html",
    "content": "{% load rest_framework %}\n\n<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label class=\"sr-only\">{{ field.label }}</label>\n  {% endif %}\n\n  {% for key, text in field.choices|items %}\n    <div class=\"checkbox\">\n      <label>\n        <input type=\"checkbox\" name=\"{{ field.name }}\" value=\"{{ key }}\" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>\n        {{ text }}\n      </label>\n    </div>\n  {% endfor %}\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/dict_field.html",
    "content": "<div class=\"form-group\">\n  {% if field.label %}\n    <label class=\"sr-only\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <p class=\"form-control-static\">Dictionaries are not currently supported in HTML input.</p>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/fieldset.html",
    "content": "{% load rest_framework %}\n{% for nested_field in field %}\n  {% if not nested_field.read_only %}\n    {% render_field nested_field style=style %}\n  {% endif %}\n{% endfor %}\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/form.html",
    "content": "{% load rest_framework %}\n{% for field in form %}\n  {% if not field.read_only %}\n    {% render_field field style=style %}\n  {% endif %}\n{% endfor %}\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/input.html",
    "content": "<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label class=\"sr-only\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <input name=\"{{ field.name }}\" {% if style.input_type != \"file\" %}class=\"form-control\"{% endif %} type=\"{{ style.input_type }}\" {% if style.placeholder %}placeholder=\"{{ style.placeholder }}\"{% endif %} {% if field.value is not None %}value=\"{{ field.value }}\"{% endif %} {% if style.autofocus and style.input_type != \"hidden\" %}autofocus{% endif %}>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/list_field.html",
    "content": "<div class=\"form-group\">\n  {% if field.label %}\n    <label class=\"sr-only\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <p class=\"form-control-static\">Lists are not currently supported in HTML input.</p>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/list_fieldset.html",
    "content": "<span>Lists are not currently supported in HTML input.</span>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/radio.html",
    "content": "{% load i18n %}\n{% load rest_framework %}\n{% trans \"None\" as none_choice %}\n\n<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label class=\"sr-only\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  {% if field.allow_null or field.allow_blank %}\n    <div class=\"radio\">\n      <label>\n        <input type=\"radio\" name=\"{{ field.name }}\" value=\"\" {% if not field.value %}checked{% endif %}>\n        {{ none_choice }}\n      </label>\n    </div>\n  {% endif %}\n\n  {% for key, text in field.choices|items %}\n    <div class=\"radio\">\n      <label>\n        <input type=\"radio\" name=\"{{ field.name }}\" value=\"{{ key }}\" {% if key|as_string == field.value|as_string %}checked{% endif %}>\n        {{ text }}\n      </label>\n    </div>\n  {% endfor %}\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/select.html",
    "content": "{% load rest_framework %}\n\n<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label class=\"sr-only\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <select class=\"form-control\" name=\"{{ field.name }}\">\n    {% if field.allow_null or field.allow_blank %}\n      <option value=\"\" {% if not field.value %}selected{% endif %}>--------</option>\n    {% endif %}\n    {% for select in field.iter_options %}\n        {% if select.start_option_group %}\n          <optgroup label=\"{{ select.label }}\">\n        {% elif select.end_option_group %}\n          </optgroup>\n        {% else %}\n          <option value=\"{{ select.value }}\" {% if select.value|as_string == field.value|as_string %}selected{% endif %} {% if select.disabled %}disabled{% endif %}>{{ select.display_text }}</option>\n        {% endif %}\n    {% endfor %}\n  </select>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/select_multiple.html",
    "content": "{% load i18n %}\n{% load rest_framework %}\n{% trans \"No items to select.\" as no_items %}\n\n<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label class=\"sr-only\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <select multiple {{ field.choices|yesno:\",disabled\" }} class=\"form-control\" name=\"{{ field.name }}\">\n      {% for select in field.iter_options %}\n          {% if select.start_option_group %}\n            <optgroup label=\"{{ select.label }}\">\n          {% elif select.end_option_group %}\n            </optgroup>\n          {% else %}\n            <option value=\"{{ select.value }}\" {% if select.value|as_string in field.value|as_list_of_strings %}selected{% endif %} {% if select.disabled %}disabled{% endif %}>{{ select.display_text }}</option>\n          {% endif %}\n      {% empty %}\n      <option>{{ no_items }}</option>\n    {% endfor %}\n  </select>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/inline/textarea.html",
    "content": "<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label class=\"sr-only\">\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <input name=\"{{ field.name }}\" type=\"text\" class=\"form-control\" {% if style.placeholder %}placeholder=\"{{ style.placeholder }}\"{% endif %} {% if field.value %}value=\"{{ field.value }}\"{% endif %}>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/login.html",
    "content": "{% extends \"rest_framework/login_base.html\" %}\n\n{# Override this template in your own templates directory to customize #}\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/login_base.html",
    "content": "{% extends \"rest_framework/base.html\" %}\n{% load rest_framework %}\n\n{% block body %}\n<body class=\"container\">\n  <div class=\"container-fluid\" style=\"margin-top: 30px\">\n    <div class=\"row-fluid\">\n      <div class=\"well\" style=\"width: 320px; margin-left: auto; margin-right: auto\">\n        <div class=\"row-fluid\">\n          <div>\n            {% block branding %}<h3 style=\"margin: 0 0 20px;\">Django REST framework</h3>{% endblock %}\n          </div>\n        </div><!-- /row fluid -->\n\n        <div class=\"row-fluid\">\n          <div>\n            <form action=\"{% url 'rest_framework:login' %}\" role=\"form\" method=\"post\">\n              {% csrf_token %}\n              <input type=\"hidden\" name=\"next\" value=\"{{ next }}\" />\n\n              <div id=\"div_id_username\" class=\"clearfix control-group {% if form.username.errors %}error{% endif %}\">\n                <div class=\"form-group\">\n                  <label for=\"id_username\">{{ form.username.label }}:</label>\n                  <input type=\"text\" name=\"username\" maxlength=\"100\"\n                      autocapitalize=\"off\"\n                      autocorrect=\"off\" class=\"form-control textinput textInput\"\n                      id=\"id_username\" required autofocus\n                      {% if form.username.value %}value=\"{{ form.username.value }}\"{% endif %}>\n                  {% if form.username.errors %}\n                    <p class=\"text-error\">\n                      {{ form.username.errors|striptags }}\n                    </p>\n                  {% endif %}\n                </div>\n              </div>\n\n              <div id=\"div_id_password\" class=\"clearfix control-group {% if form.password.errors %}error{% endif %}\">\n                <div class=\"form-group\">\n                  <label for=\"id_password\">{{ form.password.label }}:</label>\n                  <input type=\"password\" name=\"password\" maxlength=\"100\" autocapitalize=\"off\" autocorrect=\"off\" class=\"form-control textinput textInput\" id=\"id_password\" required>\n                  {% if form.password.errors %}\n                    <p class=\"text-error\">\n                      {{ form.password.errors|striptags }}\n                    </p>\n                  {% endif %}\n                </div>\n              </div>\n\n              {% if form.non_field_errors %}\n                {% for error in form.non_field_errors %}\n                  <div class=\"well well-small text-error\" style=\"border: none\">{{ error }}</div>\n                {% endfor %}\n              {% endif %}\n\n              <div class=\"form-actions-no-box\">\n                <input type=\"submit\" name=\"submit\" value=\"Log in\" class=\"btn btn-primary form-control\" id=\"submit-id-submit\">\n              </div>\n            </form>\n          </div>\n        </div><!-- /.row-fluid -->\n      </div><!--/.well-->\n    </div><!-- /.row-fluid -->\n  </div><!-- /.container-fluid -->\n</body>\n{% endblock %}\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/pagination/numbers.html",
    "content": "<ul class=\"pagination\">\n  {% if previous_url %}\n    <li>\n      <a href=\"{{ previous_url }}\" aria-label=\"Previous\">\n        <span aria-hidden=\"true\">&laquo;</span>\n      </a>\n    </li>\n  {% else %}\n    <li class=\"disabled\">\n      <a href=\"#\" aria-label=\"Previous\">\n        <span aria-hidden=\"true\">&laquo;</span>\n      </a>\n    </li>\n  {% endif %}\n\n  {% for page_link in page_links %}\n    {% if page_link.is_break %}\n      <li class=\"disabled\">\n        <a href=\"#\"><span aria-hidden=\"true\">&hellip;</span></a>\n      </li>\n    {% else %}\n      {% if page_link.is_active %}\n        <li class=\"active\">\n          <a href=\"{{ page_link.url }}\">{{ page_link.number }}</a>\n        </li>\n      {% else %}\n        <li>\n          <a href=\"{{ page_link.url }}\">{{ page_link.number }}</a>\n        </li>\n      {% endif %}\n    {% endif %}\n  {% endfor %}\n\n  {% if next_url %}\n    <li>\n      <a href=\"{{ next_url }}\" aria-label=\"Next\">\n        <span aria-hidden=\"true\">&raquo;</span>\n      </a>\n    </li>\n  {% else %}\n    <li class=\"disabled\">\n      <a href=\"#\" aria-label=\"Next\">\n        <span aria-hidden=\"true\">&raquo;</span>\n      </a>\n    </li>\n  {% endif %}\n</ul>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/pagination/previous_and_next.html",
    "content": "<ul class=\"pager\">\n  {% if previous_url %}\n    <li class=\"previous\">\n      <a href=\"{{ previous_url }}\">&laquo; Previous</a>\n    </li>\n  {% else %}\n    <li class=\"previous disabled\">\n      <a href=\"#\">&laquo; Previous</a>\n    </li>\n  {% endif %}\n\n  {% if next_url %}\n    <li class=\"next\">\n      <a href=\"{{ next_url }}\">Next &raquo;</a>\n    </li>\n  {% else %}\n    <li class=\"next disabled\">\n      <a href=\"#\">Next &raquo;</a>\n    </li>\n  {% endif %}\n</ul>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/raw_data_form.html",
    "content": "{% load rest_framework %}\n{{ form.non_field_errors }}\n{% for field in form %}\n  <div class=\"form-group\">\n    {{ field.label_tag|add_class:\"col-sm-2 control-label\" }}\n    <div class=\"col-sm-10\">\n      {{ field|add_class:\"form-control\" }}\n      <span class=\"help-block\">{{ field.help_text|safe }}</span>\n    </div>\n  </div>\n{% endfor %}\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/checkbox.html",
    "content": "<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  <div class=\"checkbox\">\n    <label>\n      <input type=\"checkbox\" name=\"{{ field.name }}\" value=\"true\" {% if field.value %}checked{% endif %}>\n        {% if field.label %}{{ field.label }}{% endif %}\n    </label>\n  </div>\n\n  {% if field.errors %}\n    {% for error in field.errors %}\n      <span class=\"help-block\">{{ error }}</span>\n    {% endfor %}\n  {% endif %}\n\n  {% if field.help_text %}\n    <span class=\"help-block\">{{ field.help_text|safe }}</span>\n  {% endif %}\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/checkbox_multiple.html",
    "content": "{% load rest_framework %}\n\n<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label {% if style.hide_label %}class=\"sr-only\"{% endif %}>{{ field.label }}</label>\n  {% endif %}\n\n  {% if style.inline %}\n    <div>\n      {% for key, text in field.choices|items %}\n        <label class=\"checkbox-inline\">\n          <input type=\"checkbox\" name=\"{{ field.name }}\" value=\"{{ key }}\" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>\n            {{ text }}\n        </label>\n      {% endfor %}\n    </div>\n  {% else %}\n    {% for key, text in field.choices|items %}\n      <div class=\"checkbox\">\n        <label>\n          <input type=\"checkbox\" name=\"{{ field.name }}\" value=\"{{ key }}\" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>\n          {{ text }}\n        </label>\n      </div>\n    {% endfor %}\n  {% endif %}\n\n  {% if field.errors %}\n    {% for error in field.errors %}\n      <span class=\"help-block\">{{ error }}</span>\n    {% endfor %}\n  {% endif %}\n\n  {% if field.help_text %}\n    <span class=\"help-block\">{{ field.help_text|safe }}</span>\n  {% endif %}\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/dict_field.html",
    "content": "<div class=\"form-group\">\n  {% if field.label %}\n    <label {% if style.hide_label %}class=\"sr-only\"{% endif %}>{{ field.label }}</label>\n  {% endif %}\n\n  <p class=\"form-control-static\">Dictionaries are not currently supported in HTML input.</p>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/fieldset.html",
    "content": "{% load rest_framework %}\n\n<fieldset>\n  {% if field.label %}\n    <legend {% if style.hide_label %}class=\"sr-only\"{% endif %}>\n      {{ field.label }}\n    </legend>\n  {% endif %}\n\n  {% for nested_field in field %}\n    {% if not nested_field.read_only %}\n      {% render_field nested_field style=style %}\n    {% endif %}\n  {% endfor %}\n</fieldset>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/form.html",
    "content": "{% load rest_framework %}\n{% for field in form %}\n  {% if not field.read_only %}\n    {% render_field field style=style %}\n  {% endif %}\n{% endfor %}\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/input.html",
    "content": "<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label {% if style.hide_label %}class=\"sr-only\"{% endif %}>{{ field.label }}</label>\n  {% endif %}\n\n  <input name=\"{{ field.name }}\" {% if style.input_type != \"file\" %}class=\"form-control\"{% endif %} type=\"{{ style.input_type }}\" {% if style.placeholder %}placeholder=\"{{ style.placeholder }}\"{% endif %} {% if field.value is not None %}value=\"{{ field.value }}\"{% endif %} {% if style.autofocus and style.input_type != \"hidden\" %}autofocus{% endif %}>\n\n  {% if field.errors %}\n    {% for error in field.errors %}\n      <span class=\"help-block\">{{ error }}</span>\n    {% endfor %}\n  {% endif %}\n\n  {% if field.help_text %}\n    <span class=\"help-block\">{{ field.help_text|safe }}</span>\n  {% endif %}\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/list_field.html",
    "content": "<div class=\"form-group\">\n  {% if field.label %}\n    <label {% if style.hide_label %}class=\"sr-only\"{% endif %}>{{ field.label }}</label>\n  {% endif %}\n\n  <p class=\"form-control-static\">Lists are not currently supported in HTML input.</p>\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/list_fieldset.html",
    "content": "<fieldset>\n  {% if field.label %}\n    <legend {% if style.hide_label %}class=\"sr-only\"{% endif %}>\n      {{ field.label }}\n    </legend>\n  {% endif %}\n\n  <p>Lists are not currently supported in HTML input.</p>\n</fieldset>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/radio.html",
    "content": "{% load i18n %}\n{% load rest_framework %}\n{% trans \"None\" as none_choice %}\n\n<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label {% if style.hide_label %}class=\"sr-only\"{% endif %}>\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n    {% if style.inline %}\n      <div>\n        {% if field.allow_null or field.allow_blank %}\n          <label class=\"radio-inline\">\n            <input type=\"radio\" name=\"{{ field.name }}\" value=\"\" {% if not field.value %}checked{% endif %} />\n            {{ none_choice }}\n          </label>\n        {% endif %}\n\n        {% for key, text in field.choices|items %}\n          <label class=\"radio-inline\">\n            <input type=\"radio\" name=\"{{ field.name }}\" value=\"{{ key }}\" {% if key|as_string == field.value|as_string %}checked{% endif %}>\n            {{ text }}\n          </label>\n        {% endfor %}\n      </div>\n    {% else %}\n      {% if field.allow_null or field.allow_blank %}\n        <div class=\"radio\">\n          <label>\n            <input type=\"radio\" name=\"{{ field.name }}\" value=\"\" {% if not field.value %}checked{% endif %} />\n            {{ none_choice }}\n          </label>\n        </div>\n      {% endif %}\n\n      {% for key, text in field.choices|items %}\n        <div class=\"radio\">\n          <label>\n            <input type=\"radio\" name=\"{{ field.name }}\" value=\"{{ key }}\" {% if key|as_string == field.value|as_string %}checked{% endif %}>\n            {{ text }}\n          </label>\n        </div>\n      {% endfor %}\n    {% endif %}\n\n    {% if field.errors %}\n      {% for error in field.errors %}\n        <span class=\"help-block\">{{ error }}</span>\n      {% endfor %}\n    {% endif %}\n\n    {% if field.help_text %}\n      <span class=\"help-block\">{{ field.help_text|safe }}</span>\n    {% endif %}\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/select.html",
    "content": "{% load rest_framework %}\n\n<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label {% if style.hide_label %}class=\"sr-only\"{% endif %}>\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <select class=\"form-control\" name=\"{{ field.name }}\">\n    {% if field.allow_null or field.allow_blank %}\n      <option value=\"\" {% if not field.value %}selected{% endif %}>--------</option>\n    {% endif %}\n    {% for select in field.iter_options %}\n        {% if select.start_option_group %}\n          <optgroup label=\"{{ select.label }}\">\n        {% elif select.end_option_group %}\n          </optgroup>\n        {% else %}\n          <option value=\"{{ select.value }}\" {% if select.value|as_string == field.value|as_string %}selected{% endif %} {% if select.disabled %}disabled{% endif %}>{{ select.display_text }}</option>\n        {% endif %}\n    {% endfor %}\n  </select>\n\n  {% if field.errors %}\n    {% for error in field.errors %}\n      <span class=\"help-block\">{{ error }}</span>\n    {% endfor %}\n  {% endif %}\n\n  {% if field.help_text %}\n    <span class=\"help-block\">{{ field.help_text|safe }}</span>\n  {% endif %}\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/select_multiple.html",
    "content": "{% load i18n %}\n{% load rest_framework %}\n{% trans \"No items to select.\" as no_items %}\n\n<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label {% if style.hide_label %}class=\"sr-only\"{% endif %}>\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <select multiple {{ field.choices|yesno:\",disabled\" }} class=\"form-control\" name=\"{{ field.name }}\">\n    {% for select in field.iter_options %}\n        {% if select.start_option_group %}\n          <optgroup label=\"{{ select.label }}\">\n        {% elif select.end_option_group %}\n          </optgroup>\n        {% else %}\n          <option value=\"{{ select.value }}\" {% if select.value|as_string in field.value|as_list_of_strings %}selected{% endif %} {% if select.disabled %}disabled{% endif %}>{{ select.display_text }}</option>\n        {% endif %}\n    {% empty %}\n        <option>{{ no_items }}</option>\n    {% endfor %}\n  </select>\n\n    {% if field.errors %}\n      {% for error in field.errors %}<span class=\"help-block\">{{ error }}</span>{% endfor %}\n    {% endif %}\n\n    {% if field.help_text %}\n      <span class=\"help-block\">{{ field.help_text|safe }}</span>\n    {% endif %}\n</div>\n"
  },
  {
    "path": "rest_framework/templates/rest_framework/vertical/textarea.html",
    "content": "<div class=\"form-group {% if field.errors %}has-error{% endif %}\">\n  {% if field.label %}\n    <label {% if style.hide_label %}class=\"sr-only\"{% endif %}>\n      {{ field.label }}\n    </label>\n  {% endif %}\n\n  <textarea name=\"{{ field.name }}\" class=\"form-control\" {% if style.placeholder %}placeholder=\"{{ style.placeholder }}\"{% endif %} {% if style.rows %}rows=\"{{ style.rows }}\"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea>\n\n  {% if field.errors %}\n    {% for error in field.errors %}<span class=\"help-block\">{{ error }}</span>{% endfor %}\n  {% endif %}\n\n  {% if field.help_text %}\n    <span class=\"help-block\">{{ field.help_text|safe }}</span>\n  {% endif %}\n</div>\n"
  },
  {
    "path": "rest_framework/templatetags/__init__.py",
    "content": ""
  },
  {
    "path": "rest_framework/templatetags/rest_framework.py",
    "content": "import re\n\nfrom django import template\nfrom django.template import loader\nfrom django.urls import NoReverseMatch, reverse\nfrom django.utils.encoding import iri_to_uri\nfrom django.utils.html import escape, format_html, smart_urlquote\nfrom django.utils.safestring import mark_safe\n\nfrom rest_framework.compat import apply_markdown, pygments_highlight\nfrom rest_framework.renderers import HTMLFormRenderer\nfrom rest_framework.utils.urls import replace_query_param\n\nregister = template.Library()\n\n# Regex for adding classes to html snippets\nclass_re = re.compile(r'(?<=class=[\"\\'])(.*)(?=[\"\\'])')\n\n\n@register.tag(name='code')\ndef highlight_code(parser, token):\n    code = token.split_contents()[-1]\n    nodelist = parser.parse(('endcode',))\n    parser.delete_first_token()\n    return CodeNode(code, nodelist)\n\n\nclass CodeNode(template.Node):\n    style = 'emacs'\n\n    def __init__(self, lang, code):\n        self.lang = lang\n        self.nodelist = code\n\n    def render(self, context):\n        text = self.nodelist.render(context)\n        return pygments_highlight(text, self.lang, self.style)\n\n\n@register.simple_tag\ndef render_markdown(markdown_text):\n    if apply_markdown is None:\n        return markdown_text\n    return mark_safe(apply_markdown(markdown_text))\n\n\n@register.simple_tag\ndef get_pagination_html(pager):\n    return pager.to_html()\n\n\n@register.simple_tag\ndef render_form(serializer, template_pack=None):\n    style = {'template_pack': template_pack} if template_pack else {}\n    renderer = HTMLFormRenderer()\n    return renderer.render(serializer.data, None, {'style': style})\n\n\n@register.simple_tag\ndef render_field(field, style):\n    renderer = style.get('renderer', HTMLFormRenderer())\n    return renderer.render_field(field, style)\n\n\n@register.simple_tag\ndef optional_login(request):\n    \"\"\"\n    Include a login snippet if REST framework's login view is in the URLconf.\n    \"\"\"\n    try:\n        login_url = reverse('rest_framework:login')\n    except NoReverseMatch:\n        return ''\n\n    snippet = \"<li><a href='{href}?next={next}'>Log in</a></li>\"\n    snippet = format_html(snippet, href=login_url, next=escape(request.path))\n\n    return mark_safe(snippet)\n\n\n@register.simple_tag\ndef optional_docs_login(request):\n    \"\"\"\n    Include a login snippet if REST framework's login view is in the URLconf.\n    \"\"\"\n    try:\n        login_url = reverse('rest_framework:login')\n    except NoReverseMatch:\n        return 'log in'\n\n    snippet = \"<a href='{href}?next={next}'>log in</a>\"\n    snippet = format_html(snippet, href=login_url, next=escape(request.path))\n\n    return mark_safe(snippet)\n\n\n@register.simple_tag\ndef optional_logout(request, user, csrf_token):\n    \"\"\"\n    Include a logout snippet if REST framework's logout view is in the URLconf.\n    \"\"\"\n    try:\n        logout_url = reverse('rest_framework:logout')\n    except NoReverseMatch:\n        snippet = format_html('<li class=\"navbar-text\">{user}</li>', user=escape(user))\n        return mark_safe(snippet)\n\n    snippet = \"\"\"<li class=\"dropdown\">\n        <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">\n            {user}\n            <b class=\"caret\"></b>\n        </a>\n        <ul class=\"dropdown-menu\">\n            <form id=\"logoutForm\" method=\"post\" action=\"{href}?next={next}\">\n                <input type=\"hidden\" name=\"csrfmiddlewaretoken\" value=\"{csrf_token}\">\n            </form>\n            <li>\n                <a href=\"#\" onclick='document.getElementById(\"logoutForm\").submit()'>Log out</a>\n            </li>\n        </ul>\n    </li>\"\"\"\n    snippet = format_html(snippet, user=escape(user), href=logout_url,\n                          next=escape(request.path), csrf_token=csrf_token)\n    return mark_safe(snippet)\n\n\n@register.simple_tag\ndef add_query_param(request, key, val):\n    \"\"\"\n    Add a query parameter to the current request url, and return the new url.\n    \"\"\"\n    iri = request.get_full_path()\n    uri = iri_to_uri(iri)\n    return escape(replace_query_param(uri, key, val))\n\n\n@register.filter\ndef as_string(value):\n    if value is None:\n        return ''\n    return '%s' % value\n\n\n@register.filter\ndef as_list_of_strings(value):\n    return [\n        '' if (item is None) else ('%s' % item)\n        for item in value\n    ]\n\n\n@register.filter\ndef add_class(value, css_class):\n    \"\"\"\n    https://stackoverflow.com/questions/4124220/django-adding-css-classes-when-rendering-form-fields-in-a-template\n\n    Inserts classes into template variables that contain HTML tags,\n    useful for modifying forms without needing to change the Form objects.\n\n    Usage:\n\n        {{ field.label_tag|add_class:\"control-label\" }}\n\n    In the case of REST Framework, the filter is used to add Bootstrap-specific\n    classes to the forms.\n    \"\"\"\n    html = str(value)\n    match = class_re.search(html)\n    if match:\n        m = re.search(r'^%s$|^%s\\s|\\s%s\\s|\\s%s$' % (css_class, css_class,\n                                                    css_class, css_class),\n                      match.group(1))\n        if not m:\n            return mark_safe(class_re.sub(match.group(1) + \" \" + css_class,\n                                          html))\n    else:\n        return mark_safe(html.replace('>', ' class=\"%s\">' % css_class, 1))\n    return value\n\n\n@register.filter\ndef format_value(value):\n    if getattr(value, 'is_hyperlink', False):\n        name = str(value.obj)\n        return mark_safe('<a href=%s>%s</a>' % (value, escape(name)))\n    if value is None or isinstance(value, bool):\n        return mark_safe('<code>%s</code>' % {True: 'true', False: 'false', None: 'null'}[value])\n    elif isinstance(value, list):\n        if any(isinstance(item, (list, dict)) for item in value):\n            template = loader.get_template('rest_framework/admin/list_value.html')\n        else:\n            template = loader.get_template('rest_framework/admin/simple_list_value.html')\n        context = {'value': value}\n        return template.render(context)\n    elif isinstance(value, dict):\n        template = loader.get_template('rest_framework/admin/dict_value.html')\n        context = {'value': value}\n        return template.render(context)\n    elif isinstance(value, str):\n        if (\n            (value.startswith('http:') or value.startswith('https:') or value.startswith('/')) and not\n            re.search(r'\\s', value)\n        ):\n            return mark_safe('<a href=\"{value}\">{value}</a>'.format(value=escape(value)))\n        elif '@' in value and not re.search(r'\\s', value):\n            return mark_safe('<a href=\"mailto:{value}\">{value}</a>'.format(value=escape(value)))\n        elif '\\n' in value:\n            return mark_safe('<pre>%s</pre>' % escape(value))\n    return str(value)\n\n\n@register.filter\ndef items(value):\n    \"\"\"\n    Simple filter to return the items of the dict. Useful when the dict may\n    have a key 'items' which is resolved first in Django template dot-notation\n    lookup.  See issue #4931\n    Also see: https://stackoverflow.com/questions/15416662/django-template-loop-over-dictionary-items-with-items-as-key\n    \"\"\"\n    if value is None:\n        # `{% for k, v in value.items %}` doesn't raise when value is None or\n        # not in the context, so neither should `{% for k, v in value|items %}`\n        return []\n    return value.items()\n\n\n@register.filter\ndef add_nested_class(value):\n    if isinstance(value, dict):\n        return 'class=nested'\n    if isinstance(value, list) and any(isinstance(item, (list, dict)) for item in value):\n        return 'class=nested'\n    return ''\n\n\n# Bunch of stuff cloned from urlize\nTRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)', '\"', \"']\", \"'}\", \"'\"]\nWRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('[', ']'), ('&lt;', '&gt;'),\n                        ('\"', '\"'), (\"'\", \"'\")]\nword_split_re = re.compile(r'(\\s+)')\nsimple_url_re = re.compile(r'^https?://\\[?\\w', re.IGNORECASE)\nsimple_url_2_re = re.compile(r'^www\\.|^(?!http)\\w[^@]+\\.(com|edu|gov|int|mil|net|org)$', re.IGNORECASE)\nsimple_email_re = re.compile(r'^\\S+@\\S+\\.\\S+$')\n\n\ndef smart_urlquote_wrapper(matched_url):\n    \"\"\"\n    Simple wrapper for smart_urlquote. ValueError(\"Invalid IPv6 URL\") can\n    be raised here, see issue #1386\n    \"\"\"\n    try:\n        return smart_urlquote(matched_url)\n    except ValueError:\n        return None\n"
  },
  {
    "path": "rest_framework/test.py",
    "content": "# Note that we import as `DjangoRequestFactory` and `DjangoClient` in order\n# to make it harder for the user to import the wrong thing without realizing.\nimport io\nfrom importlib import import_module\n\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.handlers.wsgi import WSGIHandler\nfrom django.test import override_settings, testcases\nfrom django.test.client import Client as DjangoClient\nfrom django.test.client import ClientHandler\nfrom django.test.client import RequestFactory as DjangoRequestFactory\nfrom django.utils.encoding import force_bytes\nfrom django.utils.http import urlencode\n\nfrom rest_framework.compat import requests\nfrom rest_framework.settings import api_settings\n\n\ndef force_authenticate(request, user=None, token=None):\n    request._force_auth_user = user\n    request._force_auth_token = token\n\n\nif requests is not None:\n    class HeaderDict(requests.packages.urllib3._collections.HTTPHeaderDict):\n        def get_all(self, key, default):\n            return self.getheaders(key)\n\n    class MockOriginalResponse:\n        def __init__(self, headers):\n            self.msg = HeaderDict(headers)\n            self.closed = False\n\n        def isclosed(self):\n            return self.closed\n\n        def close(self):\n            self.closed = True\n\n    class DjangoTestAdapter(requests.adapters.HTTPAdapter):\n        \"\"\"\n        A transport adapter for `requests`, that makes requests via the\n        Django WSGI app, rather than making actual HTTP requests over the network.\n        \"\"\"\n        def __init__(self):\n            self.app = WSGIHandler()\n            self.factory = DjangoRequestFactory()\n\n        def get_environ(self, request):\n            \"\"\"\n            Given a `requests.PreparedRequest` instance, return a WSGI environ dict.\n            \"\"\"\n            method = request.method\n            url = request.url\n            kwargs = {}\n\n            # Set request content, if any exists.\n            if request.body is not None:\n                if hasattr(request.body, 'read'):\n                    kwargs['data'] = request.body.read()\n                else:\n                    kwargs['data'] = request.body\n            if 'content-type' in request.headers:\n                kwargs['content_type'] = request.headers['content-type']\n\n            # Set request headers.\n            for key, value in request.headers.items():\n                key = key.upper()\n                if key in ('CONNECTION', 'CONTENT-LENGTH', 'CONTENT-TYPE'):\n                    continue\n                kwargs['HTTP_%s' % key.replace('-', '_')] = value\n\n            return self.factory.generic(method, url, **kwargs).environ\n\n        def send(self, request, *args, **kwargs):\n            \"\"\"\n            Make an outgoing request to the Django WSGI application.\n            \"\"\"\n            raw_kwargs = {}\n\n            def start_response(wsgi_status, wsgi_headers, exc_info=None):\n                status, _, reason = wsgi_status.partition(' ')\n                raw_kwargs['status'] = int(status)\n                raw_kwargs['reason'] = reason\n                raw_kwargs['headers'] = wsgi_headers\n                raw_kwargs['version'] = 11\n                raw_kwargs['preload_content'] = False\n                raw_kwargs['original_response'] = MockOriginalResponse(wsgi_headers)\n\n            # Make the outgoing request via WSGI.\n            environ = self.get_environ(request)\n            wsgi_response = self.app(environ, start_response)\n\n            # Build the underlying urllib3.HTTPResponse\n            raw_kwargs['body'] = io.BytesIO(b''.join(wsgi_response))\n            raw = requests.packages.urllib3.HTTPResponse(**raw_kwargs)\n\n            # Build the requests.Response\n            return self.build_response(request, raw)\n\n        def close(self):\n            pass\n\n    class RequestsClient(requests.Session):\n        def __init__(self, *args, **kwargs):\n            super().__init__(*args, **kwargs)\n            adapter = DjangoTestAdapter()\n            self.mount('http://', adapter)\n            self.mount('https://', adapter)\n\n        def request(self, method, url, *args, **kwargs):\n            if not url.startswith('http'):\n                raise ValueError('Missing \"http:\" or \"https:\". Use a fully qualified URL, eg \"http://testserver%s\"' % url)\n            return super().request(method, url, *args, **kwargs)\n\nelse:\n    def RequestsClient(*args, **kwargs):\n        raise ImproperlyConfigured('requests must be installed in order to use RequestsClient.')\n\n\nclass APIRequestFactory(DjangoRequestFactory):\n    renderer_classes_list = api_settings.TEST_REQUEST_RENDERER_CLASSES\n    default_format = api_settings.TEST_REQUEST_DEFAULT_FORMAT\n\n    def __init__(self, enforce_csrf_checks=False, **defaults):\n        self.enforce_csrf_checks = enforce_csrf_checks\n        self.renderer_classes = {}\n        for cls in self.renderer_classes_list:\n            self.renderer_classes[cls.format] = cls\n        super().__init__(**defaults)\n\n    def _encode_data(self, data, format=None, content_type=None):\n        \"\"\"\n        Encode the data returning a two tuple of (bytes, content_type)\n        \"\"\"\n        if data is None:\n            return (b'', content_type)\n\n        assert format is None or content_type is None, (\n            'You may not set both `format` and `content_type`.'\n        )\n\n        if content_type:\n            try:\n                data = self._encode_json(data, content_type)\n            except AttributeError:\n                pass\n\n            # Content type specified explicitly, treat data as a raw bytestring\n            ret = force_bytes(data, settings.DEFAULT_CHARSET)\n\n        else:\n            format = format or self.default_format\n\n            assert format in self.renderer_classes, (\n                \"Invalid format '{}'. Available formats are {}. \"\n                \"Set TEST_REQUEST_RENDERER_CLASSES to enable \"\n                \"extra request formats.\".format(\n                    format,\n                    ', '.join([\"'\" + fmt + \"'\" for fmt in self.renderer_classes])\n                )\n            )\n\n            # Use format and render the data into a bytestring\n            renderer = self.renderer_classes[format]()\n            ret = renderer.render(data)\n\n            # Determine the content-type header from the renderer\n            content_type = renderer.media_type\n            if renderer.charset:\n                content_type = \"{}; charset={}\".format(\n                    content_type, renderer.charset\n                )\n\n            # Coerce text to bytes if required.\n            if isinstance(ret, str):\n                ret = ret.encode(renderer.charset)\n\n        return ret, content_type\n\n    def get(self, path, data=None, **extra):\n        r = {\n            'QUERY_STRING': urlencode(data or {}, doseq=True),\n        }\n        if not data and '?' in path:\n            # Fix to support old behavior where you have the arguments in the\n            # url. See #1461.\n            query_string = force_bytes(path.split('?')[1])\n            query_string = query_string.decode('iso-8859-1')\n            r['QUERY_STRING'] = query_string\n        r.update(extra)\n        return self.generic('GET', path, **r)\n\n    def post(self, path, data=None, format=None, content_type=None, **extra):\n        data, content_type = self._encode_data(data, format, content_type)\n        return self.generic('POST', path, data, content_type, **extra)\n\n    def put(self, path, data=None, format=None, content_type=None, **extra):\n        data, content_type = self._encode_data(data, format, content_type)\n        return self.generic('PUT', path, data, content_type, **extra)\n\n    def patch(self, path, data=None, format=None, content_type=None, **extra):\n        data, content_type = self._encode_data(data, format, content_type)\n        return self.generic('PATCH', path, data, content_type, **extra)\n\n    def delete(self, path, data=None, format=None, content_type=None, **extra):\n        data, content_type = self._encode_data(data, format, content_type)\n        return self.generic('DELETE', path, data, content_type, **extra)\n\n    def options(self, path, data=None, format=None, content_type=None, **extra):\n        data, content_type = self._encode_data(data, format, content_type)\n        return self.generic('OPTIONS', path, data, content_type, **extra)\n\n    def generic(self, method, path, data='',\n                content_type='application/octet-stream', secure=False, **extra):\n        # Include the CONTENT_TYPE, regardless of whether or not data is empty.\n        if content_type is not None:\n            extra['CONTENT_TYPE'] = str(content_type)\n\n        return super().generic(\n            method, path, data, content_type, secure, **extra)\n\n    def request(self, **kwargs):\n        request = super().request(**kwargs)\n        request._dont_enforce_csrf_checks = not self.enforce_csrf_checks\n        return request\n\n\nclass ForceAuthClientHandler(ClientHandler):\n    \"\"\"\n    A patched version of ClientHandler that can enforce authentication\n    on the outgoing requests.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        self._force_user = None\n        self._force_token = None\n        super().__init__(*args, **kwargs)\n\n    def get_response(self, request):\n        # This is the simplest place we can hook into to patch the\n        # request object.\n        force_authenticate(request, self._force_user, self._force_token)\n        return super().get_response(request)\n\n\nclass APIClient(APIRequestFactory, DjangoClient):\n    def __init__(self, enforce_csrf_checks=False, **defaults):\n        super().__init__(**defaults)\n        self.handler = ForceAuthClientHandler(enforce_csrf_checks)\n        self._credentials = {}\n\n    def credentials(self, **kwargs):\n        \"\"\"\n        Sets headers that will be used on every outgoing request.\n        \"\"\"\n        self._credentials = kwargs\n\n    def force_authenticate(self, user=None, token=None):\n        \"\"\"\n        Forcibly authenticates outgoing requests with the given\n        user and/or token.\n        \"\"\"\n        self.handler._force_user = user\n        self.handler._force_token = token\n        if user is None and token is None:\n            self.logout()  # Also clear any possible session info if required\n\n    def request(self, **kwargs):\n        # Ensure that any credentials set get added to every request.\n        kwargs.update(self._credentials)\n        return super().request(**kwargs)\n\n    def get(self, path, data=None, follow=False, **extra):\n        response = super().get(path, data=data, **extra)\n        if follow:\n            response = self._handle_redirects(response, data=data, **extra)\n        return response\n\n    def post(self, path, data=None, format=None, content_type=None,\n             follow=False, **extra):\n        response = super().post(\n            path, data=data, format=format, content_type=content_type, **extra)\n        if follow:\n            response = self._handle_redirects(response, data=data, format=format, content_type=content_type, **extra)\n        return response\n\n    def put(self, path, data=None, format=None, content_type=None,\n            follow=False, **extra):\n        response = super().put(\n            path, data=data, format=format, content_type=content_type, **extra)\n        if follow:\n            response = self._handle_redirects(response, data=data, format=format, content_type=content_type, **extra)\n        return response\n\n    def patch(self, path, data=None, format=None, content_type=None,\n              follow=False, **extra):\n        response = super().patch(\n            path, data=data, format=format, content_type=content_type, **extra)\n        if follow:\n            response = self._handle_redirects(response, data=data, format=format, content_type=content_type, **extra)\n        return response\n\n    def delete(self, path, data=None, format=None, content_type=None,\n               follow=False, **extra):\n        response = super().delete(\n            path, data=data, format=format, content_type=content_type, **extra)\n        if follow:\n            response = self._handle_redirects(response, data=data, format=format, content_type=content_type, **extra)\n        return response\n\n    def options(self, path, data=None, format=None, content_type=None,\n                follow=False, **extra):\n        response = super().options(\n            path, data=data, format=format, content_type=content_type, **extra)\n        if follow:\n            response = self._handle_redirects(response, data=data, format=format, content_type=content_type, **extra)\n        return response\n\n    def logout(self):\n        self._credentials = {}\n\n        # Also clear any `force_authenticate`\n        self.handler._force_user = None\n        self.handler._force_token = None\n\n        if self.session:\n            super().logout()\n\n\nclass APITransactionTestCase(testcases.TransactionTestCase):\n    client_class = APIClient\n\n\nclass APITestCase(testcases.TestCase):\n    client_class = APIClient\n\n\nclass APISimpleTestCase(testcases.SimpleTestCase):\n    client_class = APIClient\n\n\nclass APILiveServerTestCase(testcases.LiveServerTestCase):\n    client_class = APIClient\n\n\ndef cleanup_url_patterns(cls):\n    if hasattr(cls, '_module_urlpatterns'):\n        cls._module.urlpatterns = cls._module_urlpatterns\n    else:\n        del cls._module.urlpatterns\n\n\nclass URLPatternsTestCase(testcases.SimpleTestCase):\n    \"\"\"\n    Isolate URL patterns on a per-TestCase basis. For example,\n\n    class ATestCase(URLPatternsTestCase):\n        urlpatterns = [...]\n\n        def test_something(self):\n            ...\n\n    class AnotherTestCase(URLPatternsTestCase):\n        urlpatterns = [...]\n\n        def test_something_else(self):\n            ...\n    \"\"\"\n    @classmethod\n    def setUpClass(cls):\n        # Get the module of the TestCase subclass\n        cls._module = import_module(cls.__module__)\n        cls._override = override_settings(ROOT_URLCONF=cls.__module__)\n\n        if hasattr(cls._module, 'urlpatterns'):\n            cls._module_urlpatterns = cls._module.urlpatterns\n\n        cls._module.urlpatterns = cls.urlpatterns\n\n        cls._override.enable()\n\n        cls.addClassCleanup(cls._override.disable)\n        cls.addClassCleanup(cleanup_url_patterns, cls)\n\n        super().setUpClass()\n"
  },
  {
    "path": "rest_framework/throttling.py",
    "content": "\"\"\"\nProvides various throttling policies.\n\"\"\"\nimport time\n\nfrom django.core.cache import cache as default_cache\nfrom django.core.exceptions import ImproperlyConfigured\n\nfrom rest_framework.settings import api_settings\n\n\nclass BaseThrottle:\n    \"\"\"\n    Rate throttling of requests.\n    \"\"\"\n\n    def allow_request(self, request, view):\n        \"\"\"\n        Return `True` if the request should be allowed, `False` otherwise.\n        \"\"\"\n        raise NotImplementedError('.allow_request() must be overridden')\n\n    def get_ident(self, request):\n        \"\"\"\n        Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR\n        if present and number of proxies is > 0. If not use all of\n        HTTP_X_FORWARDED_FOR if it is available, if not use REMOTE_ADDR.\n        \"\"\"\n        xff = request.META.get('HTTP_X_FORWARDED_FOR')\n        remote_addr = request.META.get('REMOTE_ADDR')\n        num_proxies = api_settings.NUM_PROXIES\n\n        if num_proxies is not None:\n            if num_proxies == 0 or xff is None:\n                return remote_addr\n            addrs = xff.split(',')\n            client_addr = addrs[-min(num_proxies, len(addrs))]\n            return client_addr.strip()\n\n        return ''.join(xff.split()) if xff else remote_addr\n\n    def wait(self):\n        \"\"\"\n        Optionally, return a recommended number of seconds to wait before\n        the next request.\n        \"\"\"\n        return None\n\n\nclass SimpleRateThrottle(BaseThrottle):\n    \"\"\"\n    A simple cache implementation, that only requires `.get_cache_key()`\n    to be overridden.\n\n    The rate (requests / seconds) is set by a `rate` attribute on the Throttle\n    class.  The attribute is a string of the form 'number_of_requests/period'.\n\n    Period should be one of: ('s', 'sec', 'm', 'min', 'h', 'hour', 'd', 'day')\n\n    Previous request information used for throttling is stored in the cache.\n    \"\"\"\n    cache = default_cache\n    timer = time.time\n    cache_format = 'throttle_%(scope)s_%(ident)s'\n    scope = None\n    THROTTLE_RATES = api_settings.DEFAULT_THROTTLE_RATES\n\n    def __init__(self):\n        if not getattr(self, 'rate', None):\n            self.rate = self.get_rate()\n        self.num_requests, self.duration = self.parse_rate(self.rate)\n\n    def get_cache_key(self, request, view):\n        \"\"\"\n        Should return a unique cache-key which can be used for throttling.\n        Must be overridden.\n\n        May return `None` if the request should not be throttled.\n        \"\"\"\n        raise NotImplementedError('.get_cache_key() must be overridden')\n\n    def get_rate(self):\n        \"\"\"\n        Determine the string representation of the allowed request rate.\n        \"\"\"\n        if not getattr(self, 'scope', None):\n            msg = (\"You must set either `.scope` or `.rate` for '%s' throttle\" %\n                   self.__class__.__name__)\n            raise ImproperlyConfigured(msg)\n\n        try:\n            return self.THROTTLE_RATES[self.scope]\n        except KeyError:\n            msg = \"No default throttle rate set for '%s' scope\" % self.scope\n            raise ImproperlyConfigured(msg)\n\n    def parse_rate(self, rate):\n        \"\"\"\n        Given the request rate string, return a two tuple of:\n        <allowed number of requests>, <period of time in seconds>\n        \"\"\"\n        if rate is None:\n            return (None, None)\n        num, period = rate.split('/')\n        num_requests = int(num)\n        duration = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400}[period[0]]\n        return (num_requests, duration)\n\n    def allow_request(self, request, view):\n        \"\"\"\n        Implement the check to see if the request should be throttled.\n\n        On success calls `throttle_success`.\n        On failure calls `throttle_failure`.\n        \"\"\"\n        if self.rate is None:\n            return True\n\n        self.key = self.get_cache_key(request, view)\n        if self.key is None:\n            return True\n\n        self.history = self.cache.get(self.key, [])\n        self.now = self.timer()\n\n        # Drop any requests from the history which have now passed the\n        # throttle duration\n        while self.history and self.history[-1] <= self.now - self.duration:\n            self.history.pop()\n        if len(self.history) >= self.num_requests:\n            return self.throttle_failure()\n        return self.throttle_success()\n\n    def throttle_success(self):\n        \"\"\"\n        Inserts the current request's timestamp along with the key\n        into the cache.\n        \"\"\"\n        self.history.insert(0, self.now)\n        self.cache.set(self.key, self.history, self.duration)\n        return True\n\n    def throttle_failure(self):\n        \"\"\"\n        Called when a request to the API has failed due to throttling.\n        \"\"\"\n        return False\n\n    def wait(self):\n        \"\"\"\n        Returns the recommended next request time in seconds.\n        \"\"\"\n        if self.history:\n            remaining_duration = self.duration - (self.now - self.history[-1])\n        else:\n            remaining_duration = self.duration\n\n        available_requests = self.num_requests - len(self.history) + 1\n        if available_requests <= 0:\n            return None\n\n        return remaining_duration / float(available_requests)\n\n\nclass AnonRateThrottle(SimpleRateThrottle):\n    \"\"\"\n    Limits the rate of API calls that may be made by a anonymous users.\n\n    The IP address of the request will be used as the unique cache key.\n    \"\"\"\n    scope = 'anon'\n\n    def get_cache_key(self, request, view):\n        if request.user and request.user.is_authenticated:\n            return None  # Only throttle unauthenticated requests.\n\n        return self.cache_format % {\n            'scope': self.scope,\n            'ident': self.get_ident(request)\n        }\n\n\nclass UserRateThrottle(SimpleRateThrottle):\n    \"\"\"\n    Limits the rate of API calls that may be made by a given user.\n\n    The user id will be used as a unique cache key if the user is\n    authenticated.  For anonymous requests, the IP address of the request will\n    be used.\n    \"\"\"\n    scope = 'user'\n\n    def get_cache_key(self, request, view):\n        if request.user and request.user.is_authenticated:\n            ident = request.user.pk\n        else:\n            ident = self.get_ident(request)\n\n        return self.cache_format % {\n            'scope': self.scope,\n            'ident': ident\n        }\n\n\nclass ScopedRateThrottle(SimpleRateThrottle):\n    \"\"\"\n    Limits the rate of API calls by different amounts for various parts of\n    the API.  Any view that has the `throttle_scope` property set will be\n    throttled.  The unique cache key will be generated by concatenating the\n    user id of the request, and the scope of the view being accessed.\n    \"\"\"\n    scope_attr = 'throttle_scope'\n\n    def __init__(self):\n        # Override the usual SimpleRateThrottle, because we can't determine\n        # the rate until called by the view.\n        pass\n\n    def allow_request(self, request, view):\n        # We can only determine the scope once we're called by the view.\n        self.scope = getattr(view, self.scope_attr, None)\n\n        # If a view does not have a `throttle_scope` always allow the request\n        if not self.scope:\n            return True\n\n        # Determine the allowed request rate as we normally would during\n        # the `__init__` call.\n        self.rate = self.get_rate()\n        self.num_requests, self.duration = self.parse_rate(self.rate)\n\n        # We can now proceed as normal.\n        return super().allow_request(request, view)\n\n    def get_cache_key(self, request, view):\n        \"\"\"\n        If `view.throttle_scope` is not set, don't apply this throttle.\n\n        Otherwise generate the unique cache key by concatenating the user id\n        with the `.throttle_scope` property of the view.\n        \"\"\"\n        if request.user and request.user.is_authenticated:\n            ident = request.user.pk\n        else:\n            ident = self.get_ident(request)\n\n        return self.cache_format % {\n            'scope': self.scope,\n            'ident': ident\n        }\n"
  },
  {
    "path": "rest_framework/urlpatterns.py",
    "content": "from django.urls import URLResolver, include, path, re_path, register_converter\nfrom django.urls.converters import get_converters\nfrom django.urls.resolvers import RoutePattern\n\nfrom rest_framework.settings import api_settings\n\n\ndef _get_format_path_converter(allowed):\n    if allowed:\n        if len(allowed) == 1:\n            allowed_pattern = allowed[0]\n        else:\n            allowed_pattern = '(?:%s)' % '|'.join(allowed)\n        suffix_pattern = r\"\\.%s/?\" % allowed_pattern\n    else:\n        suffix_pattern = r\"\\.[a-z0-9]+/?\"\n\n    class FormatSuffixConverter:\n        regex = suffix_pattern\n\n        def to_python(self, value):\n            return value.strip('./')\n\n        def to_url(self, value):\n            return '.' + value + '/'\n\n    return FormatSuffixConverter\n\n\ndef _generate_converter_name(allowed):\n    converter_name = 'drf_format_suffix'\n    if allowed:\n        converter_name += '_' + '_'.join(allowed)\n    return converter_name\n\n\ndef apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_route=None):\n    ret = []\n    for urlpattern in urlpatterns:\n        if isinstance(urlpattern, URLResolver):\n            # Set of included URL patterns\n            regex = urlpattern.pattern.regex.pattern\n            namespace = urlpattern.namespace\n            app_name = urlpattern.app_name\n            kwargs = urlpattern.default_kwargs\n            # Add in the included patterns, after applying the suffixes\n            patterns = apply_suffix_patterns(urlpattern.url_patterns,\n                                             suffix_pattern,\n                                             suffix_required,\n                                             suffix_route)\n\n            # if the original pattern was a RoutePattern we need to preserve it\n            if isinstance(urlpattern.pattern, RoutePattern):\n                assert path is not None\n                route = str(urlpattern.pattern)\n                new_pattern = path(route, include((patterns, app_name), namespace), kwargs)\n            else:\n                new_pattern = re_path(regex, include((patterns, app_name), namespace), kwargs)\n\n            ret.append(new_pattern)\n        else:\n            # Regular URL pattern\n            regex = urlpattern.pattern.regex.pattern.rstrip('$').rstrip('/') + suffix_pattern\n            view = urlpattern.callback\n            kwargs = urlpattern.default_args\n            name = urlpattern.name\n            # Add in both the existing and the new urlpattern\n            if not suffix_required:\n                ret.append(urlpattern)\n\n            # if the original pattern was a RoutePattern we need to preserve it\n            if isinstance(urlpattern.pattern, RoutePattern):\n                assert path is not None\n                assert suffix_route is not None\n                route = str(urlpattern.pattern).rstrip('$').rstrip('/') + suffix_route\n                new_pattern = path(route, view, kwargs, name)\n            else:\n                new_pattern = re_path(regex, view, kwargs, name)\n\n            ret.append(new_pattern)\n\n    return ret\n\n\ndef format_suffix_patterns(urlpatterns, suffix_required=False, allowed=None):\n    \"\"\"\n    Supplement existing urlpatterns with corresponding patterns that also\n    include a '.format' suffix.  Retains urlpattern ordering.\n\n    urlpatterns:\n        A list of URL patterns.\n\n    suffix_required:\n        If `True`, only suffixed URLs will be generated, and non-suffixed\n        URLs will not be used.  Defaults to `False`.\n\n    allowed:\n        An optional tuple/list of allowed suffixes.  eg ['json', 'api']\n        Defaults to `None`, which allows any suffix.\n    \"\"\"\n    suffix_kwarg = api_settings.FORMAT_SUFFIX_KWARG\n    if allowed:\n        if len(allowed) == 1:\n            allowed_pattern = allowed[0]\n        else:\n            allowed_pattern = '(%s)' % '|'.join(allowed)\n        suffix_pattern = r'\\.(?P<%s>%s)/?$' % (suffix_kwarg, allowed_pattern)\n    else:\n        suffix_pattern = r'\\.(?P<%s>[a-z0-9]+)/?$' % suffix_kwarg\n\n    converter_name = _generate_converter_name(allowed)\n    if converter_name not in get_converters():\n        suffix_converter = _get_format_path_converter(allowed)\n        register_converter(suffix_converter, converter_name)\n\n    suffix_route = '<%s:%s>' % (converter_name, suffix_kwarg)\n\n    return apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_route)\n"
  },
  {
    "path": "rest_framework/urls.py",
    "content": "\"\"\"\nLogin and logout views for the browsable API.\n\nAdd these to your root URLconf if you're using the browsable API and\nyour API requires authentication:\n\n    urlpatterns = [\n        ...\n        path('auth/', include('rest_framework.urls'))\n    ]\n\nYou should make sure your authentication settings include `SessionAuthentication`.\n\"\"\"\nfrom django.contrib.auth import views\nfrom django.urls import path\n\napp_name = 'rest_framework'\nurlpatterns = [\n    path('login/', views.LoginView.as_view(template_name='rest_framework/login.html'), name='login'),\n    path('logout/', views.LogoutView.as_view(), name='logout'),\n]\n"
  },
  {
    "path": "rest_framework/utils/__init__.py",
    "content": ""
  },
  {
    "path": "rest_framework/utils/breadcrumbs.py",
    "content": "from django.urls import get_script_prefix, resolve\n\n\ndef get_breadcrumbs(url, request=None):\n    \"\"\"\n    Given a url returns a list of breadcrumbs, which are each a\n    tuple of (name, url).\n    \"\"\"\n    from rest_framework.reverse import preserve_builtin_query_params\n    from rest_framework.views import APIView\n\n    def breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen):\n        \"\"\"\n        Add tuples of (name, url) to the breadcrumbs list,\n        progressively chomping off parts of the url.\n        \"\"\"\n        try:\n            (view, unused_args, unused_kwargs) = resolve(url)\n        except Exception:\n            pass\n        else:\n            # Check if this is a REST framework view,\n            # and if so add it to the breadcrumbs\n            cls = getattr(view, 'cls', None)\n            initkwargs = getattr(view, 'initkwargs', {})\n            if cls is not None and issubclass(cls, APIView):\n                # Don't list the same view twice in a row.\n                # Probably an optional trailing slash.\n                if not seen or seen[-1] != view:\n                    c = cls(**initkwargs)\n                    name = c.get_view_name()\n                    insert_url = preserve_builtin_query_params(prefix + url, request)\n                    breadcrumbs_list.insert(0, (name, insert_url))\n                    seen.append(view)\n\n        if url == '':\n            # All done\n            return breadcrumbs_list\n\n        elif url.endswith('/'):\n            # Drop trailing slash off the end and continue to try to\n            # resolve more breadcrumbs\n            url = url.rstrip('/')\n            return breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen)\n\n        # Drop trailing non-slash off the end and continue to try to\n        # resolve more breadcrumbs\n        url = url[:url.rfind('/') + 1]\n        return breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen)\n\n    prefix = get_script_prefix().rstrip('/')\n    url = url[len(prefix):]\n    return breadcrumbs_recursive(url, [], prefix, [])\n"
  },
  {
    "path": "rest_framework/utils/encoders.py",
    "content": "\"\"\"\nHelper classes for parsers.\n\"\"\"\n\nimport contextlib\nimport datetime\nimport decimal\nimport ipaddress\nimport json  # noqa\nimport uuid\n\nfrom django.db.models.query import QuerySet\nfrom django.utils import timezone\nfrom django.utils.encoding import force_str\nfrom django.utils.functional import Promise\n\n\nclass JSONEncoder(json.JSONEncoder):\n    \"\"\"\n    JSONEncoder subclass that knows how to encode date/time/timedelta,\n    decimal types, generators and other basic python objects.\n    \"\"\"\n    def default(self, obj):\n        # For Date Time string spec, see ECMA 262\n        # https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.15\n        if isinstance(obj, Promise):\n            return force_str(obj)\n        elif isinstance(obj, datetime.datetime):\n            representation = obj.isoformat()\n            if representation.endswith('+00:00'):\n                representation = representation[:-6] + 'Z'\n            return representation\n        elif isinstance(obj, datetime.date):\n            return obj.isoformat()\n        elif isinstance(obj, datetime.time):\n            if timezone and timezone.is_aware(obj):\n                raise ValueError(\"JSON can't represent timezone-aware times.\")\n            representation = obj.isoformat()\n            return representation\n        elif isinstance(obj, datetime.timedelta):\n            return str(obj.total_seconds())\n        elif isinstance(obj, decimal.Decimal):\n            # Serializers will coerce decimals to strings by default.\n            return float(obj)\n        elif isinstance(obj, uuid.UUID):\n            return str(obj)\n        elif isinstance(obj, (\n            ipaddress.IPv4Address,\n            ipaddress.IPv6Address,\n            ipaddress.IPv4Network,\n            ipaddress.IPv6Network,\n            ipaddress.IPv4Interface,\n            ipaddress.IPv6Interface)\n        ):\n            return str(obj)\n        elif isinstance(obj, QuerySet):\n            return tuple(obj)\n        elif isinstance(obj, bytes):\n            # Best-effort for binary blobs. See #4187.\n            return obj.decode()\n        elif hasattr(obj, 'tolist'):\n            # Numpy arrays and array scalars.\n            return obj.tolist()\n        elif hasattr(obj, '__getitem__'):\n            cls = (list if isinstance(obj, (list, tuple)) else dict)\n            with contextlib.suppress(Exception):\n                return cls(obj)\n        elif hasattr(obj, '__iter__'):\n            return tuple(item for item in obj)\n        return super().default(obj)\n\n\nclass CustomScalar:\n    \"\"\"\n    CustomScalar that knows how to encode timedelta that renderer\n    can understand.\n    \"\"\"\n    @classmethod\n    def represent_timedelta(cls, dumper, data):\n        value = str(data.total_seconds())\n        return dumper.represent_scalar('tag:yaml.org,2002:str', value)\n"
  },
  {
    "path": "rest_framework/utils/field_mapping.py",
    "content": "\"\"\"\nHelper functions for mapping model fields to a dictionary of default\nkeyword arguments that should be used for their equivalent serializer fields.\n\"\"\"\nimport inspect\n\nfrom django.core import validators\nfrom django.db import models\nfrom django.utils.text import capfirst\n\nfrom rest_framework.compat import postgres_fields\nfrom rest_framework.validators import UniqueValidator\n\nNUMERIC_FIELD_TYPES = (\n    models.IntegerField, models.FloatField, models.DecimalField, models.DurationField,\n)\n\n\nclass ClassLookupDict:\n    \"\"\"\n    Takes a dictionary with classes as keys.\n    Lookups against this object will traverses the object's inheritance\n    hierarchy in method resolution order, and returns the first matching value\n    from the dictionary or raises a KeyError if nothing matches.\n    \"\"\"\n    def __init__(self, mapping):\n        self.mapping = mapping\n\n    def __getitem__(self, key):\n        if hasattr(key, '_proxy_class'):\n            # Deal with proxy classes. Ie. BoundField behaves as if it\n            # is a Field instance when using ClassLookupDict.\n            base_class = key._proxy_class\n        else:\n            base_class = key.__class__\n\n        for cls in inspect.getmro(base_class):\n            if cls in self.mapping:\n                return self.mapping[cls]\n        raise KeyError('Class %s not found in lookup.' % base_class.__name__)\n\n    def __setitem__(self, key, value):\n        self.mapping[key] = value\n\n\ndef needs_label(model_field, field_name):\n    \"\"\"\n    Returns `True` if the label based on the model's verbose name\n    is not equal to the default label it would have based on it's field name.\n    \"\"\"\n    default_label = field_name.replace('_', ' ').capitalize()\n    return capfirst(model_field.verbose_name) != default_label\n\n\ndef get_detail_view_name(model):\n    \"\"\"\n    Given a model class, return the view name to use for URL relationships\n    that refer to instances of the model.\n    \"\"\"\n    return '%(model_name)s-detail' % {\n        'model_name': model._meta.object_name.lower()\n    }\n\n\ndef get_unique_validators(field_name, model_field):\n    \"\"\"\n    Returns a list of UniqueValidators that should be applied to the field.\n    \"\"\"\n    field_set = {field_name}\n    conditions = {\n        c.condition\n        for c in model_field.model._meta.constraints\n        if isinstance(c, models.UniqueConstraint) and set(c.fields) == field_set\n    }\n    if getattr(model_field, 'unique', False):\n        conditions.add(None)\n    if not conditions:\n        return\n    unique_error_message = get_unique_error_message(model_field)\n    queryset = model_field.model._default_manager\n    for condition in conditions:\n        yield UniqueValidator(\n            queryset=queryset if condition is None else queryset.filter(condition),\n            message=unique_error_message\n        )\n\n\ndef get_field_kwargs(field_name, model_field):\n    \"\"\"\n    Creates a default instance of a basic non-relational field.\n    \"\"\"\n    kwargs = {}\n    validator_kwarg = list(model_field.validators)\n\n    # The following will only be used by ModelField classes.\n    # Gets removed for everything else.\n    kwargs['model_field'] = model_field\n\n    if model_field.verbose_name and needs_label(model_field, field_name):\n        kwargs['label'] = capfirst(model_field.verbose_name)\n\n    if model_field.help_text:\n        kwargs['help_text'] = model_field.help_text\n\n    max_digits = getattr(model_field, 'max_digits', None)\n    if max_digits is not None:\n        kwargs['max_digits'] = max_digits\n\n    decimal_places = getattr(model_field, 'decimal_places', None)\n    if decimal_places is not None:\n        kwargs['decimal_places'] = decimal_places\n\n    if isinstance(model_field, models.SlugField):\n        kwargs['allow_unicode'] = model_field.allow_unicode\n\n    if isinstance(model_field, models.TextField) and not model_field.choices or \\\n            (postgres_fields and isinstance(model_field, postgres_fields.JSONField)) or \\\n            (hasattr(models, 'JSONField') and isinstance(model_field, models.JSONField)):\n        kwargs['style'] = {'base_template': 'textarea.html'}\n\n    if model_field.null:\n        kwargs['allow_null'] = True\n\n    if isinstance(model_field, models.AutoField) or not model_field.editable:\n        # If this field is read-only, then return early.\n        # Further keyword arguments are not valid.\n        kwargs['read_only'] = True\n        return kwargs\n\n    if model_field.has_default() or model_field.blank or model_field.null:\n        kwargs['required'] = False\n\n    if model_field.blank and (isinstance(model_field, (models.CharField, models.TextField))):\n        kwargs['allow_blank'] = True\n\n    if not model_field.blank and (postgres_fields and isinstance(model_field, postgres_fields.ArrayField)):\n        kwargs['allow_empty'] = False\n\n    if isinstance(model_field, models.FilePathField):\n        kwargs['path'] = model_field.path\n\n        if model_field.match is not None:\n            kwargs['match'] = model_field.match\n\n        if model_field.recursive is not False:\n            kwargs['recursive'] = model_field.recursive\n\n        if model_field.allow_files is not True:\n            kwargs['allow_files'] = model_field.allow_files\n\n        if model_field.allow_folders is not False:\n            kwargs['allow_folders'] = model_field.allow_folders\n\n    if model_field.choices:\n        kwargs['choices'] = model_field.choices\n    else:\n        # Ensure that max_value is passed explicitly as a keyword arg,\n        # rather than as a validator.\n        max_value = next((\n            validator.limit_value for validator in validator_kwarg\n            if isinstance(validator, validators.MaxValueValidator)\n        ), None)\n        if max_value is not None and isinstance(model_field, NUMERIC_FIELD_TYPES):\n            kwargs['max_value'] = max_value\n            validator_kwarg = [\n                validator for validator in validator_kwarg\n                if not isinstance(validator, validators.MaxValueValidator)\n            ]\n\n        # Ensure that min_value is passed explicitly as a keyword arg,\n        # rather than as a validator.\n        min_value = next((\n            validator.limit_value for validator in validator_kwarg\n            if isinstance(validator, validators.MinValueValidator)\n        ), None)\n        if min_value is not None and isinstance(model_field, NUMERIC_FIELD_TYPES):\n            kwargs['min_value'] = min_value\n            validator_kwarg = [\n                validator for validator in validator_kwarg\n                if not isinstance(validator, validators.MinValueValidator)\n            ]\n\n        # URLField does not need to include the URLValidator argument,\n        # as it is explicitly added in.\n        if isinstance(model_field, models.URLField):\n            validator_kwarg = [\n                validator for validator in validator_kwarg\n                if not isinstance(validator, validators.URLValidator)\n            ]\n\n        # EmailField does not need to include the validate_email argument,\n        # as it is explicitly added in.\n        if isinstance(model_field, models.EmailField):\n            validator_kwarg = [\n                validator for validator in validator_kwarg\n                if validator is not validators.validate_email\n            ]\n\n        # SlugField do not need to include the 'validate_slug' argument,\n        if isinstance(model_field, models.SlugField):\n            validator_kwarg = [\n                validator for validator in validator_kwarg\n                if validator is not validators.validate_slug\n            ]\n\n        # IPAddressField do not need to include the 'validate_ipv46_address' argument,\n        if isinstance(model_field, models.GenericIPAddressField):\n            validator_kwarg = [\n                validator for validator in validator_kwarg\n                if validator is not validators.validate_ipv46_address\n            ]\n        # Our decimal validation is handled in the field code, not validator code.\n        if isinstance(model_field, models.DecimalField):\n            validator_kwarg = [\n                validator for validator in validator_kwarg\n                if not isinstance(validator, validators.DecimalValidator)\n            ]\n\n    # Ensure that max_length is passed explicitly as a keyword arg,\n    # rather than as a validator.\n    max_length = getattr(model_field, 'max_length', None)\n    if max_length is not None and (isinstance(model_field, (models.CharField, models.TextField, models.FileField))):\n        kwargs['max_length'] = max_length\n        validator_kwarg = [\n            validator for validator in validator_kwarg\n            if not isinstance(validator, validators.MaxLengthValidator)\n        ]\n\n    # Ensure that min_length is passed explicitly as a keyword arg,\n    # rather than as a validator.\n    min_length = next((\n        validator.limit_value for validator in validator_kwarg\n        if isinstance(validator, validators.MinLengthValidator)\n    ), None)\n    if min_length is not None and isinstance(model_field, models.CharField):\n        kwargs['min_length'] = min_length\n        validator_kwarg = [\n            validator for validator in validator_kwarg\n            if not isinstance(validator, validators.MinLengthValidator)\n        ]\n\n    validator_kwarg += get_unique_validators(field_name, model_field)\n\n    if validator_kwarg:\n        kwargs['validators'] = validator_kwarg\n\n    return kwargs\n\n\ndef get_relation_kwargs(field_name, relation_info):\n    \"\"\"\n    Creates a default instance of a flat relational field.\n    \"\"\"\n    model_field, related_model, to_many, to_field, has_through_model, reverse = relation_info\n    kwargs = {\n        'queryset': related_model._default_manager,\n        'view_name': get_detail_view_name(related_model)\n    }\n\n    if to_many:\n        kwargs['many'] = True\n\n    if to_field:\n        kwargs['to_field'] = to_field\n\n    limit_choices_to = model_field and model_field.get_limit_choices_to()\n    if limit_choices_to:\n        if not isinstance(limit_choices_to, models.Q):\n            limit_choices_to = models.Q(**limit_choices_to)\n        kwargs['queryset'] = kwargs['queryset'].filter(limit_choices_to)\n\n    if has_through_model:\n        kwargs['read_only'] = True\n        kwargs.pop('queryset', None)\n\n    if model_field:\n        if model_field.verbose_name and needs_label(model_field, field_name):\n            kwargs['label'] = capfirst(model_field.verbose_name)\n        help_text = model_field.help_text\n        if help_text:\n            kwargs['help_text'] = help_text\n        if not model_field.editable:\n            kwargs['read_only'] = True\n            kwargs.pop('queryset', None)\n        if model_field.null:\n            kwargs['allow_null'] = True\n        if kwargs.get('read_only', False):\n            # If this field is read-only, then return early.\n            # No further keyword arguments are valid.\n            return kwargs\n\n        if model_field.has_default() or model_field.blank or model_field.null:\n            kwargs['required'] = False\n        if model_field.validators:\n            kwargs['validators'] = model_field.validators\n        if getattr(model_field, 'unique', False):\n            validator = UniqueValidator(\n                queryset=model_field.model._default_manager,\n                message=get_unique_error_message(model_field))\n            kwargs['validators'] = kwargs.get('validators', []) + [validator]\n        if to_many and not model_field.blank:\n            kwargs['allow_empty'] = False\n\n    return kwargs\n\n\ndef get_nested_relation_kwargs(relation_info):\n    kwargs = {'read_only': True}\n    if relation_info.to_many:\n        kwargs['many'] = True\n    return kwargs\n\n\ndef get_url_kwargs(model_field):\n    return {\n        'view_name': get_detail_view_name(model_field)\n    }\n\n\ndef get_unique_error_message(model_field):\n    unique_error_message = model_field.error_messages.get('unique', None)\n    if unique_error_message:\n        unique_error_message = unique_error_message % {\n            'model_name': model_field.model._meta.verbose_name,\n            'field_label': model_field.verbose_name\n        }\n    return unique_error_message\n"
  },
  {
    "path": "rest_framework/utils/formatting.py",
    "content": "\"\"\"\nUtility functions to return a formatted name and description for a given view.\n\"\"\"\nimport re\n\nfrom django.utils.encoding import force_str\nfrom django.utils.html import escape\nfrom django.utils.safestring import mark_safe\n\nfrom rest_framework.compat import apply_markdown\n\n\ndef remove_trailing_string(content, trailing):\n    \"\"\"\n    Strip trailing component `trailing` from `content` if it exists.\n    Used when generating names from view classes.\n    \"\"\"\n    if content.endswith(trailing) and content != trailing:\n        return content[:-len(trailing)]\n    return content\n\n\ndef dedent(content):\n    \"\"\"\n    Remove leading indent from a block of text.\n    Used when generating descriptions from docstrings.\n\n    Note that python's `textwrap.dedent` doesn't quite cut it,\n    as it fails to dedent multiline docstrings that include\n    unindented text on the initial line.\n    \"\"\"\n    content = force_str(content)\n    lines = [line for line in content.splitlines()[1:] if line.lstrip()]\n\n    # unindent the content if needed\n    if lines:\n        whitespace_counts = min([len(line) - len(line.lstrip(' ')) for line in lines])\n        tab_counts = min([len(line) - len(line.lstrip('\\t')) for line in lines])\n        if whitespace_counts:\n            whitespace_pattern = '^' + (' ' * whitespace_counts)\n            content = re.sub(re.compile(whitespace_pattern, re.MULTILINE), '', content)\n        elif tab_counts:\n            whitespace_pattern = '^' + ('\\t' * tab_counts)\n            content = re.sub(re.compile(whitespace_pattern, re.MULTILINE), '', content)\n    return content.strip()\n\n\ndef camelcase_to_spaces(content):\n    \"\"\"\n    Translate 'CamelCaseNames' to 'Camel Case Names'.\n    Used when generating names from view classes.\n    \"\"\"\n    camelcase_boundary = '(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))'\n    content = re.sub(camelcase_boundary, ' \\\\1', content).strip()\n    return ' '.join(content.split('_')).title()\n\n\ndef markup_description(description):\n    \"\"\"\n    Apply HTML markup to the given description.\n    \"\"\"\n    if apply_markdown:\n        description = apply_markdown(description)\n    else:\n        description = escape(description).replace('\\n', '<br />')\n        description = '<p>' + description + '</p>'\n    return mark_safe(description)\n\n\nclass lazy_format:\n    \"\"\"\n    Delay formatting until it's actually needed.\n\n    Useful when the format string or one of the arguments is lazy.\n\n    Not using Django's lazy because it is too slow.\n    \"\"\"\n    __slots__ = ('format_string', 'args', 'kwargs', 'result')\n\n    def __init__(self, format_string, *args, **kwargs):\n        self.result = None\n        self.format_string = format_string\n        self.args = args\n        self.kwargs = kwargs\n\n    def __str__(self):\n        if self.result is None:\n            self.result = self.format_string.format(*self.args, **self.kwargs)\n            self.format_string, self.args, self.kwargs = None, None, None\n        return self.result\n\n    def __mod__(self, value):\n        return str(self) % value\n"
  },
  {
    "path": "rest_framework/utils/html.py",
    "content": "\"\"\"\nHelpers for dealing with HTML input.\n\"\"\"\nimport re\n\nfrom django.utils.datastructures import MultiValueDict\n\n\ndef is_html_input(dictionary):\n    # MultiDict type datastructures are used to represent HTML form input,\n    # which may have more than one value for each key.\n    return hasattr(dictionary, 'getlist')\n\n\ndef parse_html_list(dictionary, prefix='', default=None):\n    \"\"\"\n    Used to support list values in HTML forms.\n    Supports lists of primitives and/or dictionaries.\n\n    * List of primitives.\n\n    {\n        '[0]': 'abc',\n        '[1]': 'def',\n        '[2]': 'hij'\n    }\n        -->\n    [\n        'abc',\n        'def',\n        'hij'\n    ]\n\n    * List of dictionaries.\n\n    {\n        '[0]foo': 'abc',\n        '[0]bar': 'def',\n        '[1]foo': 'hij',\n        '[1]bar': 'klm',\n    }\n        -->\n    [\n        {'foo': 'abc', 'bar': 'def'},\n        {'foo': 'hij', 'bar': 'klm'}\n    ]\n\n    :returns a list of objects, or the value specified in ``default`` if the list is empty\n    \"\"\"\n    ret = {}\n    regex = re.compile(r'^%s\\[([0-9]+)\\](.*)$' % re.escape(prefix))\n    for field, value in dictionary.items():\n        match = regex.match(field)\n        if not match:\n            continue\n        index, key = match.groups()\n        index = int(index)\n        if not key:\n            ret[index] = value\n        elif isinstance(ret.get(index), dict):\n            ret[index][key] = value\n        else:\n            ret[index] = MultiValueDict({key: [value]})\n\n    # return the items of the ``ret`` dict, sorted by key, or ``default`` if the dict is empty\n    return [ret[item] for item in sorted(ret)] if ret else default\n\n\ndef parse_html_dict(dictionary, prefix=''):\n    \"\"\"\n    Used to support dictionary values in HTML forms.\n\n    {\n        'profile.username': 'example',\n        'profile.email': 'example@example.com',\n    }\n        -->\n    {\n        'profile': {\n            'username': 'example',\n            'email': 'example@example.com'\n        }\n    }\n    \"\"\"\n    ret = MultiValueDict()\n    regex = re.compile(r'^%s\\.(.+)$' % re.escape(prefix))\n    for field in dictionary:\n        match = regex.match(field)\n        if not match:\n            continue\n        key = match.groups()[0]\n        value = dictionary.getlist(field)\n        ret.setlist(key, value)\n\n    return ret\n"
  },
  {
    "path": "rest_framework/utils/humanize_datetime.py",
    "content": "\"\"\"\nHelper functions that convert strftime formats into more readable representations.\n\"\"\"\nfrom rest_framework import ISO_8601\n\n\ndef datetime_formats(formats):\n    format = ', '.join(formats).replace(\n        ISO_8601,\n        'YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z]'\n    )\n    return humanize_strptime(format)\n\n\ndef date_formats(formats):\n    format = ', '.join(formats).replace(ISO_8601, 'YYYY-MM-DD')\n    return humanize_strptime(format)\n\n\ndef time_formats(formats):\n    format = ', '.join(formats).replace(ISO_8601, 'hh:mm[:ss[.uuuuuu]]')\n    return humanize_strptime(format)\n\n\ndef humanize_strptime(format_string):\n    # Note that we're missing some of the locale specific mappings that\n    # don't really make sense.\n    mapping = {\n        \"%Y\": \"YYYY\",\n        \"%y\": \"YY\",\n        \"%m\": \"MM\",\n        \"%b\": \"[Jan-Dec]\",\n        \"%B\": \"[January-December]\",\n        \"%d\": \"DD\",\n        \"%H\": \"hh\",\n        \"%I\": \"hh\",  # Requires '%p' to differentiate from '%H'.\n        \"%M\": \"mm\",\n        \"%S\": \"ss\",\n        \"%f\": \"uuuuuu\",\n        \"%a\": \"[Mon-Sun]\",\n        \"%A\": \"[Monday-Sunday]\",\n        \"%p\": \"[AM|PM]\",\n        \"%z\": \"[+HHMM|-HHMM]\"\n    }\n    for key, val in mapping.items():\n        format_string = format_string.replace(key, val)\n    return format_string\n"
  },
  {
    "path": "rest_framework/utils/json.py",
    "content": "\"\"\"\nWrapper for the builtin json module that ensures compliance with the JSON spec.\n\nREST framework should always import this wrapper module in order to maintain\nspec-compliant encoding/decoding. Support for non-standard features should be\nhandled by users at the renderer and parser layer.\n\"\"\"\nimport functools\nimport json  # noqa\n\n\ndef strict_constant(o):\n    raise ValueError('Out of range float values are not JSON compliant: ' + repr(o))\n\n\n@functools.wraps(json.dump)\ndef dump(*args, **kwargs):\n    kwargs.setdefault('allow_nan', False)\n    return json.dump(*args, **kwargs)\n\n\n@functools.wraps(json.dumps)\ndef dumps(*args, **kwargs):\n    kwargs.setdefault('allow_nan', False)\n    return json.dumps(*args, **kwargs)\n\n\n@functools.wraps(json.load)\ndef load(*args, **kwargs):\n    kwargs.setdefault('parse_constant', strict_constant)\n    return json.load(*args, **kwargs)\n\n\n@functools.wraps(json.loads)\ndef loads(*args, **kwargs):\n    kwargs.setdefault('parse_constant', strict_constant)\n    return json.loads(*args, **kwargs)\n"
  },
  {
    "path": "rest_framework/utils/mediatypes.py",
    "content": "\"\"\"\nHandling of media types, as found in HTTP Content-Type and Accept headers.\n\nSee https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7\n\"\"\"\nfrom django.utils.http import parse_header_parameters\n\n\ndef media_type_matches(lhs, rhs):\n    \"\"\"\n    Returns ``True`` if the media type in the first argument <= the\n    media type in the second argument.  The media types are strings\n    as described by the HTTP spec.\n\n    Valid media type strings include:\n\n    'application/json; indent=4'\n    'application/json'\n    'text/*'\n    '*/*'\n    \"\"\"\n    lhs = _MediaType(lhs)\n    rhs = _MediaType(rhs)\n    return lhs.match(rhs)\n\n\ndef order_by_precedence(media_type_lst):\n    \"\"\"\n    Returns a list of sets of media type strings, ordered by precedence.\n    Precedence is determined by how specific a media type is:\n\n    3. 'type/subtype; param=val'\n    2. 'type/subtype'\n    1. 'type/*'\n    0. '*/*'\n    \"\"\"\n    ret = [set(), set(), set(), set()]\n    for media_type in media_type_lst:\n        precedence = _MediaType(media_type).precedence\n        ret[3 - precedence].add(media_type)\n    return [media_types for media_types in ret if media_types]\n\n\nclass _MediaType:\n    def __init__(self, media_type_str):\n        self.orig = '' if (media_type_str is None) else media_type_str\n        self.full_type, self.params = parse_header_parameters(self.orig)\n        self.main_type, sep, self.sub_type = self.full_type.partition('/')\n\n    def match(self, other):\n        \"\"\"Return true if this MediaType satisfies the given MediaType.\"\"\"\n        for key in self.params:\n            if key != 'q' and other.params.get(key, None) != self.params.get(key, None):\n                return False\n\n        if self.sub_type != '*' and other.sub_type != '*' and other.sub_type != self.sub_type:\n            return False\n\n        if self.main_type != '*' and other.main_type != '*' and other.main_type != self.main_type:\n            return False\n\n        return True\n\n    @property\n    def precedence(self):\n        \"\"\"\n        Return a precedence level from 0-3 for the media type given how specific it is.\n        \"\"\"\n        if self.main_type == '*':\n            return 0\n        elif self.sub_type == '*':\n            return 1\n        elif not self.params or list(self.params) == ['q']:\n            return 2\n        return 3\n\n    def __str__(self):\n        ret = \"%s/%s\" % (self.main_type, self.sub_type)\n        for key, val in self.params.items():\n            ret += \"; %s=%s\" % (key, val)\n        return ret\n"
  },
  {
    "path": "rest_framework/utils/model_meta.py",
    "content": "\"\"\"\nHelper function for returning the field information that is associated\nwith a model class. This includes returning all the forward and reverse\nrelationships and their associated metadata.\n\nUsage: `get_field_info(model)` returns a `FieldInfo` instance.\n\"\"\"\nfrom collections import namedtuple\n\nFieldInfo = namedtuple('FieldInfo', [\n    'pk',  # Model field instance\n    'fields',  # Dict of field name -> model field instance\n    'forward_relations',  # Dict of field name -> RelationInfo\n    'reverse_relations',  # Dict of field name -> RelationInfo\n    'fields_and_pk',  # Shortcut for 'pk' + 'fields'\n    'relations'  # Shortcut for 'forward_relations' + 'reverse_relations'\n])\n\nRelationInfo = namedtuple('RelationInfo', [\n    'model_field',\n    'related_model',\n    'to_many',\n    'to_field',\n    'has_through_model',\n    'reverse'\n])\n\n\ndef get_field_info(model):\n    \"\"\"\n    Given a model class, returns a `FieldInfo` instance, which is a\n    `namedtuple`, containing metadata about the various field types on the model\n    including information about their relationships.\n    \"\"\"\n    opts = model._meta.concrete_model._meta\n\n    pk = _get_pk(opts)\n    fields = _get_fields(opts)\n    forward_relations = _get_forward_relationships(opts)\n    reverse_relations = _get_reverse_relationships(opts)\n    fields_and_pk = _merge_fields_and_pk(pk, fields)\n    relationships = _merge_relationships(forward_relations, reverse_relations)\n\n    return FieldInfo(pk, fields, forward_relations, reverse_relations,\n                     fields_and_pk, relationships)\n\n\ndef _get_pk(opts):\n    pk = opts.pk\n    rel = pk.remote_field\n\n    while rel and rel.parent_link:\n        # If model is a child via multi-table inheritance, use parent's pk.\n        pk = pk.remote_field.model._meta.pk\n        rel = pk.remote_field\n\n    return pk\n\n\ndef _get_fields(opts):\n    fields = {}\n    for field in [field for field in opts.fields if field.serialize and not field.remote_field]:\n        fields[field.name] = field\n\n    return fields\n\n\ndef _get_to_field(field):\n    return getattr(field, 'to_fields', None) and field.to_fields[0]\n\n\ndef _get_forward_relationships(opts):\n    \"\"\"\n    Returns a dict of field names to `RelationInfo`.\n    \"\"\"\n    forward_relations = {}\n    for field in [field for field in opts.fields if field.serialize and field.remote_field]:\n        forward_relations[field.name] = RelationInfo(\n            model_field=field,\n            related_model=field.remote_field.model,\n            to_many=False,\n            to_field=_get_to_field(field),\n            has_through_model=False,\n            reverse=False\n        )\n\n    # Deal with forward many-to-many relationships.\n    for field in [field for field in opts.many_to_many if field.serialize]:\n        forward_relations[field.name] = RelationInfo(\n            model_field=field,\n            related_model=field.remote_field.model,\n            to_many=True,\n            # manytomany do not have to_fields\n            to_field=None,\n            has_through_model=(\n                not field.remote_field.through._meta.auto_created\n            ),\n            reverse=False\n        )\n\n    return forward_relations\n\n\ndef _get_reverse_relationships(opts):\n    \"\"\"\n    Returns a dict of field names to `RelationInfo`.\n    \"\"\"\n    reverse_relations = {}\n    all_related_objects = [r for r in opts.related_objects if not r.field.many_to_many]\n    for relation in all_related_objects:\n        accessor_name = relation.get_accessor_name()\n        reverse_relations[accessor_name] = RelationInfo(\n            model_field=None,\n            related_model=relation.related_model,\n            to_many=relation.field.remote_field.multiple,\n            to_field=_get_to_field(relation.field),\n            has_through_model=False,\n            reverse=True\n        )\n\n    # Deal with reverse many-to-many relationships.\n    all_related_many_to_many_objects = [r for r in opts.related_objects if r.field.many_to_many]\n    for relation in all_related_many_to_many_objects:\n        accessor_name = relation.get_accessor_name()\n        reverse_relations[accessor_name] = RelationInfo(\n            model_field=None,\n            related_model=relation.related_model,\n            to_many=True,\n            # manytomany do not have to_fields\n            to_field=None,\n            has_through_model=(\n                (getattr(relation.field.remote_field, 'through', None) is not None) and\n                not relation.field.remote_field.through._meta.auto_created\n            ),\n            reverse=True\n        )\n\n    return reverse_relations\n\n\ndef _merge_fields_and_pk(pk, fields):\n    fields_and_pk = {'pk': pk, pk.name: pk}\n    fields_and_pk.update(fields)\n\n    return fields_and_pk\n\n\ndef _merge_relationships(forward_relations, reverse_relations):\n    return {**forward_relations, **reverse_relations}\n\n\ndef is_abstract_model(model):\n    \"\"\"\n    Given a model class, returns a boolean True if it is abstract and False if it is not.\n    \"\"\"\n    return hasattr(model, '_meta') and hasattr(model._meta, 'abstract') and model._meta.abstract\n"
  },
  {
    "path": "rest_framework/utils/representation.py",
    "content": "\"\"\"\nHelper functions for creating user-friendly representations\nof serializer classes and serializer fields.\n\"\"\"\nimport re\n\nfrom django.db import models\nfrom django.utils.encoding import force_str\nfrom django.utils.functional import Promise\n\n\ndef manager_repr(value):\n    model = value.model\n    opts = model._meta\n    names_and_managers = [\n        (manager.name, manager)\n        for manager\n        in opts.managers\n    ]\n    for manager_name, manager_instance in names_and_managers:\n        if manager_instance == value:\n            return '%s.%s.all()' % (model._meta.object_name, manager_name)\n    return repr(value)\n\n\ndef smart_repr(value):\n    if isinstance(value, models.Manager):\n        return manager_repr(value)\n\n    if isinstance(value, Promise):\n        value = force_str(value, strings_only=True)\n\n    value = repr(value)\n\n    # Representations like u'help text'\n    # should simply be presented as 'help text'\n    if value.startswith(\"u'\") and value.endswith(\"'\"):\n        return value[1:]\n\n    # Representations like\n    # <django.core.validators.RegexValidator object at 0x1047af050>\n    # Should be presented as\n    # <django.core.validators.RegexValidator object>\n    return re.sub(' at 0x[0-9A-Fa-f]{4,32}>', '>', value)\n\n\ndef field_repr(field, force_many=False):\n    kwargs = field._kwargs\n    if force_many:\n        kwargs = kwargs.copy()\n        kwargs['many'] = True\n        kwargs.pop('child', None)\n\n    arg_string = ', '.join([smart_repr(val) for val in field._args])\n    kwarg_string = ', '.join([\n        '%s=%s' % (key, smart_repr(val))\n        for key, val in sorted(kwargs.items())\n    ])\n    if arg_string and kwarg_string:\n        arg_string += ', '\n\n    if force_many:\n        class_name = force_many.__class__.__name__\n    else:\n        class_name = field.__class__.__name__\n\n    return \"%s(%s%s)\" % (class_name, arg_string, kwarg_string)\n\n\ndef serializer_repr(serializer, indent, force_many=None):\n    ret = field_repr(serializer, force_many) + ':'\n    indent_str = '    ' * indent\n\n    if force_many:\n        fields = force_many.fields\n    else:\n        fields = serializer.fields\n\n    for field_name, field in fields.items():\n        ret += '\\n' + indent_str + field_name + ' = '\n        if hasattr(field, 'fields'):\n            ret += serializer_repr(field, indent + 1)\n        elif hasattr(field, 'child'):\n            ret += list_repr(field, indent + 1)\n        elif hasattr(field, 'child_relation'):\n            ret += field_repr(field.child_relation, force_many=field.child_relation)\n        else:\n            ret += field_repr(field)\n\n    if serializer.validators:\n        ret += '\\n' + indent_str + 'class Meta:'\n        ret += '\\n' + indent_str + '    validators = ' + smart_repr(serializer.validators)\n\n    return ret\n\n\ndef list_repr(serializer, indent):\n    child = serializer.child\n    if hasattr(child, 'fields'):\n        return serializer_repr(serializer, indent, force_many=child)\n    return field_repr(serializer)\n"
  },
  {
    "path": "rest_framework/utils/serializer_helpers.py",
    "content": "import contextlib\nfrom collections.abc import Mapping, MutableMapping\n\nfrom django.utils.encoding import force_str\n\nfrom rest_framework.utils import json\n\n\nclass ReturnDict(dict):\n    \"\"\"\n    Return object from `serializer.data` for the `Serializer` class.\n    Includes a backlink to the serializer instance for renderers\n    to use if they need richer field information.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        self.serializer = kwargs.pop('serializer')\n        super().__init__(*args, **kwargs)\n\n    def copy(self):\n        return ReturnDict(self, serializer=self.serializer)\n\n    def __repr__(self):\n        return dict.__repr__(self)\n\n    def __reduce__(self):\n        # Pickling these objects will drop the .serializer backlink,\n        # but preserve the raw data.\n        return (dict, (dict(self),))\n\n    # These are basically copied from OrderedDict, with `serializer` added.\n    def __or__(self, other):\n        if not isinstance(other, dict):\n            return NotImplemented\n        new = self.__class__(self, serializer=self.serializer)\n        new.update(other)\n        return new\n\n    def __ror__(self, other):\n        if not isinstance(other, dict):\n            return NotImplemented\n        new = self.__class__(other, serializer=self.serializer)\n        new.update(self)\n        return new\n\n\nclass ReturnList(list):\n    \"\"\"\n    Return object from `serializer.data` for the `SerializerList` class.\n    Includes a backlink to the serializer instance for renderers\n    to use if they need richer field information.\n    \"\"\"\n\n    def __init__(self, *args, **kwargs):\n        self.serializer = kwargs.pop('serializer')\n        super().__init__(*args, **kwargs)\n\n    def __repr__(self):\n        return list.__repr__(self)\n\n    def __reduce__(self):\n        # Pickling these objects will drop the .serializer backlink,\n        # but preserve the raw data.\n        return (list, (list(self),))\n\n\nclass BoundField:\n    \"\"\"\n    A field object that also includes `.value` and `.error` properties.\n    Returned when iterating over a serializer instance,\n    providing an API similar to Django forms and form fields.\n    \"\"\"\n\n    def __init__(self, field, value, errors, prefix=''):\n        self._field = field\n        self._prefix = prefix\n        self.value = value\n        self.errors = errors\n        self.name = prefix + self.field_name\n\n    def __getattr__(self, attr_name):\n        return getattr(self._field, attr_name)\n\n    @property\n    def _proxy_class(self):\n        return self._field.__class__\n\n    def __repr__(self):\n        return '<%s value=%s errors=%s>' % (\n            self.__class__.__name__, self.value, self.errors\n        )\n\n    def as_form_field(self):\n        value = '' if (self.value is None or self.value is False) else self.value\n        return self.__class__(self._field, value, self.errors, self._prefix)\n\n\nclass JSONBoundField(BoundField):\n    def as_form_field(self):\n        value = self.value\n        # When HTML form input is used and the input is not valid\n        # value will be a JSONString, rather than a JSON primitive.\n        if not getattr(value, 'is_json_string', False):\n            with contextlib.suppress(TypeError, ValueError):\n                value = json.dumps(\n                    self.value,\n                    sort_keys=True,\n                    indent=4,\n                    separators=(',', ': '),\n                )\n        return self.__class__(self._field, value, self.errors, self._prefix)\n\n\nclass NestedBoundField(BoundField):\n    \"\"\"\n    This `BoundField` additionally implements __iter__ and __getitem__\n    in order to support nested bound fields. This class is the type of\n    `BoundField` that is used for serializer fields.\n    \"\"\"\n\n    def __init__(self, field, value, errors, prefix=''):\n        if value is None or value == '' or not isinstance(value, Mapping):\n            value = {}\n        super().__init__(field, value, errors, prefix)\n\n    def __iter__(self):\n        for field in self.fields.values():\n            yield self[field.field_name]\n\n    def __getitem__(self, key):\n        field = self.fields[key]\n        value = self.value.get(key) if self.value else None\n        error = self.errors.get(key) if isinstance(self.errors, dict) else None\n        if hasattr(field, 'fields'):\n            return NestedBoundField(field, value, error, prefix=self.name + '.')\n        elif getattr(field, '_is_jsonfield', False):\n            return JSONBoundField(field, value, error, prefix=self.name + '.')\n        return BoundField(field, value, error, prefix=self.name + '.')\n\n    def as_form_field(self):\n        values = {}\n        for key, value in self.value.items():\n            if isinstance(value, (list, dict)):\n                values[key] = value\n            else:\n                values[key] = '' if (value is None or value is False) else force_str(value)\n        return self.__class__(self._field, values, self.errors, self._prefix)\n\n\nclass BindingDict(MutableMapping):\n    \"\"\"\n    This dict-like object is used to store fields on a serializer.\n\n    This ensures that whenever fields are added to the serializer we call\n    `field.bind()` so that the `field_name` and `parent` attributes\n    can be set correctly.\n    \"\"\"\n\n    def __init__(self, serializer):\n        self.serializer = serializer\n        self.fields = {}\n\n    def __setitem__(self, key, field):\n        self.fields[key] = field\n        field.bind(field_name=key, parent=self.serializer)\n\n    def __getitem__(self, key):\n        return self.fields[key]\n\n    def __delitem__(self, key):\n        del self.fields[key]\n\n    def __iter__(self):\n        return iter(self.fields)\n\n    def __len__(self):\n        return len(self.fields)\n\n    def __repr__(self):\n        return dict.__repr__(self.fields)\n"
  },
  {
    "path": "rest_framework/utils/timezone.py",
    "content": "from datetime import datetime, timezone, tzinfo\n\n\ndef datetime_exists(dt):\n    \"\"\"Check if a datetime exists. Taken from: https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html\"\"\"\n    # There are no non-existent times in UTC, and comparisons between\n    # aware time zones always compare absolute times; if a datetime is\n    # not equal to the same datetime represented in UTC, it is imaginary.\n    return dt.astimezone(timezone.utc) == dt\n\n\ndef datetime_ambiguous(dt: datetime):\n    \"\"\"Check whether a datetime is ambiguous. Taken from: https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html\"\"\"\n    # If a datetime exists and its UTC offset changes in response to\n    # changing `fold`, it is ambiguous in the zone specified.\n    return datetime_exists(dt) and (\n        dt.replace(fold=not dt.fold).utcoffset() != dt.utcoffset()\n    )\n\n\ndef valid_datetime(dt):\n    \"\"\"Returns True if the datetime is not ambiguous or imaginary, False otherwise.\"\"\"\n    if isinstance(dt.tzinfo, tzinfo) and not datetime_ambiguous(dt):\n        return True\n    return False\n"
  },
  {
    "path": "rest_framework/utils/urls.py",
    "content": "from urllib import parse\n\nfrom django.utils.encoding import force_str\n\n\ndef replace_query_param(url, key, val):\n    \"\"\"\n    Given a URL and a key/val pair, set or replace an item in the query\n    parameters of the URL, and return the new URL.\n    \"\"\"\n    (scheme, netloc, path, query, fragment) = parse.urlsplit(force_str(url))\n    query_dict = parse.parse_qs(query, keep_blank_values=True)\n    query_dict[force_str(key)] = [force_str(val)]\n    query = parse.urlencode(sorted(query_dict.items()), doseq=True)\n    return parse.urlunsplit((scheme, netloc, path, query, fragment))\n\n\ndef remove_query_param(url, key):\n    \"\"\"\n    Given a URL and a key/val pair, remove an item in the query\n    parameters of the URL, and return the new URL.\n    \"\"\"\n    (scheme, netloc, path, query, fragment) = parse.urlsplit(force_str(url))\n    query_dict = parse.parse_qs(query, keep_blank_values=True)\n    query_dict.pop(key, None)\n    query = parse.urlencode(sorted(query_dict.items()), doseq=True)\n    return parse.urlunsplit((scheme, netloc, path, query, fragment))\n"
  },
  {
    "path": "rest_framework/validators.py",
    "content": "\"\"\"\nWe perform uniqueness checks explicitly on the serializer class, rather\nthe using Django's `.full_clean()`.\n\nThis gives us better separation of concerns, allows us to use single-step\nobject creation, and makes it possible to switch between using the implicit\n`ModelSerializer` class and an equivalent explicit `Serializer` class.\n\"\"\"\nfrom django.core.exceptions import FieldError\nfrom django.db import DataError\nfrom django.db.models import Exists\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework.exceptions import ValidationError\nfrom rest_framework.utils.representation import smart_repr\n\n\n# Robust filter and exist implementations. Ensures that queryset.exists() for\n# an invalid value returns `False`, rather than raising an error.\n# Refs https://github.com/encode/django-rest-framework/issues/3381\ndef qs_exists(queryset):\n    try:\n        return queryset.exists()\n    except (TypeError, ValueError, DataError):\n        return False\n\n\ndef qs_exists_with_condition(queryset, condition, against):\n    if condition is None:\n        return qs_exists(queryset)\n    try:\n        # use the same query as UniqueConstraint.validate\n        # https://github.com/django/django/blob/7ba2a0db20c37a5b1500434ca4ed48022311c171/django/db/models/constraints.py#L672\n        return (condition & Exists(queryset.filter(condition))).check(against)\n    except (TypeError, ValueError, DataError, FieldError):\n        return False\n\n\ndef qs_filter(queryset, **kwargs):\n    try:\n        return queryset.filter(**kwargs)\n    except (TypeError, ValueError, DataError):\n        return queryset.none()\n\n\nclass UniqueValidator:\n    \"\"\"\n    Validator that corresponds to `unique=True` on a model field.\n\n    Should be applied to an individual field on the serializer.\n    \"\"\"\n    message = _('This field must be unique.')\n    requires_context = True\n\n    def __init__(self, queryset, message=None, lookup='exact'):\n        self.queryset = queryset\n        self.message = message or self.message\n        self.lookup = lookup\n\n    def filter_queryset(self, value, queryset, field_name):\n        \"\"\"\n        Filter the queryset to all instances matching the given attribute.\n        \"\"\"\n        filter_kwargs = {'%s__%s' % (field_name, self.lookup): value}\n        return qs_filter(queryset, **filter_kwargs)\n\n    def exclude_current_instance(self, queryset, instance):\n        \"\"\"\n        If an instance is being updated, then do not include\n        that instance itself as a uniqueness conflict.\n        \"\"\"\n        if instance is not None:\n            return queryset.exclude(pk=instance.pk)\n        return queryset\n\n    def __call__(self, value, serializer_field):\n        # Determine the underlying model field name. This may not be the\n        # same as the serializer field name if `source=<>` is set.\n        field_name = serializer_field.source_attrs[-1]\n        # Determine the existing instance, if this is an update operation.\n        instance = getattr(serializer_field.parent, 'instance', None)\n\n        queryset = self.queryset\n        queryset = self.filter_queryset(value, queryset, field_name)\n        queryset = self.exclude_current_instance(queryset, instance)\n        if qs_exists(queryset):\n            raise ValidationError(self.message, code='unique')\n\n    def __repr__(self):\n        return '<%s(queryset=%s)>' % (\n            self.__class__.__name__,\n            smart_repr(self.queryset)\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, self.__class__):\n            return NotImplemented\n        return (self.message == other.message\n                and self.requires_context == other.requires_context\n                and self.queryset == other.queryset\n                and self.lookup == other.lookup\n                )\n\n\nclass UniqueTogetherValidator:\n    \"\"\"\n    Validator that corresponds to `unique_together = (...)` on a model class.\n\n    Should be applied to the serializer class, not to an individual field.\n    \"\"\"\n    message = _('The fields {field_names} must make a unique set.')\n    missing_message = _('This field is required.')\n    requires_context = True\n    code = 'unique'\n\n    def __init__(self, queryset, fields, message=None, condition_fields=None, condition=None, code=None):\n        self.queryset = queryset\n        self.fields = fields\n        self.message = message or self.message\n        self.condition_fields = [] if condition_fields is None else condition_fields\n        self.condition = condition\n        self.code = code or self.code\n\n    def enforce_required_fields(self, attrs, serializer):\n        \"\"\"\n        The `UniqueTogetherValidator` always forces an implied 'required'\n        state on the fields it applies to.\n        \"\"\"\n        if serializer.instance is not None:\n            return\n\n        missing_items = {\n            field_name: self.missing_message\n            for field_name in (*self.fields, *self.condition_fields)\n            if serializer.fields[field_name].source not in attrs\n        }\n        if missing_items:\n            raise ValidationError(missing_items, code='required')\n\n    def filter_queryset(self, attrs, queryset, serializer):\n        \"\"\"\n        Filter the queryset to all instances matching the given attributes.\n        \"\"\"\n        # field names => field sources\n        sources = [\n            serializer.fields[field_name].source\n            for field_name in self.fields\n        ]\n\n        # If this is an update, then any unprovided field should\n        # have it's value set based on the existing instance attribute.\n        if serializer.instance is not None:\n            for source in sources:\n                if source not in attrs:\n                    attrs[source] = getattr(serializer.instance, source)\n\n        # Determine the filter keyword arguments and filter the queryset.\n        filter_kwargs = {\n            source: attrs[source]\n            for source in sources\n        }\n        return qs_filter(queryset, **filter_kwargs)\n\n    def exclude_current_instance(self, attrs, queryset, instance):\n        \"\"\"\n        If an instance is being updated, then do not include\n        that instance itself as a uniqueness conflict.\n        \"\"\"\n        if instance is not None:\n            return queryset.exclude(pk=instance.pk)\n        return queryset\n\n    def __call__(self, attrs, serializer):\n        self.enforce_required_fields(attrs, serializer)\n        queryset = self.queryset\n        queryset = self.filter_queryset(attrs, queryset, serializer)\n        queryset = self.exclude_current_instance(attrs, queryset, serializer.instance)\n\n        checked_names = [\n            serializer.fields[field_name].source for field_name in self.fields\n        ]\n        # Ignore validation if any field is None\n        if serializer.instance is None:\n            checked_values = [attrs[field_name] for field_name in checked_names]\n        else:\n            # Ignore validation if all field values are unchanged\n            checked_values = [\n                attrs[field_name]\n                for field_name in checked_names\n                if attrs[field_name] != getattr(serializer.instance, field_name)\n            ]\n\n        condition_sources = (serializer.fields[field_name].source for field_name in self.condition_fields)\n        condition_kwargs = {\n            source: attrs[source]\n            if source in attrs\n            else getattr(serializer.instance, source)\n            for source in condition_sources\n        }\n        if checked_values and None not in checked_values and qs_exists_with_condition(queryset, self.condition, condition_kwargs):\n            field_names = ', '.join(self.fields)\n            message = self.message.format(field_names=field_names)\n            raise ValidationError(message, code=self.code)\n\n    def __repr__(self):\n        return '<{}({})>'.format(\n            self.__class__.__name__,\n            ', '.join(\n                f'{attr}={smart_repr(getattr(self, attr))}'\n                for attr in ('queryset', 'fields', 'condition')\n                if getattr(self, attr) is not None)\n        )\n\n    def __eq__(self, other):\n        if not isinstance(other, self.__class__):\n            return NotImplemented\n        return (self.message == other.message\n                and self.requires_context == other.requires_context\n                and self.missing_message == other.missing_message\n                and self.queryset == other.queryset\n                and self.fields == other.fields\n                and self.code == other.code\n                )\n\n\nclass ProhibitSurrogateCharactersValidator:\n    message = _('Surrogate characters are not allowed: U+{code_point:X}.')\n    code = 'surrogate_characters_not_allowed'\n\n    def __call__(self, value):\n        for surrogate_character in (ch for ch in str(value)\n                                    if 0xD800 <= ord(ch) <= 0xDFFF):\n            message = self.message.format(code_point=ord(surrogate_character))\n            raise ValidationError(message, code=self.code)\n\n    def __eq__(self, other):\n        if not isinstance(other, self.__class__):\n            return NotImplemented\n        return (self.message == other.message\n                and self.code == other.code\n                )\n\n\nclass BaseUniqueForValidator:\n    message = None\n    missing_message = _('This field is required.')\n    requires_context = True\n\n    def __init__(self, queryset, field, date_field, message=None):\n        self.queryset = queryset\n        self.field = field\n        self.date_field = date_field\n        self.message = message or self.message\n\n    def enforce_required_fields(self, attrs):\n        \"\"\"\n        The `UniqueFor<Range>Validator` classes always force an implied\n        'required' state on the fields they are applied to.\n        \"\"\"\n        missing_items = {\n            field_name: self.missing_message\n            for field_name in [self.field, self.date_field]\n            if field_name not in attrs\n        }\n        if missing_items:\n            raise ValidationError(missing_items, code='required')\n\n    def filter_queryset(self, attrs, queryset, field_name, date_field_name):\n        raise NotImplementedError('`filter_queryset` must be implemented.')\n\n    def exclude_current_instance(self, attrs, queryset, instance):\n        \"\"\"\n        If an instance is being updated, then do not include\n        that instance itself as a uniqueness conflict.\n        \"\"\"\n        if instance is not None:\n            return queryset.exclude(pk=instance.pk)\n        return queryset\n\n    def __call__(self, attrs, serializer):\n        # Determine the underlying model field names. These may not be the\n        # same as the serializer field names if `source=<>` is set.\n        field_name = serializer.fields[self.field].source_attrs[-1]\n        date_field_name = serializer.fields[self.date_field].source_attrs[-1]\n\n        self.enforce_required_fields(attrs)\n        queryset = self.queryset\n        queryset = self.filter_queryset(attrs, queryset, field_name, date_field_name)\n        queryset = self.exclude_current_instance(attrs, queryset, serializer.instance)\n        if qs_exists(queryset):\n            message = self.message.format(date_field=self.date_field)\n            raise ValidationError({\n                self.field: message\n            }, code='unique')\n\n    def __eq__(self, other):\n        if not isinstance(other, self.__class__):\n            return NotImplemented\n        return (self.message == other.message\n                and self.missing_message == other.missing_message\n                and self.requires_context == other.requires_context\n                and self.queryset == other.queryset\n                and self.field == other.field\n                and self.date_field == other.date_field\n                )\n\n    def __repr__(self):\n        return '<%s(queryset=%s, field=%s, date_field=%s)>' % (\n            self.__class__.__name__,\n            smart_repr(self.queryset),\n            smart_repr(self.field),\n            smart_repr(self.date_field)\n        )\n\n\nclass UniqueForDateValidator(BaseUniqueForValidator):\n    message = _('This field must be unique for the \"{date_field}\" date.')\n\n    def filter_queryset(self, attrs, queryset, field_name, date_field_name):\n        value = attrs[self.field]\n        date = attrs[self.date_field]\n\n        filter_kwargs = {}\n        filter_kwargs[field_name] = value\n        filter_kwargs['%s__day' % date_field_name] = date.day\n        filter_kwargs['%s__month' % date_field_name] = date.month\n        filter_kwargs['%s__year' % date_field_name] = date.year\n        return qs_filter(queryset, **filter_kwargs)\n\n\nclass UniqueForMonthValidator(BaseUniqueForValidator):\n    message = _('This field must be unique for the \"{date_field}\" month.')\n\n    def filter_queryset(self, attrs, queryset, field_name, date_field_name):\n        value = attrs[self.field]\n        date = attrs[self.date_field]\n\n        filter_kwargs = {}\n        filter_kwargs[field_name] = value\n        filter_kwargs['%s__month' % date_field_name] = date.month\n        return qs_filter(queryset, **filter_kwargs)\n\n\nclass UniqueForYearValidator(BaseUniqueForValidator):\n    message = _('This field must be unique for the \"{date_field}\" year.')\n\n    def filter_queryset(self, attrs, queryset, field_name, date_field_name):\n        value = attrs[self.field]\n        date = attrs[self.date_field]\n\n        filter_kwargs = {}\n        filter_kwargs[field_name] = value\n        filter_kwargs['%s__year' % date_field_name] = date.year\n        return qs_filter(queryset, **filter_kwargs)\n"
  },
  {
    "path": "rest_framework/versioning.py",
    "content": "import re\n\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework import exceptions\nfrom rest_framework.compat import unicode_http_header\nfrom rest_framework.reverse import _reverse\nfrom rest_framework.settings import api_settings\nfrom rest_framework.templatetags.rest_framework import replace_query_param\nfrom rest_framework.utils.mediatypes import _MediaType\n\n\nclass BaseVersioning:\n    default_version = api_settings.DEFAULT_VERSION\n    allowed_versions = api_settings.ALLOWED_VERSIONS\n    version_param = api_settings.VERSION_PARAM\n\n    def determine_version(self, request, *args, **kwargs):\n        msg = '{cls}.determine_version() must be implemented.'\n        raise NotImplementedError(msg.format(\n            cls=self.__class__.__name__\n        ))\n\n    def reverse(self, viewname, args=None, kwargs=None, request=None, format=None, **extra):\n        return _reverse(viewname, args, kwargs, request, format, **extra)\n\n    def is_allowed_version(self, version):\n        if not self.allowed_versions:\n            return True\n        return ((version is not None and version == self.default_version) or\n                (version in self.allowed_versions))\n\n\nclass AcceptHeaderVersioning(BaseVersioning):\n    \"\"\"\n    GET /something/ HTTP/1.1\n    Host: example.com\n    Accept: application/json; version=1.0\n    \"\"\"\n    invalid_version_message = _('Invalid version in \"Accept\" header.')\n\n    def determine_version(self, request, *args, **kwargs):\n        media_type = _MediaType(request.accepted_media_type)\n        version = media_type.params.get(self.version_param, self.default_version)\n        version = unicode_http_header(version)\n        if not self.is_allowed_version(version):\n            raise exceptions.NotAcceptable(self.invalid_version_message)\n        return version\n\n    # We don't need to implement `reverse`, as the versioning is based\n    # on the `Accept` header, not on the request URL.\n\n\nclass URLPathVersioning(BaseVersioning):\n    \"\"\"\n    To the client this is the same style as `NamespaceVersioning`.\n    The difference is in the backend - this implementation uses\n    Django's URL keyword arguments to determine the version.\n\n    An example URL conf for two views that accept two different versions.\n\n    urlpatterns = [\n        re_path(r'^(?P<version>[v1|v2]+)/users/$', users_list, name='users-list'),\n        re_path(r'^(?P<version>[v1|v2]+)/users/(?P<pk>[0-9]+)/$', users_detail, name='users-detail')\n    ]\n\n    GET /1.0/something/ HTTP/1.1\n    Host: example.com\n    Accept: application/json\n    \"\"\"\n    invalid_version_message = _('Invalid version in URL path.')\n\n    def determine_version(self, request, *args, **kwargs):\n        version = kwargs.get(self.version_param, self.default_version)\n        if version is None:\n            version = self.default_version\n\n        if not self.is_allowed_version(version):\n            raise exceptions.NotFound(self.invalid_version_message)\n        return version\n\n    def reverse(self, viewname, args=None, kwargs=None, request=None, format=None, **extra):\n        if request.version is not None:\n            kwargs = {\n                self.version_param: request.version,\n                **(kwargs or {})\n            }\n\n        return super().reverse(\n            viewname, args, kwargs, request, format, **extra\n        )\n\n\nclass NamespaceVersioning(BaseVersioning):\n    \"\"\"\n    To the client this is the same style as `URLPathVersioning`.\n    The difference is in the backend - this implementation uses\n    Django's URL namespaces to determine the version.\n\n    An example URL conf that is namespaced into two separate versions\n\n    # users/urls.py\n    urlpatterns = [\n        path('/users/', users_list, name='users-list'),\n        path('/users/<int:pk>/', users_detail, name='users-detail')\n    ]\n\n    # urls.py\n    urlpatterns = [\n        path('v1/', include('users.urls', namespace='v1')),\n        path('v2/', include('users.urls', namespace='v2'))\n    ]\n\n    GET /1.0/something/ HTTP/1.1\n    Host: example.com\n    Accept: application/json\n    \"\"\"\n    invalid_version_message = _('Invalid version in URL path. Does not match any version namespace.')\n\n    def determine_version(self, request, *args, **kwargs):\n        resolver_match = getattr(request, 'resolver_match', None)\n        if resolver_match is None or not resolver_match.namespace:\n            return self.default_version\n\n        # Allow for possibly nested namespaces.\n        possible_versions = resolver_match.namespace.split(':')\n        for version in possible_versions:\n            if self.is_allowed_version(version):\n                return version\n        raise exceptions.NotFound(self.invalid_version_message)\n\n    def reverse(self, viewname, args=None, kwargs=None, request=None, format=None, **extra):\n        if request.version is not None:\n            viewname = self.get_versioned_viewname(viewname, request)\n        return super().reverse(\n            viewname, args, kwargs, request, format, **extra\n        )\n\n    def get_versioned_viewname(self, viewname, request):\n        return request.version + ':' + viewname\n\n\nclass HostNameVersioning(BaseVersioning):\n    \"\"\"\n    GET /something/ HTTP/1.1\n    Host: v1.example.com\n    Accept: application/json\n    \"\"\"\n    hostname_regex = re.compile(r'^([a-zA-Z0-9]+)\\.[a-zA-Z0-9]+\\.[a-zA-Z0-9]+$')\n    invalid_version_message = _('Invalid version in hostname.')\n\n    def determine_version(self, request, *args, **kwargs):\n        hostname, separator, port = request.get_host().partition(':')\n        match = self.hostname_regex.match(hostname)\n        if not match:\n            return self.default_version\n        version = match.group(1)\n        if not self.is_allowed_version(version):\n            raise exceptions.NotFound(self.invalid_version_message)\n        return version\n\n    # We don't need to implement `reverse`, as the hostname will already be\n    # preserved as part of the REST framework `reverse` implementation.\n\n\nclass QueryParameterVersioning(BaseVersioning):\n    \"\"\"\n    GET /something/?version=0.1 HTTP/1.1\n    Host: example.com\n    Accept: application/json\n    \"\"\"\n    invalid_version_message = _('Invalid version in query parameter.')\n\n    def determine_version(self, request, *args, **kwargs):\n        version = request.query_params.get(self.version_param, self.default_version)\n        if not self.is_allowed_version(version):\n            raise exceptions.NotFound(self.invalid_version_message)\n        return version\n\n    def reverse(self, viewname, args=None, kwargs=None, request=None, format=None, **extra):\n        url = super().reverse(\n            viewname, args, kwargs, request, format, **extra\n        )\n        if request.version is not None:\n            return replace_query_param(url, self.version_param, request.version)\n        return url\n"
  },
  {
    "path": "rest_framework/views.py",
    "content": "\"\"\"\nProvides an APIView class that is the base of all views in REST framework.\n\"\"\"\nfrom django import VERSION as DJANGO_VERSION\nfrom django.conf import settings\nfrom django.core.exceptions import PermissionDenied\nfrom django.db import connections, models\nfrom django.http import Http404\nfrom django.http.response import HttpResponseBase\nfrom django.utils.cache import cc_delim_re, patch_vary_headers\nfrom django.utils.encoding import smart_str\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.views.generic import View\n\nfrom rest_framework import exceptions, status\nfrom rest_framework.request import Request\nfrom rest_framework.response import Response\nfrom rest_framework.schemas import DefaultSchema\nfrom rest_framework.settings import api_settings\nfrom rest_framework.utils import formatting\n\n\ndef get_view_name(view):\n    \"\"\"\n    Given a view instance, return a textual name to represent the view.\n    This name is used in the browsable API, and in OPTIONS responses.\n\n    This function is the default for the `VIEW_NAME_FUNCTION` setting.\n    \"\"\"\n    # Name may be set by some Views, such as a ViewSet.\n    name = getattr(view, 'name', None)\n    if name is not None:\n        return name\n\n    name = view.__class__.__name__\n    name = formatting.remove_trailing_string(name, 'View')\n    name = formatting.remove_trailing_string(name, 'ViewSet')\n    name = formatting.camelcase_to_spaces(name)\n\n    # Suffix may be set by some Views, such as a ViewSet.\n    suffix = getattr(view, 'suffix', None)\n    if suffix:\n        name += ' ' + suffix\n\n    return name\n\n\ndef get_view_description(view, html=False):\n    \"\"\"\n    Given a view instance, return a textual description to represent the view.\n    This name is used in the browsable API, and in OPTIONS responses.\n\n    This function is the default for the `VIEW_DESCRIPTION_FUNCTION` setting.\n    \"\"\"\n    # Description may be set by some Views, such as a ViewSet.\n    description = getattr(view, 'description', None)\n    if description is None:\n        description = view.__class__.__doc__ or ''\n\n    description = formatting.dedent(smart_str(description))\n    if html:\n        return formatting.markup_description(description)\n    return description\n\n\ndef set_rollback():\n    for db in connections.all():\n        if db.settings_dict['ATOMIC_REQUESTS'] and db.in_atomic_block:\n            db.set_rollback(True)\n\n\ndef exception_handler(exc, context):\n    \"\"\"\n    Returns the response that should be used for any given exception.\n\n    By default we handle the REST framework `APIException`, and also\n    Django's built-in `Http404` and `PermissionDenied` exceptions.\n\n    Any unhandled exceptions may return `None`, which will cause a 500 error\n    to be raised.\n    \"\"\"\n    if isinstance(exc, Http404):\n        exc = exceptions.NotFound(*(exc.args))\n    elif isinstance(exc, PermissionDenied):\n        exc = exceptions.PermissionDenied(*(exc.args))\n\n    if isinstance(exc, exceptions.APIException):\n        headers = {}\n        if getattr(exc, 'auth_header', None):\n            headers['WWW-Authenticate'] = exc.auth_header\n        if getattr(exc, 'wait', None):\n            headers['Retry-After'] = '%d' % exc.wait\n\n        if isinstance(exc.detail, (list, dict)):\n            data = exc.detail\n        else:\n            data = {'detail': exc.detail}\n\n        set_rollback()\n        return Response(data, status=exc.status_code, headers=headers)\n\n    return None\n\n\nclass APIView(View):\n\n    # The following policies may be set at either globally, or per-view.\n    renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES\n    parser_classes = api_settings.DEFAULT_PARSER_CLASSES\n    authentication_classes = api_settings.DEFAULT_AUTHENTICATION_CLASSES\n    throttle_classes = api_settings.DEFAULT_THROTTLE_CLASSES\n    permission_classes = api_settings.DEFAULT_PERMISSION_CLASSES\n    content_negotiation_class = api_settings.DEFAULT_CONTENT_NEGOTIATION_CLASS\n    metadata_class = api_settings.DEFAULT_METADATA_CLASS\n    versioning_class = api_settings.DEFAULT_VERSIONING_CLASS\n\n    # Allow dependency injection of other settings to make testing easier.\n    settings = api_settings\n\n    schema = DefaultSchema()\n\n    @classmethod\n    def as_view(cls, **initkwargs):\n        \"\"\"\n        Store the original class on the view function.\n\n        This allows us to discover information about the view when we do URL\n        reverse lookups.  Used for breadcrumb generation.\n        \"\"\"\n        if isinstance(getattr(cls, 'queryset', None), models.query.QuerySet):\n            def force_evaluation():\n                raise RuntimeError(\n                    'Do not evaluate the `.queryset` attribute directly, '\n                    'as the result will be cached and reused between requests. '\n                    'Use `.all()` or call `.get_queryset()` instead.'\n                )\n            cls.queryset._fetch_all = force_evaluation\n\n        view = super().as_view(**initkwargs)\n        view.cls = cls\n        view.initkwargs = initkwargs\n\n        # Exempt all DRF views from Django's LoginRequiredMiddleware. Users should set\n        # DEFAULT_PERMISSION_CLASSES to 'rest_framework.permissions.IsAuthenticated' instead\n        if DJANGO_VERSION >= (5, 1):\n            view.login_required = False\n\n        # Note: session based authentication is explicitly CSRF validated,\n        # all other authentication is CSRF exempt.\n        return csrf_exempt(view)\n\n    @property\n    def allowed_methods(self):\n        \"\"\"\n        Wrap Django's private `_allowed_methods` interface in a public property.\n        \"\"\"\n        return self._allowed_methods()\n\n    @property\n    def default_response_headers(self):\n        headers = {\n            'Allow': ', '.join(self.allowed_methods),\n        }\n        if len(self.renderer_classes) > 1:\n            headers['Vary'] = 'Accept'\n        return headers\n\n    def http_method_not_allowed(self, request, *args, **kwargs):\n        \"\"\"\n        If `request.method` does not correspond to a handler method,\n        determine what kind of exception to raise.\n        \"\"\"\n        raise exceptions.MethodNotAllowed(request.method)\n\n    def permission_denied(self, request, message=None, code=None):\n        \"\"\"\n        If request is not permitted, determine what kind of exception to raise.\n        \"\"\"\n        if request.authenticators and not request.successful_authenticator:\n            raise exceptions.NotAuthenticated()\n        raise exceptions.PermissionDenied(detail=message, code=code)\n\n    def throttled(self, request, wait):\n        \"\"\"\n        If request is throttled, determine what kind of exception to raise.\n        \"\"\"\n        raise exceptions.Throttled(wait)\n\n    def get_authenticate_header(self, request):\n        \"\"\"\n        If a request is unauthenticated, determine the WWW-Authenticate\n        header to use for 401 responses, if any.\n        \"\"\"\n        authenticators = self.get_authenticators()\n        if authenticators:\n            return authenticators[0].authenticate_header(request)\n\n    def get_parser_context(self, http_request):\n        \"\"\"\n        Returns a dict that is passed through to Parser.parse(),\n        as the `parser_context` keyword argument.\n        \"\"\"\n        # Note: Additionally `request` and `encoding` will also be added\n        #       to the context by the Request object.\n        return {\n            'view': self,\n            'args': getattr(self, 'args', ()),\n            'kwargs': getattr(self, 'kwargs', {})\n        }\n\n    def get_renderer_context(self):\n        \"\"\"\n        Returns a dict that is passed through to Renderer.render(),\n        as the `renderer_context` keyword argument.\n        \"\"\"\n        # Note: Additionally 'response' will also be added to the context,\n        #       by the Response object.\n        return {\n            'view': self,\n            'args': getattr(self, 'args', ()),\n            'kwargs': getattr(self, 'kwargs', {}),\n            'request': getattr(self, 'request', None)\n        }\n\n    def get_exception_handler_context(self):\n        \"\"\"\n        Returns a dict that is passed through to EXCEPTION_HANDLER,\n        as the `context` argument.\n        \"\"\"\n        return {\n            'view': self,\n            'args': getattr(self, 'args', ()),\n            'kwargs': getattr(self, 'kwargs', {}),\n            'request': getattr(self, 'request', None)\n        }\n\n    def get_view_name(self):\n        \"\"\"\n        Return the view name, as used in OPTIONS responses and in the\n        browsable API.\n        \"\"\"\n        func = self.settings.VIEW_NAME_FUNCTION\n        return func(self)\n\n    def get_view_description(self, html=False):\n        \"\"\"\n        Return some descriptive text for the view, as used in OPTIONS responses\n        and in the browsable API.\n        \"\"\"\n        func = self.settings.VIEW_DESCRIPTION_FUNCTION\n        return func(self, html)\n\n    # API policy instantiation methods\n\n    def get_format_suffix(self, **kwargs):\n        \"\"\"\n        Determine if the request includes a '.json' style format suffix\n        \"\"\"\n        if self.settings.FORMAT_SUFFIX_KWARG:\n            return kwargs.get(self.settings.FORMAT_SUFFIX_KWARG)\n\n    def get_renderers(self):\n        \"\"\"\n        Instantiates and returns the list of renderers that this view can use.\n        \"\"\"\n        return [renderer() for renderer in self.renderer_classes]\n\n    def get_parsers(self):\n        \"\"\"\n        Instantiates and returns the list of parsers that this view can use.\n        \"\"\"\n        return [parser() for parser in self.parser_classes]\n\n    def get_authenticators(self):\n        \"\"\"\n        Instantiates and returns the list of authenticators that this view can use.\n        \"\"\"\n        return [auth() for auth in self.authentication_classes]\n\n    def get_permissions(self):\n        \"\"\"\n        Instantiates and returns the list of permissions that this view requires.\n        \"\"\"\n        return [permission() for permission in self.permission_classes]\n\n    def get_throttles(self):\n        \"\"\"\n        Instantiates and returns the list of throttles that this view uses.\n        \"\"\"\n        return [throttle() for throttle in self.throttle_classes]\n\n    def get_content_negotiator(self):\n        \"\"\"\n        Instantiate and return the content negotiation class to use.\n        \"\"\"\n        if not getattr(self, '_negotiator', None):\n            self._negotiator = self.content_negotiation_class()\n        return self._negotiator\n\n    def get_exception_handler(self):\n        \"\"\"\n        Returns the exception handler that this view uses.\n        \"\"\"\n        return self.settings.EXCEPTION_HANDLER\n\n    # API policy implementation methods\n\n    def perform_content_negotiation(self, request, force=False):\n        \"\"\"\n        Determine which renderer and media type to use render the response.\n        \"\"\"\n        renderers = self.get_renderers()\n        conneg = self.get_content_negotiator()\n\n        try:\n            return conneg.select_renderer(request, renderers, self.format_kwarg)\n        except Exception:\n            if force:\n                return (renderers[0], renderers[0].media_type)\n            raise\n\n    def perform_authentication(self, request):\n        \"\"\"\n        Perform authentication on the incoming request.\n\n        Note that if you override this and simply 'pass', then authentication\n        will instead be performed lazily, the first time either\n        `request.user` or `request.auth` is accessed.\n        \"\"\"\n        request.user\n\n    def check_permissions(self, request):\n        \"\"\"\n        Check if the request should be permitted.\n        Raises an appropriate exception if the request is not permitted.\n        \"\"\"\n        for permission in self.get_permissions():\n            if not permission.has_permission(request, self):\n                self.permission_denied(\n                    request,\n                    message=getattr(permission, 'message', None),\n                    code=getattr(permission, 'code', None)\n                )\n\n    def check_object_permissions(self, request, obj):\n        \"\"\"\n        Check if the request should be permitted for a given object.\n        Raises an appropriate exception if the request is not permitted.\n        \"\"\"\n        for permission in self.get_permissions():\n            if not permission.has_object_permission(request, self, obj):\n                self.permission_denied(\n                    request,\n                    message=getattr(permission, 'message', None),\n                    code=getattr(permission, 'code', None)\n                )\n\n    def check_throttles(self, request):\n        \"\"\"\n        Check if request should be throttled.\n        Raises an appropriate exception if the request is throttled.\n        \"\"\"\n        throttle_durations = []\n        for throttle in self.get_throttles():\n            if not throttle.allow_request(request, self):\n                throttle_durations.append(throttle.wait())\n\n        if throttle_durations:\n            # Filter out `None` values which may happen in case of config / rate\n            # changes, see #1438\n            durations = [\n                duration for duration in throttle_durations\n                if duration is not None\n            ]\n\n            duration = max(durations, default=None)\n            self.throttled(request, duration)\n\n    def determine_version(self, request, *args, **kwargs):\n        \"\"\"\n        If versioning is being used, then determine any API version for the\n        incoming request. Returns a two-tuple of (version, versioning_scheme)\n        \"\"\"\n        if self.versioning_class is None:\n            return (None, None)\n        scheme = self.versioning_class()\n        return (scheme.determine_version(request, *args, **kwargs), scheme)\n\n    # Dispatch methods\n\n    def initialize_request(self, request, *args, **kwargs):\n        \"\"\"\n        Returns the initial request object.\n        \"\"\"\n        parser_context = self.get_parser_context(request)\n\n        return Request(\n            request,\n            parsers=self.get_parsers(),\n            authenticators=self.get_authenticators(),\n            negotiator=self.get_content_negotiator(),\n            parser_context=parser_context\n        )\n\n    def initial(self, request, *args, **kwargs):\n        \"\"\"\n        Runs anything that needs to occur prior to calling the method handler.\n        \"\"\"\n        self.format_kwarg = self.get_format_suffix(**kwargs)\n\n        # Perform content negotiation and store the accepted info on the request\n        neg = self.perform_content_negotiation(request)\n        request.accepted_renderer, request.accepted_media_type = neg\n\n        # Determine the API version, if versioning is in use.\n        version, scheme = self.determine_version(request, *args, **kwargs)\n        request.version, request.versioning_scheme = version, scheme\n\n        # Ensure that the incoming request is permitted\n        self.perform_authentication(request)\n        self.check_permissions(request)\n        self.check_throttles(request)\n\n    def finalize_response(self, request, response, *args, **kwargs):\n        \"\"\"\n        Returns the final response object.\n        \"\"\"\n        # Make the error obvious if a proper response is not returned\n        assert isinstance(response, HttpResponseBase), (\n            'Expected a `Response`, `HttpResponse` or `StreamingHttpResponse` '\n            'to be returned from the view, but received a `%s`'\n            % type(response)\n        )\n\n        if isinstance(response, Response):\n            if not getattr(request, 'accepted_renderer', None):\n                neg = self.perform_content_negotiation(request, force=True)\n                request.accepted_renderer, request.accepted_media_type = neg\n\n            response.accepted_renderer = request.accepted_renderer\n            response.accepted_media_type = request.accepted_media_type\n            response.renderer_context = self.get_renderer_context()\n\n        # Add new vary headers to the response instead of overwriting.\n        vary_headers = self.headers.pop('Vary', None)\n        if vary_headers is not None:\n            patch_vary_headers(response, cc_delim_re.split(vary_headers))\n\n        for key, value in self.headers.items():\n            response[key] = value\n\n        return response\n\n    def handle_exception(self, exc):\n        \"\"\"\n        Handle any exception that occurs, by returning an appropriate response,\n        or re-raising the error.\n        \"\"\"\n        if isinstance(exc, (exceptions.NotAuthenticated,\n                            exceptions.AuthenticationFailed)):\n            # WWW-Authenticate header for 401 responses, else coerce to 403\n            auth_header = self.get_authenticate_header(self.request)\n\n            if auth_header:\n                exc.auth_header = auth_header\n            else:\n                exc.status_code = status.HTTP_403_FORBIDDEN\n\n        exception_handler = self.get_exception_handler()\n\n        context = self.get_exception_handler_context()\n        response = exception_handler(exc, context)\n\n        if response is None:\n            self.raise_uncaught_exception(exc)\n\n        response.exception = True\n        return response\n\n    def raise_uncaught_exception(self, exc):\n        if settings.DEBUG:\n            request = self.request\n            renderer_format = getattr(request.accepted_renderer, 'format')\n            use_plaintext_traceback = renderer_format not in ('html', 'api', 'admin')\n            request.force_plaintext_errors(use_plaintext_traceback)\n        raise exc\n\n    # Note: Views are made CSRF exempt from within `as_view` as to prevent\n    # accidental removal of this exemption in cases where `dispatch` needs to\n    # be overridden.\n    def dispatch(self, request, *args, **kwargs):\n        \"\"\"\n        `.dispatch()` is pretty much the same as Django's regular dispatch,\n        but with extra hooks for startup, finalize, and exception handling.\n        \"\"\"\n        self.args = args\n        self.kwargs = kwargs\n        request = self.initialize_request(request, *args, **kwargs)\n        self.request = request\n        self.headers = self.default_response_headers  # deprecate?\n\n        try:\n            self.initial(request, *args, **kwargs)\n\n            # Get the appropriate handler method\n            if request.method.lower() in self.http_method_names:\n                handler = getattr(self, request.method.lower(),\n                                  self.http_method_not_allowed)\n            else:\n                handler = self.http_method_not_allowed\n\n            response = handler(request, *args, **kwargs)\n\n        except Exception as exc:\n            response = self.handle_exception(exc)\n\n        self.response = self.finalize_response(request, response, *args, **kwargs)\n        return self.response\n\n    def options(self, request, *args, **kwargs):\n        \"\"\"\n        Handler method for HTTP 'OPTIONS' request.\n        \"\"\"\n        if self.metadata_class is None:\n            return self.http_method_not_allowed(request, *args, **kwargs)\n        data = self.metadata_class().determine_metadata(request, self)\n        return Response(data, status=status.HTTP_200_OK)\n"
  },
  {
    "path": "rest_framework/viewsets.py",
    "content": "\"\"\"\nViewSets are essentially just a type of class based view, that doesn't provide\nany method handlers, such as `get()`, `post()`, etc... but instead has actions,\nsuch as `list()`, `retrieve()`, `create()`, etc...\n\nActions are only bound to methods at the point of instantiating the views.\n\n    user_list = UserViewSet.as_view({'get': 'list'})\n    user_detail = UserViewSet.as_view({'get': 'retrieve'})\n\nTypically, rather than instantiate views from viewsets directly, you'll\nregister the viewset with a router and let the URL conf be determined\nautomatically.\n\n    router = DefaultRouter()\n    router.register(r'users', UserViewSet, 'user')\n    urlpatterns = router.urls\n\"\"\"\nfrom functools import update_wrapper\nfrom inspect import getmembers\n\nfrom django import VERSION as DJANGO_VERSION\nfrom django.urls import NoReverseMatch\nfrom django.utils.decorators import classonlymethod\nfrom django.views.decorators.csrf import csrf_exempt\n\nfrom rest_framework import generics, mixins, views\nfrom rest_framework.decorators import MethodMapper\nfrom rest_framework.reverse import reverse\n\n\ndef _is_extra_action(attr):\n    return hasattr(attr, 'mapping') and isinstance(attr.mapping, MethodMapper)\n\n\ndef _check_attr_name(func, name):\n    assert func.__name__ == name, (\n        'Expected function (`{func.__name__}`) to match its attribute name '\n        '(`{name}`). If using a decorator, ensure the inner function is '\n        'decorated with `functools.wraps`, or that `{func.__name__}.__name__` '\n        'is otherwise set to `{name}`.').format(func=func, name=name)\n    return func\n\n\nclass ViewSetMixin:\n    \"\"\"\n    This is the magic.\n\n    Overrides `.as_view()` so that it takes an `actions` keyword that performs\n    the binding of HTTP methods to actions on the Resource.\n\n    For example, to create a concrete view binding the 'GET' and 'POST' methods\n    to the 'list' and 'create' actions...\n\n    view = MyViewSet.as_view({'get': 'list', 'post': 'create'})\n    \"\"\"\n\n    @classonlymethod\n    def as_view(cls, actions=None, **initkwargs):\n        \"\"\"\n        Because of the way class based views create a closure around the\n        instantiated view, we need to totally reimplement `.as_view`,\n        and slightly modify the view function that is created and returned.\n        \"\"\"\n        # The name and description initkwargs may be explicitly overridden for\n        # certain route configurations. eg, names of extra actions.\n        cls.name = None\n        cls.description = None\n\n        # The suffix initkwarg is reserved for displaying the viewset type.\n        # This initkwarg should have no effect if the name is provided.\n        # eg. 'List' or 'Instance'.\n        cls.suffix = None\n\n        # The detail initkwarg is reserved for introspecting the viewset type.\n        cls.detail = None\n\n        # Setting a basename allows a view to reverse its action urls. This\n        # value is provided by the router through the initkwargs.\n        cls.basename = None\n\n        # actions must not be empty\n        if not actions:\n            raise TypeError(\"The `actions` argument must be provided when \"\n                            \"calling `.as_view()` on a ViewSet. For example \"\n                            \"`.as_view({'get': 'list'})`\")\n\n        # sanitize keyword arguments\n        for key in initkwargs:\n            if key in cls.http_method_names:\n                raise TypeError(\"You tried to pass in the %s method name as a \"\n                                \"keyword argument to %s(). Don't do that.\"\n                                % (key, cls.__name__))\n            if not hasattr(cls, key):\n                raise TypeError(\"%s() received an invalid keyword %r\" % (\n                    cls.__name__, key))\n\n        # name and suffix are mutually exclusive\n        if 'name' in initkwargs and 'suffix' in initkwargs:\n            raise TypeError(\"%s() received both `name` and `suffix`, which are \"\n                            \"mutually exclusive arguments.\" % (cls.__name__))\n\n        def view(request, *args, **kwargs):\n            self = cls(**initkwargs)\n\n            if 'get' in actions and 'head' not in actions:\n                actions['head'] = actions['get']\n\n            # We also store the mapping of request methods to actions,\n            # so that we can later set the action attribute.\n            # eg. `self.action = 'list'` on an incoming GET request.\n            self.action_map = actions\n\n            # Bind methods to actions\n            # This is the bit that's different to a standard view\n            for method, action in actions.items():\n                handler = getattr(self, action)\n                setattr(self, method, handler)\n\n            self.request = request\n            self.args = args\n            self.kwargs = kwargs\n\n            # And continue as usual\n            return self.dispatch(request, *args, **kwargs)\n\n        # take name and docstring from class\n        update_wrapper(view, cls, updated=())\n\n        # and possible attributes set by decorators\n        # like csrf_exempt from dispatch\n        update_wrapper(view, cls.dispatch, assigned=())\n\n        # We need to set these on the view function, so that breadcrumb\n        # generation can pick out these bits of information from a\n        # resolved URL.\n        view.cls = cls\n        view.initkwargs = initkwargs\n        view.actions = actions\n\n        # Exempt from Django's LoginRequiredMiddleware. Users should set\n        # DEFAULT_PERMISSION_CLASSES to 'rest_framework.permissions.IsAuthenticated' instead\n        if DJANGO_VERSION >= (5, 1):\n            view.login_required = False\n\n        return csrf_exempt(view)\n\n    def initialize_request(self, request, *args, **kwargs):\n        \"\"\"\n        Set the `.action` attribute on the view, depending on the request method.\n        \"\"\"\n        request = super().initialize_request(request, *args, **kwargs)\n        method = request.method.lower()\n        if method == 'options':\n            # This is a special case as we always provide handling for the\n            # options method in the base `View` class.\n            # Unlike the other explicitly defined actions, 'metadata' is implicit.\n            self.action = 'metadata'\n        else:\n            self.action = self.action_map.get(method)\n        return request\n\n    def reverse_action(self, url_name, *args, **kwargs):\n        \"\"\"\n        Reverse the action for the given `url_name`.\n        \"\"\"\n        url_name = '%s-%s' % (self.basename, url_name)\n        namespace = None\n        if self.request and self.request.resolver_match:\n            namespace = self.request.resolver_match.namespace\n        if namespace:\n            url_name = namespace + ':' + url_name\n        kwargs.setdefault('request', self.request)\n\n        return reverse(url_name, *args, **kwargs)\n\n    @classmethod\n    def get_extra_actions(cls):\n        \"\"\"\n        Get the methods that are marked as an extra ViewSet `@action`.\n        \"\"\"\n        return [_check_attr_name(method, name)\n                for name, method\n                in getmembers(cls, _is_extra_action)]\n\n    def get_extra_action_url_map(self):\n        \"\"\"\n        Build a map of {names: urls} for the extra actions.\n\n        This method will noop if `detail` was not provided as a view initkwarg.\n        \"\"\"\n        action_urls = {}\n\n        # exit early if `detail` has not been provided\n        if self.detail is None:\n            return action_urls\n\n        # filter for the relevant extra actions\n        actions = [\n            action for action in self.get_extra_actions()\n            if action.detail == self.detail\n        ]\n\n        for action in actions:\n            try:\n                url_name = '%s-%s' % (self.basename, action.url_name)\n                namespace = self.request.resolver_match.namespace\n                if namespace:\n                    url_name = '%s:%s' % (namespace, url_name)\n\n                url = reverse(url_name, self.args, self.kwargs, request=self.request)\n                view = self.__class__(**action.kwargs)\n                action_urls[view.get_view_name()] = url\n            except NoReverseMatch:\n                pass  # URL requires additional arguments, ignore\n\n        return action_urls\n\n\nclass ViewSet(ViewSetMixin, views.APIView):\n    \"\"\"\n    The base ViewSet class does not provide any actions by default.\n    \"\"\"\n    pass\n\n\nclass GenericViewSet(ViewSetMixin, generics.GenericAPIView):\n    \"\"\"\n    The GenericViewSet class does not provide any actions by default,\n    but does include the base set of generic view behavior, such as\n    the `get_object` and `get_queryset` methods.\n    \"\"\"\n    pass\n\n\nclass ReadOnlyModelViewSet(mixins.RetrieveModelMixin,\n                           mixins.ListModelMixin,\n                           GenericViewSet):\n    \"\"\"\n    A viewset that provides default `list()` and `retrieve()` actions.\n    \"\"\"\n    pass\n\n\nclass ModelViewSet(mixins.CreateModelMixin,\n                   mixins.RetrieveModelMixin,\n                   mixins.UpdateModelMixin,\n                   mixins.DestroyModelMixin,\n                   mixins.ListModelMixin,\n                   GenericViewSet):\n    \"\"\"\n    A viewset that provides default `create()`, `retrieve()`, `update()`,\n    `partial_update()`, `destroy()` and `list()` actions.\n    \"\"\"\n    pass\n"
  },
  {
    "path": "runtests.py",
    "content": "#! /usr/bin/env python3\nimport os\nimport sys\n\nimport pytest\n\n\ndef split_class_and_function(string):\n    class_string, function_string = string.split('.', 1)\n    return \"%s and %s\" % (class_string, function_string)\n\n\ndef is_function(string):\n    # `True` if it looks like a test function is included in the string.\n    return string.startswith('test_') or '.test_' in string\n\n\ndef is_class(string):\n    # `True` if first character is uppercase - assume it's a class name.\n    return string[0] == string[0].upper()\n\n\nif __name__ == \"__main__\":\n    if len(sys.argv) > 1:\n        pytest_args = sys.argv[1:]\n        first_arg = pytest_args[0]\n\n        try:\n            pytest_args.remove('--coverage')\n        except ValueError:\n            pass\n        else:\n            pytest_args = [\n                '--cov', '.',\n                '--cov-report', 'xml',\n            ] + pytest_args\n\n        try:\n            pytest_args.remove('--no-pkgroot')\n        except ValueError:\n            pass\n        else:\n            sys.path.pop(0)\n\n            # import rest_framework before pytest re-adds the package root directory.\n            import rest_framework\n            package_dir = os.path.join(os.getcwd(), 'rest_framework')\n            assert not rest_framework.__file__.startswith(package_dir)\n\n        if first_arg.startswith('-'):\n            # `runtests.py [flags]`\n            pytest_args = ['tests'] + pytest_args\n        elif is_class(first_arg) and is_function(first_arg):\n            # `runtests.py TestCase.test_function [flags]`\n            expression = split_class_and_function(first_arg)\n            pytest_args = ['tests', '-k', expression] + pytest_args[1:]\n        elif is_class(first_arg) or is_function(first_arg):\n            # `runtests.py TestCase [flags]`\n            # `runtests.py test_function [flags]`\n            pytest_args = ['tests', '-k', pytest_args[0]] + pytest_args[1:]\n    else:\n        pytest_args = []\n\n    sys.exit(pytest.main(pytest_args))\n"
  },
  {
    "path": "setup.cfg",
    "content": "[flake8]\nextend-ignore = E501,W503,W504,B\nextend-select = B006\nbanned-modules = json = use from rest_framework.utils import json!\n"
  },
  {
    "path": "tests/__init__.py",
    "content": ""
  },
  {
    "path": "tests/authentication/__init__.py",
    "content": ""
  },
  {
    "path": "tests/authentication/migrations/0001_initial.py",
    "content": "from django.conf import settings\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n    initial = True\n\n    dependencies = [\n        migrations.swappable_dependency(settings.AUTH_USER_MODEL),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name='CustomToken',\n            fields=[\n                ('key', models.CharField(max_length=40, primary_key=True, serialize=False)),\n                ('user', models.OneToOneField(on_delete=models.CASCADE, to=settings.AUTH_USER_MODEL)),\n            ],\n        ),\n    ]\n"
  },
  {
    "path": "tests/authentication/migrations/__init__.py",
    "content": ""
  },
  {
    "path": "tests/authentication/models.py",
    "content": "from django.conf import settings\nfrom django.db import models\n\n\nclass CustomToken(models.Model):\n    key = models.CharField(max_length=40, primary_key=True)\n    user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)\n"
  },
  {
    "path": "tests/authentication/test_authentication.py",
    "content": "import base64\n\nimport pytest\nfrom django.conf import settings\nfrom django.contrib.auth.models import User\nfrom django.http import HttpResponse\nfrom django.test import TestCase, override_settings\nfrom django.urls import include, path\n\nfrom rest_framework import (\n    HTTP_HEADER_ENCODING, exceptions, permissions, renderers, status\n)\nfrom rest_framework.authentication import (\n    BaseAuthentication, BasicAuthentication, RemoteUserAuthentication,\n    SessionAuthentication, TokenAuthentication\n)\nfrom rest_framework.authtoken.models import Token\nfrom rest_framework.authtoken.views import obtain_auth_token\nfrom rest_framework.response import Response\nfrom rest_framework.test import APIClient, APIRequestFactory\nfrom rest_framework.views import APIView\n\nfrom .models import CustomToken\n\nfactory = APIRequestFactory()\n\n\nclass CustomTokenAuthentication(TokenAuthentication):\n    model = CustomToken\n\n\nclass CustomKeywordTokenAuthentication(TokenAuthentication):\n    keyword = 'Bearer'\n\n\nclass MockView(APIView):\n    permission_classes = (permissions.IsAuthenticated,)\n\n    def get(self, request):\n        return HttpResponse({'a': 1, 'b': 2, 'c': 3})\n\n    def post(self, request):\n        return HttpResponse({'a': 1, 'b': 2, 'c': 3})\n\n    def put(self, request):\n        return HttpResponse({'a': 1, 'b': 2, 'c': 3})\n\n\nurlpatterns = [\n    path(\n        'session/',\n        MockView.as_view(authentication_classes=[SessionAuthentication])\n    ),\n    path(\n        'basic/',\n        MockView.as_view(authentication_classes=[BasicAuthentication])\n    ),\n    path(\n        'remote-user/',\n        MockView.as_view(authentication_classes=[RemoteUserAuthentication])\n    ),\n    path(\n        'token/',\n        MockView.as_view(authentication_classes=[TokenAuthentication])\n    ),\n    path(\n        'customtoken/',\n        MockView.as_view(authentication_classes=[CustomTokenAuthentication])\n    ),\n    path(\n        'customkeywordtoken/',\n        MockView.as_view(\n            authentication_classes=[CustomKeywordTokenAuthentication]\n        )\n    ),\n    path('auth-token/', obtain_auth_token),\n    path('auth/', include('rest_framework.urls', namespace='rest_framework')),\n]\n\n\n@override_settings(ROOT_URLCONF=__name__)\nclass BasicAuthTests(TestCase):\n    \"\"\"Basic authentication\"\"\"\n\n    def setUp(self):\n        self.csrf_client = APIClient(enforce_csrf_checks=True)\n        self.username = 'john'\n        self.email = 'lennon@thebeatles.com'\n        self.password = 'password'\n        self.user = User.objects.create_user(\n            self.username, self.email, self.password\n        )\n\n    def test_post_form_passing_basic_auth(self):\n        \"\"\"Ensure POSTing json over basic auth with correct credentials passes and does not require CSRF\"\"\"\n        credentials = ('%s:%s' % (self.username, self.password))\n        base64_credentials = base64.b64encode(\n            credentials.encode(HTTP_HEADER_ENCODING)\n        ).decode(HTTP_HEADER_ENCODING)\n        auth = 'Basic %s' % base64_credentials\n        response = self.csrf_client.post(\n            '/basic/',\n            {'example': 'example'},\n            HTTP_AUTHORIZATION=auth\n        )\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_post_json_passing_basic_auth(self):\n        \"\"\"Ensure POSTing form over basic auth with correct credentials passes and does not require CSRF\"\"\"\n        credentials = ('%s:%s' % (self.username, self.password))\n        base64_credentials = base64.b64encode(\n            credentials.encode(HTTP_HEADER_ENCODING)\n        ).decode(HTTP_HEADER_ENCODING)\n        auth = 'Basic %s' % base64_credentials\n        response = self.csrf_client.post(\n            '/basic/',\n            {'example': 'example'},\n            format='json',\n            HTTP_AUTHORIZATION=auth\n        )\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_post_json_without_password_failing_basic_auth(self):\n        \"\"\"Ensure POSTing json without password (even if password is empty string) returns 401\"\"\"\n        self.user.set_password(\"\")\n        credentials = ('%s' % (self.username))\n        base64_credentials = base64.b64encode(\n            credentials.encode(HTTP_HEADER_ENCODING)\n        ).decode(HTTP_HEADER_ENCODING)\n        auth = 'Basic %s' % base64_credentials\n        response = self.csrf_client.post(\n            '/basic/',\n            {'example': 'example'},\n            format='json',\n            HTTP_AUTHORIZATION=auth\n        )\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_regression_handle_bad_base64_basic_auth_header(self):\n        \"\"\"Ensure POSTing JSON over basic auth with incorrectly padded Base64 string is handled correctly\"\"\"\n        # regression test for issue in 'rest_framework.authentication.BasicAuthentication.authenticate'\n        # https://github.com/encode/django-rest-framework/issues/4089\n        auth = 'Basic =a='\n        response = self.csrf_client.post(\n            '/basic/',\n            {'example': 'example'},\n            format='json',\n            HTTP_AUTHORIZATION=auth\n        )\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_post_form_failing_basic_auth(self):\n        \"\"\"Ensure POSTing form over basic auth without correct credentials fails\"\"\"\n        response = self.csrf_client.post('/basic/', {'example': 'example'})\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_post_json_failing_basic_auth(self):\n        \"\"\"Ensure POSTing json over basic auth without correct credentials fails\"\"\"\n        response = self.csrf_client.post(\n            '/basic/',\n            {'example': 'example'},\n            format='json'\n        )\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n        assert response['WWW-Authenticate'] == 'Basic realm=\"api\"'\n\n    def test_fail_post_if_credentials_are_missing(self):\n        response = self.csrf_client.post(\n            '/basic/', {'example': 'example'}, HTTP_AUTHORIZATION='Basic ')\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_fail_post_if_credentials_contain_spaces(self):\n        response = self.csrf_client.post(\n            '/basic/', {'example': 'example'},\n            HTTP_AUTHORIZATION='Basic foo bar'\n        )\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_decoding_of_utf8_credentials(self):\n        username = 'walterwhité'\n        email = 'walterwhite@example.com'\n        password = 'pässwörd'\n        User.objects.create_user(\n            username, email, password\n        )\n        credentials = ('%s:%s' % (username, password))\n        base64_credentials = base64.b64encode(\n            credentials.encode('utf-8')\n        ).decode(HTTP_HEADER_ENCODING)\n        auth = 'Basic %s' % base64_credentials\n        response = self.csrf_client.post(\n            '/basic/',\n            {'example': 'example'},\n            HTTP_AUTHORIZATION=auth\n        )\n        assert response.status_code == status.HTTP_200_OK\n\n\n@override_settings(ROOT_URLCONF=__name__)\nclass SessionAuthTests(TestCase):\n    \"\"\"User session authentication\"\"\"\n\n    def setUp(self):\n        self.csrf_client = APIClient(enforce_csrf_checks=True)\n        self.non_csrf_client = APIClient(enforce_csrf_checks=False)\n        self.username = 'john'\n        self.email = 'lennon@thebeatles.com'\n        self.password = 'password'\n        self.user = User.objects.create_user(\n            self.username, self.email, self.password\n        )\n\n    def tearDown(self):\n        self.csrf_client.logout()\n\n    def test_login_view_renders_on_get(self):\n        \"\"\"\n        Ensure the login template renders for a basic GET.\n\n        cf. [#1810](https://github.com/encode/django-rest-framework/pull/1810)\n        \"\"\"\n        response = self.csrf_client.get('/auth/login/')\n        content = response.content.decode()\n        assert '<label for=\"id_username\">Username:</label>' in content\n\n    def test_post_form_session_auth_failing_csrf(self):\n        \"\"\"\n        Ensure POSTing form over session authentication without CSRF token fails.\n        \"\"\"\n        self.csrf_client.login(username=self.username, password=self.password)\n        response = self.csrf_client.post('/session/', {'example': 'example'})\n        assert response.status_code == status.HTTP_403_FORBIDDEN\n\n    def test_post_form_session_auth_passing_csrf(self):\n        \"\"\"\n        Ensure POSTing form over session authentication with CSRF token succeeds.\n        Regression test for #6088\n        \"\"\"\n        self.csrf_client.login(username=self.username, password=self.password)\n\n        # Set the csrf_token cookie so that CsrfViewMiddleware._get_token() works\n        from django.middleware.csrf import (\n            _get_new_csrf_string, _mask_cipher_secret\n        )\n        token = _mask_cipher_secret(_get_new_csrf_string())\n        self.csrf_client.cookies[settings.CSRF_COOKIE_NAME] = token\n\n        # Post the token matching the cookie value\n        response = self.csrf_client.post('/session/', {\n            'example': 'example',\n            'csrfmiddlewaretoken': token,\n        })\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_post_form_session_auth_passing(self):\n        \"\"\"\n        Ensure POSTing form over session authentication with logged in\n        user and CSRF token passes.\n        \"\"\"\n        self.non_csrf_client.login(\n            username=self.username, password=self.password\n        )\n        response = self.non_csrf_client.post(\n            '/session/', {'example': 'example'}\n        )\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_put_form_session_auth_passing(self):\n        \"\"\"\n        Ensure PUTting form over session authentication with\n        logged in user and CSRF token passes.\n        \"\"\"\n        self.non_csrf_client.login(\n            username=self.username, password=self.password\n        )\n        response = self.non_csrf_client.put(\n            '/session/', {'example': 'example'}\n        )\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_post_form_session_auth_failing(self):\n        \"\"\"\n        Ensure POSTing form over session authentication without logged in user fails.\n        \"\"\"\n        response = self.csrf_client.post('/session/', {'example': 'example'})\n        assert response.status_code == status.HTTP_403_FORBIDDEN\n\n\nclass BaseTokenAuthTests:\n    \"\"\"Token authentication\"\"\"\n    model = None\n    path = None\n    header_prefix = 'Token '\n\n    def setUp(self):\n        self.csrf_client = APIClient(enforce_csrf_checks=True)\n        self.username = 'john'\n        self.email = 'lennon@thebeatles.com'\n        self.password = 'password'\n        self.user = User.objects.create_user(\n            self.username, self.email, self.password\n        )\n\n        self.key = 'abcd1234'\n        self.token = self.model.objects.create(key=self.key, user=self.user)\n\n    def test_post_form_passing_token_auth(self):\n        \"\"\"\n        Ensure POSTing json over token auth with correct\n        credentials passes and does not require CSRF\n        \"\"\"\n        auth = self.header_prefix + self.key\n        response = self.csrf_client.post(\n            self.path, {'example': 'example'}, HTTP_AUTHORIZATION=auth\n        )\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_fail_authentication_if_user_is_not_active(self):\n        user = User.objects.create_user('foo', 'bar', 'baz')\n        user.is_active = False\n        user.save()\n        self.model.objects.create(key='foobar_token', user=user)\n        response = self.csrf_client.post(\n            self.path, {'example': 'example'},\n            HTTP_AUTHORIZATION=self.header_prefix + 'foobar_token'\n        )\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_fail_post_form_passing_nonexistent_token_auth(self):\n        # use a nonexistent token key\n        auth = self.header_prefix + 'wxyz6789'\n        response = self.csrf_client.post(\n            self.path, {'example': 'example'}, HTTP_AUTHORIZATION=auth\n        )\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_fail_post_if_token_is_missing(self):\n        response = self.csrf_client.post(\n            self.path, {'example': 'example'},\n            HTTP_AUTHORIZATION=self.header_prefix)\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_fail_post_if_token_contains_spaces(self):\n        response = self.csrf_client.post(\n            self.path, {'example': 'example'},\n            HTTP_AUTHORIZATION=self.header_prefix + 'foo bar'\n        )\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_fail_post_form_passing_invalid_token_auth(self):\n        # add an 'invalid' unicode character\n        auth = self.header_prefix + self.key + \"¸\"\n        response = self.csrf_client.post(\n            self.path, {'example': 'example'}, HTTP_AUTHORIZATION=auth\n        )\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_post_json_passing_token_auth(self):\n        \"\"\"\n        Ensure POSTing form over token auth with correct\n        credentials passes and does not require CSRF\n        \"\"\"\n        auth = self.header_prefix + self.key\n        response = self.csrf_client.post(\n            self.path, {'example': 'example'},\n            format='json', HTTP_AUTHORIZATION=auth\n        )\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_post_json_makes_one_db_query(self):\n        \"\"\"\n        Ensure that authenticating a user using a\n        token performs only one DB query\n        \"\"\"\n        auth = self.header_prefix + self.key\n\n        def func_to_test():\n            return self.csrf_client.post(\n                self.path, {'example': 'example'},\n                format='json', HTTP_AUTHORIZATION=auth\n            )\n\n        self.assertNumQueries(1, func_to_test)\n\n    def test_post_form_failing_token_auth(self):\n        \"\"\"\n        Ensure POSTing form over token auth without correct credentials fails\n        \"\"\"\n        response = self.csrf_client.post(self.path, {'example': 'example'})\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n    def test_post_json_failing_token_auth(self):\n        \"\"\"\n        Ensure POSTing json over token auth without correct credentials fails\n        \"\"\"\n        response = self.csrf_client.post(\n            self.path, {'example': 'example'}, format='json'\n        )\n        assert response.status_code == status.HTTP_401_UNAUTHORIZED\n\n\n@override_settings(ROOT_URLCONF=__name__)\nclass TokenAuthTests(BaseTokenAuthTests, TestCase):\n    model = Token\n    path = '/token/'\n\n    def test_token_has_auto_assigned_key_if_none_provided(self):\n        \"\"\"Ensure creating a token with no key will auto-assign a key\"\"\"\n        self.token.delete()\n        token = self.model.objects.create(user=self.user)\n        assert bool(token.key)\n\n    def test_generate_key_returns_string(self):\n        \"\"\"Ensure generate_key returns a string\"\"\"\n        token = self.model()\n        key = token.generate_key()\n        assert isinstance(key, str)\n\n    def test_generate_key_accessible_as_classmethod(self):\n        key = self.model.generate_key()\n        assert isinstance(key, str)\n\n    def test_generate_key_returns_valid_format(self):\n        \"\"\"Ensure generate_key returns a valid token format\"\"\"\n        key = self.model.generate_key()\n        assert len(key) == 40\n        # Should contain only valid hexadecimal characters\n        assert all(c in '0123456789abcdef' for c in key)\n\n    def test_generate_key_produces_unique_values(self):\n        \"\"\"Ensure generate_key produces unique values across multiple calls\"\"\"\n        keys = set()\n        for _ in range(100):\n            key = self.model.generate_key()\n            assert key not in keys, f\"Duplicate key generated: {key}\"\n            keys.add(key)\n\n    def test_generate_key_collision_resistance(self):\n        \"\"\"Test collision resistance with reasonable sample size\"\"\"\n        keys = set()\n        for _ in range(500):\n            key = self.model.generate_key()\n            assert key not in keys, f\"Collision found: {key}\"\n            keys.add(key)\n        assert len(keys) == 500, f\"Expected 500 unique keys, got {len(keys)}\"\n\n    def test_generate_key_randomness_quality(self):\n        \"\"\"Test basic randomness properties of generated keys\"\"\"\n        keys = [self.model.generate_key() for _ in range(10)]\n        # Consecutive keys should be different\n        for i in range(len(keys) - 1):\n            assert keys[i] != keys[i + 1], \"Consecutive keys should be different\"\n        # Keys should not follow obvious patterns\n        for key in keys:\n            # Should not be all same character\n            assert not all(c == key[0] for c in key), f\"Key has all same characters: {key}\"\n\n    def test_token_login_json(self):\n        \"\"\"Ensure token login view using JSON POST works.\"\"\"\n        client = APIClient(enforce_csrf_checks=True)\n        response = client.post(\n            '/auth-token/',\n            {'username': self.username, 'password': self.password},\n            format='json'\n        )\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['token'] == self.key\n\n    def test_token_login_json_bad_creds(self):\n        \"\"\"\n        Ensure token login view using JSON POST fails if\n        bad credentials are used\n        \"\"\"\n        client = APIClient(enforce_csrf_checks=True)\n        response = client.post(\n            '/auth-token/',\n            {'username': self.username, 'password': \"badpass\"},\n            format='json'\n        )\n        assert response.status_code == 400\n\n    def test_token_login_json_missing_fields(self):\n        \"\"\"Ensure token login view using JSON POST fails if missing fields.\"\"\"\n        client = APIClient(enforce_csrf_checks=True)\n        response = client.post('/auth-token/',\n                               {'username': self.username}, format='json')\n        assert response.status_code == 400\n\n    def test_token_login_form(self):\n        \"\"\"Ensure token login view using form POST works.\"\"\"\n        client = APIClient(enforce_csrf_checks=True)\n        response = client.post(\n            '/auth-token/',\n            {'username': self.username, 'password': self.password}\n        )\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data['token'] == self.key\n\n\n@override_settings(ROOT_URLCONF=__name__)\nclass CustomTokenAuthTests(BaseTokenAuthTests, TestCase):\n    model = CustomToken\n    path = '/customtoken/'\n\n\n@override_settings(ROOT_URLCONF=__name__)\nclass CustomKeywordTokenAuthTests(BaseTokenAuthTests, TestCase):\n    model = Token\n    path = '/customkeywordtoken/'\n    header_prefix = 'Bearer '\n\n\nclass IncorrectCredentialsTests(TestCase):\n    def test_incorrect_credentials(self):\n        \"\"\"\n        If a request contains bad authentication credentials, then\n        authentication should run and error, even if no permissions\n        are set on the view.\n        \"\"\"\n\n        class IncorrectCredentialsAuth(BaseAuthentication):\n            def authenticate(self, request):\n                raise exceptions.AuthenticationFailed('Bad credentials')\n\n        request = factory.get('/')\n        view = MockView.as_view(\n            authentication_classes=(IncorrectCredentialsAuth,),\n            permission_classes=()\n        )\n        response = view(request)\n        assert response.status_code == status.HTTP_403_FORBIDDEN\n        assert response.data == {'detail': 'Bad credentials'}\n\n\nclass FailingAuthAccessedInRenderer(TestCase):\n    def setUp(self):\n        class AuthAccessingRenderer(renderers.BaseRenderer):\n            media_type = 'text/plain'\n            format = 'txt'\n\n            def render(self, data, media_type=None, renderer_context=None):\n                request = renderer_context['request']\n                if request.user.is_authenticated:\n                    return b'authenticated'\n                return b'not authenticated'\n\n        class FailingAuth(BaseAuthentication):\n            def authenticate(self, request):\n                raise exceptions.AuthenticationFailed('authentication failed')\n\n        class ExampleView(APIView):\n            authentication_classes = (FailingAuth,)\n            renderer_classes = (AuthAccessingRenderer,)\n\n            def get(self, request):\n                return Response({'foo': 'bar'})\n\n        self.view = ExampleView.as_view()\n\n    def test_failing_auth_accessed_in_renderer(self):\n        \"\"\"\n        When authentication fails the renderer should still be able to access\n        `request.user` without raising an exception. Particularly relevant\n        to HTML responses that might reasonably access `request.user`.\n        \"\"\"\n        request = factory.get('/')\n        response = self.view(request)\n        content = response.render().content\n        assert content == b'not authenticated'\n\n\nclass NoAuthenticationClassesTests(TestCase):\n    def test_permission_message_with_no_authentication_classes(self):\n        \"\"\"\n        An unauthenticated request made against a view that contains no\n        `authentication_classes` but do contain `permissions_classes` the error\n        code returned should be 403 with the exception's message.\n        \"\"\"\n\n        class DummyPermission(permissions.BasePermission):\n            message = 'Dummy permission message'\n\n            def has_permission(self, request, view):\n                return False\n\n        request = factory.get('/')\n        view = MockView.as_view(\n            authentication_classes=(),\n            permission_classes=(DummyPermission,),\n        )\n        response = view(request)\n        assert response.status_code == status.HTTP_403_FORBIDDEN\n        assert response.data == {'detail': 'Dummy permission message'}\n\n\nclass BasicAuthenticationUnitTests(TestCase):\n\n    def test_base_authentication_abstract_method(self):\n        with pytest.raises(NotImplementedError):\n            BaseAuthentication().authenticate({})\n\n    def test_basic_authentication_raises_error_if_user_not_found(self):\n        auth = BasicAuthentication()\n        with pytest.raises(exceptions.AuthenticationFailed):\n            auth.authenticate_credentials('invalid id', 'invalid password')\n\n    def test_basic_authentication_raises_error_if_user_not_active(self):\n        from rest_framework import authentication\n\n        class MockUser:\n            is_active = False\n\n        old_authenticate = authentication.authenticate\n        authentication.authenticate = lambda **kwargs: MockUser()\n        try:\n            auth = authentication.BasicAuthentication()\n            with pytest.raises(exceptions.AuthenticationFailed) as exc_info:\n                auth.authenticate_credentials('foo', 'bar')\n            assert 'User inactive or deleted.' in str(exc_info.value)\n        finally:\n            authentication.authenticate = old_authenticate\n\n\n@override_settings(ROOT_URLCONF=__name__,\n                   AUTHENTICATION_BACKENDS=('django.contrib.auth.backends.RemoteUserBackend',))\nclass RemoteUserAuthenticationUnitTests(TestCase):\n    def setUp(self):\n        self.username = 'john'\n        self.email = 'lennon@thebeatles.com'\n        self.password = 'password'\n        self.user = User.objects.create_user(\n            self.username, self.email, self.password\n        )\n\n    def test_remote_user_works(self):\n        response = self.client.post('/remote-user/',\n                                    REMOTE_USER=self.username)\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n"
  },
  {
    "path": "tests/browsable_api/__init__.py",
    "content": ""
  },
  {
    "path": "tests/browsable_api/auth_urls.py",
    "content": "from django.urls import include, path\n\nfrom .views import MockView\n\nurlpatterns = [\n    path('', MockView.as_view()),\n    path('auth/', include('rest_framework.urls', namespace='rest_framework')),\n]\n"
  },
  {
    "path": "tests/browsable_api/no_auth_urls.py",
    "content": "from django.urls import path\n\nfrom .views import BasicModelWithUsersViewSet, MockView\n\nurlpatterns = [\n    path('', MockView.as_view()),\n    path('basicviewset', BasicModelWithUsersViewSet.as_view({'get': 'list'})),\n]\n"
  },
  {
    "path": "tests/browsable_api/serializers.py",
    "content": "from rest_framework.serializers import ModelSerializer\nfrom tests.models import BasicModelWithUsers\n\n\nclass BasicSerializer(ModelSerializer):\n    class Meta:\n        model = BasicModelWithUsers\n        fields = '__all__'\n"
  },
  {
    "path": "tests/browsable_api/test_browsable_api.py",
    "content": "from django.contrib.auth.models import User\nfrom django.test import TestCase, override_settings\n\nfrom rest_framework.permissions import IsAuthenticated\nfrom rest_framework.test import APIClient\n\nfrom .views import BasicModelWithUsersViewSet, OrganizationPermissions\n\n\n@override_settings(ROOT_URLCONF='tests.browsable_api.no_auth_urls')\nclass AnonymousUserTests(TestCase):\n    \"\"\"Tests correct handling of anonymous user request on endpoints with IsAuthenticated permission class.\"\"\"\n\n    def setUp(self):\n        self.client = APIClient(enforce_csrf_checks=True)\n\n    def tearDown(self):\n        self.client.logout()\n\n    def test_get_raises_typeerror_when_anonymous_user_in_queryset_filter(self):\n        with self.assertRaises(TypeError):\n            self.client.get('/basicviewset')\n\n    def test_get_returns_http_forbidden_when_anonymous_user(self):\n        old_permissions = BasicModelWithUsersViewSet.permission_classes\n        BasicModelWithUsersViewSet.permission_classes = [IsAuthenticated, OrganizationPermissions]\n\n        response = self.client.get('/basicviewset')\n\n        BasicModelWithUsersViewSet.permission_classes = old_permissions\n        self.assertEqual(response.status_code, 403)\n\n\n@override_settings(ROOT_URLCONF='tests.browsable_api.auth_urls')\nclass DropdownWithAuthTests(TestCase):\n    \"\"\"Tests correct dropdown behavior with Auth views enabled.\"\"\"\n    def setUp(self):\n        self.client = APIClient(enforce_csrf_checks=True)\n        self.username = 'john'\n        self.email = 'lennon@thebeatles.com'\n        self.password = 'password'\n        self.user = User.objects.create_user(\n            self.username,\n            self.email,\n            self.password\n        )\n\n    def tearDown(self):\n        self.client.logout()\n\n    def test_name_shown_when_logged_in(self):\n        self.client.login(username=self.username, password=self.password)\n        response = self.client.get('/')\n        content = response.content.decode()\n        assert 'john' in content\n\n    def test_logout_shown_when_logged_in(self):\n        self.client.login(username=self.username, password=self.password)\n        response = self.client.get('/')\n        content = response.content.decode()\n        assert '>Log out<' in content\n\n    def test_login_shown_when_logged_out(self):\n        response = self.client.get('/')\n        content = response.content.decode()\n        assert '>Log in<' in content\n\n    def test_dropdown_contains_logout_form(self):\n        self.client.login(username=self.username, password=self.password)\n        response = self.client.get('/')\n        content = response.content.decode()\n        assert '<form id=\"logoutForm\" method=\"post\" action=\"/auth/logout/?next=/\">' in content\n\n\n@override_settings(ROOT_URLCONF='tests.browsable_api.no_auth_urls')\nclass NoDropdownWithoutAuthTests(TestCase):\n    \"\"\"Tests correct dropdown behavior with Auth views NOT enabled.\"\"\"\n    def setUp(self):\n        self.client = APIClient(enforce_csrf_checks=True)\n        self.username = 'john'\n        self.email = 'lennon@thebeatles.com'\n        self.password = 'password'\n        self.user = User.objects.create_user(\n            self.username,\n            self.email,\n            self.password\n        )\n\n    def tearDown(self):\n        self.client.logout()\n\n    def test_name_shown_when_logged_in(self):\n        self.client.login(username=self.username, password=self.password)\n        response = self.client.get('/')\n        content = response.content.decode()\n        assert 'john' in content\n\n    def test_dropdown_not_shown_when_logged_in(self):\n        self.client.login(username=self.username, password=self.password)\n        response = self.client.get('/')\n        content = response.content.decode()\n        assert '<li class=\"dropdown\">' not in content\n\n    def test_dropdown_not_shown_when_logged_out(self):\n        response = self.client.get('/')\n        content = response.content.decode()\n        assert '<li class=\"dropdown\">' not in content\n"
  },
  {
    "path": "tests/browsable_api/test_browsable_nested_api.py",
    "content": "from django.test import TestCase\nfrom django.test.utils import override_settings\nfrom django.urls import path\n\nfrom rest_framework import serializers\nfrom rest_framework.generics import ListCreateAPIView\nfrom rest_framework.renderers import BrowsableAPIRenderer\n\n\nclass NestedSerializer(serializers.Serializer):\n    one = serializers.IntegerField(max_value=10)\n    two = serializers.IntegerField(max_value=10)\n\n\nclass NestedSerializerTestSerializer(serializers.Serializer):\n    nested = NestedSerializer()\n\n\nclass NestedSerializersView(ListCreateAPIView):\n    renderer_classes = (BrowsableAPIRenderer, )\n    serializer_class = NestedSerializerTestSerializer\n    queryset = [{'nested': {'one': 1, 'two': 2}}]\n\n\nurlpatterns = [\n    path('api/', NestedSerializersView.as_view(), name='api'),\n]\n\n\nclass DropdownWithAuthTests(TestCase):\n    \"\"\"Tests correct dropdown behavior with Auth views enabled.\"\"\"\n\n    @override_settings(ROOT_URLCONF='tests.browsable_api.test_browsable_nested_api')\n    def test_login(self):\n        response = self.client.get('/api/')\n        assert 200 == response.status_code\n        content = response.content.decode()\n        assert 'form action=\"/api/\"' in content\n        assert 'input name=\"nested.one\"' in content\n        assert 'input name=\"nested.two\"' in content\n"
  },
  {
    "path": "tests/browsable_api/test_form_rendering.py",
    "content": "from django.test import TestCase\n\nfrom rest_framework import generics, renderers, serializers, status\nfrom rest_framework.response import Response\nfrom rest_framework.test import APIRequestFactory\nfrom tests.models import BasicModel\n\nfactory = APIRequestFactory()\n\n\nclass BasicSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = BasicModel\n        fields = '__all__'\n\n\nclass StandardPostView(generics.CreateAPIView):\n    serializer_class = BasicSerializer\n\n\nclass ManyPostView(generics.GenericAPIView):\n    queryset = BasicModel.objects.all()\n    serializer_class = BasicSerializer\n    renderer_classes = (renderers.BrowsableAPIRenderer, renderers.JSONRenderer)\n\n    def post(self, request, *args, **kwargs):\n        serializer = self.get_serializer(self.get_queryset(), many=True)\n        return Response(serializer.data, status.HTTP_200_OK)\n\n\nclass TestPostingListData(TestCase):\n    \"\"\"\n    POSTing a list of data to a regular view should not cause the browsable\n    API to fail during rendering.\n\n    Regression test for https://github.com/encode/django-rest-framework/issues/5637\n    \"\"\"\n\n    def test_json_response(self):\n        # sanity check for non-browsable API responses\n        view = StandardPostView.as_view()\n        request = factory.post('/', [{}], format='json')\n        response = view(request).render()\n\n        self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n        self.assertTrue('non_field_errors' in response.data)\n\n    def test_browsable_api(self):\n        view = StandardPostView.as_view()\n        request = factory.post('/?format=api', [{}], format='json')\n        response = view(request).render()\n\n        self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n        self.assertTrue('non_field_errors' in response.data)\n\n\nclass TestManyPostView(TestCase):\n    def setUp(self):\n        \"\"\"\n        Create 3 BasicModel instances.\n        \"\"\"\n        items = ['foo', 'bar', 'baz']\n        for item in items:\n            BasicModel(text=item).save()\n        self.objects = BasicModel.objects\n        self.data = [\n            {'id': obj.id, 'text': obj.text}\n            for obj in self.objects.all()\n        ]\n        self.view = ManyPostView.as_view()\n\n    def test_post_many_post_view(self):\n        \"\"\"\n        POST request to a view that returns a list of objects should\n        still successfully return the browsable API with a rendered form.\n\n        Regression test for https://github.com/encode/django-rest-framework/pull/3164\n        \"\"\"\n        data = {}\n        request = factory.post('/', data, format='json')\n        with self.assertNumQueries(1):\n            response = self.view(request).render()\n        assert response.status_code == status.HTTP_200_OK\n        assert len(response.data) == 3\n"
  },
  {
    "path": "tests/browsable_api/views.py",
    "content": "from rest_framework import authentication, renderers\nfrom rest_framework.permissions import BasePermission\nfrom rest_framework.response import Response\nfrom rest_framework.views import APIView\nfrom rest_framework.viewsets import ModelViewSet\n\nfrom ..models import BasicModelWithUsers\nfrom .serializers import BasicSerializer\n\n\nclass OrganizationPermissions(BasePermission):\n    def has_object_permission(self, request, view, obj):\n        return request.user.is_staff or (request.user == obj.owner.organization_user.user)\n\n\nclass MockView(APIView):\n    authentication_classes = (authentication.SessionAuthentication,)\n    renderer_classes = (renderers.BrowsableAPIRenderer, renderers.JSONRenderer)\n\n    def get(self, request):\n        return Response({'a': 1, 'b': 2, 'c': 3})\n\n\nclass BasicModelWithUsersViewSet(ModelViewSet):\n    queryset = BasicModelWithUsers.objects.all()\n    serializer_class = BasicSerializer\n    permission_classes = [OrganizationPermissions]\n    # permission_classes = [IsAuthenticated, OrganizationPermissions]\n    renderer_classes = (renderers.BrowsableAPIRenderer, renderers.JSONRenderer)\n\n    def get_queryset(self):\n        qs = super().get_queryset().filter(users=self.request.user)\n        return qs\n"
  },
  {
    "path": "tests/conftest.py",
    "content": "import os\n\nimport django\nfrom django.core import management\n\n\ndef pytest_addoption(parser):\n    parser.addoption('--staticfiles', action='store_true', default=False,\n                     help='Run tests with static files collection, using manifest '\n                          'staticfiles storage. Used for testing the distribution.')\n\n\ndef pytest_configure(config):\n    from django.conf import settings\n\n    settings.configure(\n        DEBUG_PROPAGATE_EXCEPTIONS=True,\n        DEFAULT_AUTO_FIELD=\"django.db.models.AutoField\",\n        DATABASES={\n            'default': {\n                'ENGINE': 'django.db.backends.sqlite3',\n                'NAME': ':memory:'\n            },\n            'secondary': {\n                'ENGINE': 'django.db.backends.sqlite3',\n                'NAME': ':memory:'\n            }\n        },\n        SITE_ID=1,\n        SECRET_KEY='not very secret in tests',\n        USE_I18N=True,\n        STATIC_URL='/static/',\n        ROOT_URLCONF='tests.urls',\n        TEMPLATES=[\n            {\n                'BACKEND': 'django.template.backends.django.DjangoTemplates',\n                'APP_DIRS': True,\n                'OPTIONS': {\n                    \"debug\": True,  # We want template errors to raise\n                }\n            },\n        ],\n        MIDDLEWARE=(\n            'django.middleware.common.CommonMiddleware',\n            'django.contrib.sessions.middleware.SessionMiddleware',\n            'django.contrib.auth.middleware.AuthenticationMiddleware',\n            'django.contrib.messages.middleware.MessageMiddleware',\n        ),\n        INSTALLED_APPS=(\n            'django.contrib.admin',\n            'django.contrib.auth',\n            'django.contrib.contenttypes',\n            'django.contrib.sessions',\n            'django.contrib.sites',\n            'django.contrib.staticfiles',\n            'rest_framework',\n            'rest_framework.authtoken',\n            'tests.authentication',\n            'tests.generic_relations',\n            'tests.importable',\n            'tests',\n        ),\n        PASSWORD_HASHERS=(\n            'django.contrib.auth.hashers.MD5PasswordHasher',\n        ),\n    )\n\n    # guardian is optional\n    try:\n        import guardian  # NOQA\n    except ImportError:\n        pass\n    else:\n        settings.ANONYMOUS_USER_ID = -1\n        settings.AUTHENTICATION_BACKENDS = (\n            'django.contrib.auth.backends.ModelBackend',\n            'guardian.backends.ObjectPermissionBackend',\n        )\n        settings.INSTALLED_APPS += (\n            'guardian',\n        )\n\n    # Manifest storage will raise an exception if static files are not present (ie, a packaging failure).\n    if config.getoption('--staticfiles'):\n        import rest_framework\n        settings.STATIC_ROOT = os.path.join(os.path.dirname(rest_framework.__file__), 'static-root')\n        backend = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'\n        settings.STORAGES['staticfiles']['BACKEND'] = backend\n\n    django.setup()\n\n    if config.getoption('--staticfiles'):\n        management.call_command('collectstatic', verbosity=0, interactive=False)\n"
  },
  {
    "path": "tests/generic_relations/__init__.py",
    "content": ""
  },
  {
    "path": "tests/generic_relations/migrations/0001_initial.py",
    "content": "from django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n    initial = True\n\n    dependencies = [\n        ('contenttypes', '0002_remove_content_type_name'),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name='Bookmark',\n            fields=[\n                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n                ('url', models.URLField()),\n            ],\n        ),\n        migrations.CreateModel(\n            name='Note',\n            fields=[\n                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n                ('text', models.TextField()),\n            ],\n        ),\n        migrations.CreateModel(\n            name='Tag',\n            fields=[\n                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n                ('tag', models.SlugField()),\n                ('object_id', models.PositiveIntegerField()),\n                ('content_type', models.ForeignKey(on_delete=models.CASCADE, to='contenttypes.ContentType')),\n            ],\n        ),\n    ]\n"
  },
  {
    "path": "tests/generic_relations/migrations/__init__.py",
    "content": ""
  },
  {
    "path": "tests/generic_relations/models.py",
    "content": "from django.contrib.contenttypes.fields import (\n    GenericForeignKey, GenericRelation\n)\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.db import models\n\n\nclass Tag(models.Model):\n    \"\"\"\n    Tags have a descriptive slug, and are attached to an arbitrary object.\n    \"\"\"\n    tag = models.SlugField()\n    content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)\n    object_id = models.PositiveIntegerField()\n    tagged_item = GenericForeignKey('content_type', 'object_id')\n\n    def __str__(self):\n        return self.tag\n\n\nclass Bookmark(models.Model):\n    \"\"\"\n    A URL bookmark that may have multiple tags attached.\n    \"\"\"\n    url = models.URLField()\n    tags = GenericRelation(Tag)\n\n    def __str__(self):\n        return 'Bookmark: %s' % self.url\n\n\nclass Note(models.Model):\n    \"\"\"\n    A textual note that may have multiple tags attached.\n    \"\"\"\n    text = models.TextField()\n    tags = GenericRelation(Tag)\n\n    def __str__(self):\n        return 'Note: %s' % self.text\n"
  },
  {
    "path": "tests/generic_relations/test_generic_relations.py",
    "content": "from django.test import TestCase\n\nfrom rest_framework import serializers\n\nfrom .models import Bookmark, Note, Tag\n\n\nclass TestGenericRelations(TestCase):\n    def setUp(self):\n        self.bookmark = Bookmark.objects.create(url='https://www.djangoproject.com/')\n        Tag.objects.create(tagged_item=self.bookmark, tag='django')\n        Tag.objects.create(tagged_item=self.bookmark, tag='python')\n        self.note = Note.objects.create(text='Remember the milk')\n        Tag.objects.create(tagged_item=self.note, tag='reminder')\n\n    def test_generic_relation(self):\n        \"\"\"\n        Test a relationship that spans a GenericRelation field.\n        IE. A reverse generic relationship.\n        \"\"\"\n\n        class BookmarkSerializer(serializers.ModelSerializer):\n            tags = serializers.StringRelatedField(many=True)\n\n            class Meta:\n                model = Bookmark\n                fields = ('tags', 'url')\n\n        serializer = BookmarkSerializer(self.bookmark)\n        expected = {\n            'tags': ['django', 'python'],\n            'url': 'https://www.djangoproject.com/'\n        }\n        assert serializer.data == expected\n\n    def test_generic_fk(self):\n        \"\"\"\n        Test a relationship that spans a GenericForeignKey field.\n        IE. A forward generic relationship.\n        \"\"\"\n\n        class TagSerializer(serializers.ModelSerializer):\n            tagged_item = serializers.StringRelatedField()\n\n            class Meta:\n                model = Tag\n                fields = ('tag', 'tagged_item')\n\n        serializer = TagSerializer(Tag.objects.all(), many=True)\n        expected = [\n            {\n                'tag': 'django',\n                'tagged_item': 'Bookmark: https://www.djangoproject.com/'\n            },\n            {\n                'tag': 'python',\n                'tagged_item': 'Bookmark: https://www.djangoproject.com/'\n            },\n            {\n                'tag': 'reminder',\n                'tagged_item': 'Note: Remember the milk'\n            }\n        ]\n        assert serializer.data == expected\n"
  },
  {
    "path": "tests/importable/__init__.py",
    "content": "\"\"\"\nThis test \"app\" exists to ensure that parts of Django REST Framework can be\nimported/invoked before Django itself has been fully initialized.\n\"\"\"\n\nfrom rest_framework import compat, serializers  # noqa\n\n\n# test initializing fields with lazy translations\nclass ExampleSerializer(serializers.Serializer):\n    charfield = serializers.CharField(min_length=1, max_length=2)\n    integerfield = serializers.IntegerField(min_value=1, max_value=2)\n    floatfield = serializers.FloatField(min_value=1, max_value=2)\n    decimalfield = serializers.DecimalField(max_digits=10, decimal_places=1, min_value=1, max_value=2)\n    durationfield = serializers.DurationField(min_value=1, max_value=2)\n    listfield = serializers.ListField(min_length=1, max_length=2)\n"
  },
  {
    "path": "tests/importable/test_installed.py",
    "content": "from django.conf import settings\n\nfrom tests import importable\n\n\ndef test_installed():\n    # ensure the test app hasn't been removed from the test suite\n    assert 'tests.importable' in settings.INSTALLED_APPS\n\n\ndef test_compat():\n    assert hasattr(importable, 'compat')\n\n\ndef test_serializer_fields_initialization():\n    assert hasattr(importable, 'ExampleSerializer')\n\n    serializer = importable.ExampleSerializer()\n    assert 'charfield' in serializer.fields\n    assert 'integerfield' in serializer.fields\n    assert 'floatfield' in serializer.fields\n    assert 'decimalfield' in serializer.fields\n    assert 'durationfield' in serializer.fields\n    assert 'listfield' in serializer.fields\n"
  },
  {
    "path": "tests/models.py",
    "content": "import uuid\n\nfrom django.contrib.auth.models import User\nfrom django.db import models\nfrom django.db.models import QuerySet\nfrom django.db.models.manager import BaseManager\nfrom django.utils.translation import gettext_lazy as _\n\n\nclass RESTFrameworkModel(models.Model):\n    \"\"\"\n    Base for test models that sets app_label, so they play nicely.\n    \"\"\"\n\n    class Meta:\n        app_label = 'tests'\n        abstract = True\n\n\nclass BasicModel(RESTFrameworkModel):\n    text = models.CharField(\n        max_length=100,\n        verbose_name=_(\"Text comes here\"),\n        help_text=_(\"Text description.\")\n    )\n\n\n# Models for relations tests\n# ManyToMany\nclass ManyToManyTarget(RESTFrameworkModel):\n    name = models.CharField(max_length=100)\n\n\nclass ManyToManySource(RESTFrameworkModel):\n    name = models.CharField(max_length=100)\n    targets = models.ManyToManyField(ManyToManyTarget, related_name='sources')\n\n\nclass BasicModelWithUsers(RESTFrameworkModel):\n    users = models.ManyToManyField(User)\n\n\n# ForeignKey\nclass ForeignKeyTarget(RESTFrameworkModel):\n    name = models.CharField(max_length=100)\n\n    def get_first_source(self):\n        \"\"\"Used for testing related field against a callable.\"\"\"\n        return self.sources.all().order_by('pk')[0]\n\n    @property\n    def first_source(self):\n        \"\"\"Used for testing related field against a property.\"\"\"\n        return self.sources.all().order_by('pk')[0]\n\n\nclass UUIDForeignKeyTarget(RESTFrameworkModel):\n    uuid = models.UUIDField(primary_key=True, default=uuid.uuid4)\n    name = models.CharField(max_length=100)\n\n\nclass ForeignKeySource(RESTFrameworkModel):\n    name = models.CharField(max_length=100)\n    target = models.ForeignKey(ForeignKeyTarget, related_name='sources',\n                               help_text='Target', verbose_name='Target',\n                               on_delete=models.CASCADE)\n\n\nclass ForeignKeySourceWithLimitedChoices(RESTFrameworkModel):\n    target = models.ForeignKey(ForeignKeyTarget, help_text='Target',\n                               verbose_name='Target',\n                               limit_choices_to={\"name__startswith\": \"limited-\"},\n                               on_delete=models.CASCADE)\n\n\nclass ForeignKeySourceWithQLimitedChoices(RESTFrameworkModel):\n    target = models.ForeignKey(ForeignKeyTarget, help_text='Target',\n                               verbose_name='Target',\n                               limit_choices_to=models.Q(name__startswith=\"limited-\"),\n                               on_delete=models.CASCADE)\n\n\n# Nullable ForeignKey\nclass NullableForeignKeySource(RESTFrameworkModel):\n    name = models.CharField(max_length=100)\n    target = models.ForeignKey(ForeignKeyTarget, null=True, blank=True,\n                               related_name='nullable_sources',\n                               verbose_name='Optional target object',\n                               on_delete=models.CASCADE)\n\n\nclass NullableUUIDForeignKeySource(RESTFrameworkModel):\n    name = models.CharField(max_length=100)\n    target = models.ForeignKey(ForeignKeyTarget, null=True, blank=True,\n                               related_name='nullable_sources',\n                               verbose_name='Optional target object',\n                               on_delete=models.CASCADE)\n\n\nclass NestedForeignKeySource(RESTFrameworkModel):\n    \"\"\"\n    Used for testing FK chain. A -> B -> C.\n    \"\"\"\n    name = models.CharField(max_length=100)\n    target = models.ForeignKey(NullableForeignKeySource, null=True, blank=True,\n                               related_name='nested_sources',\n                               verbose_name='Intermediate target object',\n                               on_delete=models.CASCADE)\n\n\n# OneToOne\nclass OneToOneTarget(RESTFrameworkModel):\n    name = models.CharField(max_length=100)\n\n\nclass NullableOneToOneSource(RESTFrameworkModel):\n    name = models.CharField(max_length=100)\n    target = models.OneToOneField(\n        OneToOneTarget, null=True, blank=True,\n        related_name='nullable_source', on_delete=models.CASCADE)\n\n\nclass OneToOnePKSource(RESTFrameworkModel):\n    \"\"\" Test model where the primary key is a OneToOneField with another model. \"\"\"\n    name = models.CharField(max_length=100)\n    target = models.OneToOneField(\n        OneToOneTarget, primary_key=True,\n        related_name='required_source', on_delete=models.CASCADE)\n\n\nclass CustomManagerModel(RESTFrameworkModel):\n    class CustomManager:\n        def __new__(cls, *args, **kwargs):\n            cls = BaseManager.from_queryset(\n                QuerySet\n            )\n            return cls\n\n    objects = CustomManager()()\n    # `CustomManager()` will return a `BaseManager` class.\n    # We need to instantiation it, so we write `CustomManager()()` here.\n\n    text = models.CharField(\n        max_length=100,\n        verbose_name=_(\"Text comes here\"),\n        help_text=_(\"Text description.\")\n    )\n\n    o2o_target = models.ForeignKey(OneToOneTarget,\n                                   help_text='OneToOneTarget',\n                                   verbose_name='OneToOneTarget',\n                                   on_delete=models.CASCADE)\n"
  },
  {
    "path": "tests/schemas/__init__.py",
    "content": ""
  },
  {
    "path": "tests/schemas/test_get_schema_view.py",
    "content": "from django.test import TestCase\n\nfrom rest_framework import renderers\nfrom rest_framework.schemas import get_schema_view, openapi\n\n\nclass GetSchemaViewTests(TestCase):\n    \"\"\"For the get_schema_view() helper.\"\"\"\n    def test_openapi(self):\n        schema_view = get_schema_view(title=\"With OpenAPI\")\n        assert isinstance(schema_view.initkwargs['schema_generator'], openapi.SchemaGenerator)\n        assert renderers.OpenAPIRenderer in schema_view.cls().renderer_classes\n"
  },
  {
    "path": "tests/schemas/test_managementcommand.py",
    "content": "import io\nimport os\nimport tempfile\n\nimport pytest\nfrom django.core.management import call_command\nfrom django.test import TestCase\nfrom django.test.utils import override_settings\nfrom django.urls import path\n\nfrom rest_framework.compat import uritemplate, yaml\nfrom rest_framework.utils import json\nfrom rest_framework.views import APIView\n\n\nclass FooView(APIView):\n    def get(self, request):\n        pass\n\n\nurlpatterns = [\n    path('', FooView.as_view())\n]\n\n\nclass CustomSchemaGenerator:\n    SCHEMA = {\"key\": \"value\"}\n\n    def __init__(self, *args, **kwargs):\n        pass\n\n    def get_schema(self, **kwargs):\n        return self.SCHEMA\n\n\n@override_settings(ROOT_URLCONF=__name__)\n@pytest.mark.skipif(not uritemplate, reason='uritemplate is not installed')\nclass GenerateSchemaTests(TestCase):\n    \"\"\"Tests for management command generateschema.\"\"\"\n\n    def setUp(self):\n        self.out = io.StringIO()\n\n    @pytest.mark.skipif(yaml is None, reason='PyYAML is required.')\n    def test_renders_default_schema_with_custom_title_url_and_description(self):\n        call_command('generateschema',\n                     '--title=ExampleAPI',\n                     '--url=http://api.example.com',\n                     '--description=Example description',\n                     stdout=self.out)\n        # Check valid YAML was output.\n        schema = yaml.safe_load(self.out.getvalue())\n        assert schema['openapi'] == '3.0.2'\n\n    def test_renders_openapi_json_schema(self):\n        call_command('generateschema',\n                     '--format=openapi-json',\n                     stdout=self.out)\n        # Check valid JSON was output.\n        out_json = json.loads(self.out.getvalue())\n        assert out_json['openapi'] == '3.0.2'\n\n    def test_accepts_custom_schema_generator(self):\n        call_command('generateschema',\n                     f'--generator_class={__name__}.{CustomSchemaGenerator.__name__}',\n                     stdout=self.out)\n        out_json = yaml.safe_load(self.out.getvalue())\n        assert out_json == CustomSchemaGenerator.SCHEMA\n\n    def test_writes_schema_to_file_on_parameter(self):\n        fd, path = tempfile.mkstemp()\n        try:\n            call_command('generateschema', f'--file={path}', stdout=self.out)\n            # nothing on stdout\n            assert not self.out.getvalue()\n\n            call_command('generateschema', stdout=self.out)\n            expected_out = self.out.getvalue()\n            # file output identical to stdout output\n            with os.fdopen(fd) as fh:\n                assert expected_out and fh.read() == expected_out\n        finally:\n            os.remove(path)\n"
  },
  {
    "path": "tests/schemas/test_openapi.py",
    "content": "import uuid\nimport warnings\n\nimport pytest\nfrom django.db import models\nfrom django.test import RequestFactory, TestCase, override_settings\nfrom django.urls import path\nfrom django.utils.safestring import SafeString\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework import filters, generics, pagination, routers, serializers\nfrom rest_framework.authtoken.views import obtain_auth_token\nfrom rest_framework.compat import uritemplate\nfrom rest_framework.parsers import JSONParser, MultiPartParser\nfrom rest_framework.renderers import (\n    BaseRenderer, BrowsableAPIRenderer, JSONOpenAPIRenderer, JSONRenderer,\n    OpenAPIRenderer\n)\nfrom rest_framework.request import Request\nfrom rest_framework.schemas.openapi import AutoSchema, SchemaGenerator\n\nfrom ..models import BasicModel\nfrom . import views\n\n\ndef create_request(path):\n    factory = RequestFactory()\n    request = Request(factory.get(path))\n    return request\n\n\ndef create_view(view_cls, method, request):\n    generator = SchemaGenerator()\n    view = generator.create_view(view_cls.as_view(), method, request)\n    return view\n\n\nclass TestBasics(TestCase):\n    def dummy_view(request):\n        pass\n\n    def test_filters(self):\n        classes = [filters.SearchFilter, filters.OrderingFilter]\n        for c in classes:\n            f = c()\n            assert f.get_schema_operation_parameters(self.dummy_view)\n\n    def test_pagination(self):\n        classes = [pagination.PageNumberPagination, pagination.LimitOffsetPagination, pagination.CursorPagination]\n        for c in classes:\n            f = c()\n            assert f.get_schema_operation_parameters(self.dummy_view)\n\n\nclass TestFieldMapping(TestCase):\n    def test_list_field_mapping(self):\n        uuid1 = uuid.uuid4()\n        uuid2 = uuid.uuid4()\n        inspector = AutoSchema()\n        cases = [\n            (serializers.ListField(), {'items': {}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.BooleanField()), {'items': {'type': 'boolean'}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.FloatField()), {'items': {'type': 'number'}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.CharField()), {'items': {'type': 'string'}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.IntegerField(max_value=4294967295)),\n             {'items': {'type': 'integer', 'maximum': 4294967295, 'format': 'int64'}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.ChoiceField(choices=[('a', 'Choice A'), ('b', 'Choice B')])),\n             {'items': {'enum': ['a', 'b'], 'type': 'string'}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.ChoiceField(choices=[(1, 'One'), (2, 'Two')])),\n             {'items': {'enum': [1, 2], 'type': 'integer'}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.ChoiceField(choices=[(1.1, 'First'), (2.2, 'Second')])),\n             {'items': {'enum': [1.1, 2.2], 'type': 'number'}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.ChoiceField(choices=[(True, 'true'), (False, 'false')])),\n             {'items': {'enum': [True, False], 'type': 'boolean'}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.ChoiceField(choices=[(uuid1, 'uuid1'), (uuid2, 'uuid2')])),\n             {'items': {'enum': [uuid1, uuid2]}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.ChoiceField(choices=[(1, 'One'), ('a', 'Choice A')])),\n             {'items': {'enum': [1, 'a']}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.ChoiceField(choices=[\n                (1, 'One'), ('a', 'Choice A'), (1.1, 'First'), (1.1, 'First'), (1, 'One'), ('a', 'Choice A'), (1, 'One')\n            ])),\n                {'items': {'enum': [1, 'a', 1.1]}, 'type': 'array'}),\n            (serializers.ListField(child=serializers.ChoiceField(choices=[\n                (1, 'One'), (2, 'Two'), (3, 'Three'), (2, 'Two'), (3, 'Three'), (1, 'One'),\n            ])),\n                {'items': {'enum': [1, 2, 3], 'type': 'integer'}, 'type': 'array'}),\n            (serializers.IntegerField(min_value=2147483648),\n             {'type': 'integer', 'minimum': 2147483648, 'format': 'int64'}),\n        ]\n        for field, mapping in cases:\n            with self.subTest(field=field):\n                assert inspector.map_field(field) == mapping\n\n    def test_lazy_string_field(self):\n        class ItemSerializer(serializers.Serializer):\n            text = serializers.CharField(help_text=_('lazy string'))\n\n        inspector = AutoSchema()\n\n        data = inspector.map_serializer(ItemSerializer())\n        assert isinstance(data['properties']['text']['description'], str), \"description must be str\"\n\n    def test_boolean_default_field(self):\n        class Serializer(serializers.Serializer):\n            default_true = serializers.BooleanField(default=True)\n            default_false = serializers.BooleanField(default=False)\n            without_default = serializers.BooleanField()\n\n        inspector = AutoSchema()\n\n        data = inspector.map_serializer(Serializer())\n        assert data['properties']['default_true']['default'] is True, \"default must be true\"\n        assert data['properties']['default_false']['default'] is False, \"default must be false\"\n        assert 'default' not in data['properties']['without_default'], \"default must not be defined\"\n\n    def test_custom_field_name(self):\n        class CustomSchema(AutoSchema):\n            def get_field_name(self, field):\n                return 'custom_' + field.field_name\n\n        class Serializer(serializers.Serializer):\n            text_field = serializers.CharField()\n\n        inspector = CustomSchema()\n\n        data = inspector.map_serializer(Serializer())\n        assert 'custom_text_field' in data['properties']\n        assert 'text_field' not in data['properties']\n\n    def test_nullable_fields(self):\n        class Model(models.Model):\n            rw_field = models.CharField(null=True)\n            ro_field = models.CharField(null=True)\n\n        class Serializer(serializers.ModelSerializer):\n            class Meta:\n                model = Model\n                fields = [\"rw_field\", \"ro_field\"]\n                read_only_fields = [\"ro_field\"]\n\n        inspector = AutoSchema()\n\n        data = inspector.map_serializer(Serializer())\n        assert data['properties']['rw_field']['nullable'], \"rw_field nullable must be true\"\n        assert data['properties']['ro_field']['nullable'], \"ro_field nullable must be true\"\n        assert data['properties']['ro_field']['readOnly'], \"ro_field read_only must be true\"\n\n    def test_primary_key_related_field(self):\n        class PrimaryKeyRelatedFieldSerializer(serializers.Serializer):\n            basic = serializers.PrimaryKeyRelatedField(queryset=BasicModel.objects.all())\n            uuid = serializers.PrimaryKeyRelatedField(queryset=BasicModel.objects.all(),\n                                                      pk_field=serializers.UUIDField())\n            char = serializers.PrimaryKeyRelatedField(queryset=BasicModel.objects.all(),\n                                                      pk_field=serializers.CharField())\n\n        serializer = PrimaryKeyRelatedFieldSerializer()\n        inspector = AutoSchema()\n\n        data = inspector.map_serializer(serializer=serializer)\n        assert data['properties']['basic']['type'] == \"integer\"\n        assert data['properties']['uuid']['format'] == \"uuid\"\n        assert data['properties']['char']['type'] == \"string\"\n\n\n@pytest.mark.skipif(uritemplate is None, reason='uritemplate not installed.')\nclass TestOperationIntrospection(TestCase):\n\n    def test_path_without_parameters(self):\n        path = '/example/'\n        method = 'GET'\n\n        view = create_view(\n            views.DocStringExampleListView,\n            method,\n            create_request(path)\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        operation = inspector.get_operation(path, method)\n        assert operation == {\n            'operationId': 'listDocStringExamples',\n            'description': 'A description of my GET operation.',\n            'parameters': [],\n            'tags': ['example'],\n            'responses': {\n                '200': {\n                    'description': '',\n                    'content': {\n                        'application/json': {\n                            'schema': {\n                                'type': 'array',\n                                'items': {},\n                            },\n                        },\n                    },\n                },\n            },\n        }\n\n    def test_path_with_id_parameter(self):\n        path = '/example/{id}/'\n        method = 'GET'\n\n        view = create_view(\n            views.DocStringExampleDetailView,\n            method,\n            create_request(path)\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        operation = inspector.get_operation(path, method)\n        assert operation == {\n            'operationId': 'retrieveDocStringExampleDetail',\n            'description': 'A description of my GET operation.',\n            'parameters': [{\n                'description': '',\n                'in': 'path',\n                'name': 'id',\n                'required': True,\n                'schema': {\n                    'type': 'string',\n                },\n            }],\n            'tags': ['example'],\n            'responses': {\n                '200': {\n                    'description': '',\n                    'content': {\n                        'application/json': {\n                            'schema': {\n                            },\n                        },\n                    },\n                },\n            },\n        }\n\n    def test_request_body(self):\n        path = '/'\n        method = 'POST'\n\n        class ItemSerializer(serializers.Serializer):\n            text = serializers.CharField()\n            read_only = serializers.CharField(read_only=True)\n\n        class View(generics.GenericAPIView):\n            serializer_class = ItemSerializer\n\n        view = create_view(\n            View,\n            method,\n            create_request(path)\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        request_body = inspector.get_request_body(path, method)\n        assert request_body['content']['application/json']['schema']['$ref'] == '#/components/schemas/Item'\n\n        components = inspector.get_components(path, method)\n        assert components['Item']['required'] == ['text']\n        assert sorted(list(components['Item']['properties'].keys())) == ['read_only', 'text']\n\n    def test_invalid_serializer_class_name(self):\n        path = '/'\n        method = 'POST'\n\n        class Serializer(serializers.Serializer):\n            text = serializers.CharField()\n            read_only = serializers.CharField(read_only=True)\n\n        class View(generics.GenericAPIView):\n            serializer_class = Serializer\n\n        view = create_view(\n            View,\n            method,\n            create_request(path)\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        serializer = inspector.get_serializer(path, method)\n\n        with pytest.raises(Exception) as exc:\n            inspector.get_component_name(serializer)\n        assert \"is an invalid class name for schema generation\" in str(exc.value)\n\n    def test_empty_required(self):\n        path = '/'\n        method = 'POST'\n\n        class ItemSerializer(serializers.Serializer):\n            read_only = serializers.CharField(read_only=True)\n            write_only = serializers.CharField(write_only=True, required=False)\n\n        class View(generics.GenericAPIView):\n            serializer_class = ItemSerializer\n\n        view = create_view(\n            View,\n            method,\n            create_request(path)\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        components = inspector.get_components(path, method)\n        component = components['Item']\n        # there should be no empty 'required' property, see #6834\n        assert 'required' not in component\n\n        for response in inspector.get_responses(path, method).values():\n            assert 'required' not in component\n\n    def test_empty_required_with_patch_method(self):\n        path = '/'\n        method = 'PATCH'\n\n        class ItemSerializer(serializers.Serializer):\n            read_only = serializers.CharField(read_only=True)\n            write_only = serializers.CharField(write_only=True, required=False)\n\n        class View(generics.GenericAPIView):\n            serializer_class = ItemSerializer\n\n        view = create_view(\n            View,\n            method,\n            create_request(path)\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        components = inspector.get_components(path, method)\n        component = components['Item']\n        # there should be no empty 'required' property, see #6834\n        assert 'required' not in component\n        for response in inspector.get_responses(path, method).values():\n            assert 'required' not in component\n\n    def test_response_body_generation(self):\n        path = '/'\n        method = 'POST'\n\n        class ItemSerializer(serializers.Serializer):\n            text = serializers.CharField()\n            write_only = serializers.CharField(write_only=True)\n\n        class View(generics.GenericAPIView):\n            serializer_class = ItemSerializer\n\n        view = create_view(\n            View,\n            method,\n            create_request(path)\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        responses = inspector.get_responses(path, method)\n        assert responses['201']['content']['application/json']['schema']['$ref'] == '#/components/schemas/Item'\n\n        components = inspector.get_components(path, method)\n        assert sorted(components['Item']['required']) == ['text', 'write_only']\n        assert sorted(list(components['Item']['properties'].keys())) == ['text', 'write_only']\n        assert 'description' in responses['201']\n\n    def test_response_body_nested_serializer(self):\n        path = '/'\n        method = 'POST'\n\n        class NestedSerializer(serializers.Serializer):\n            number = serializers.IntegerField()\n\n        class ItemSerializer(serializers.Serializer):\n            text = serializers.CharField()\n            nested = NestedSerializer()\n\n        class View(generics.GenericAPIView):\n            serializer_class = ItemSerializer\n\n        view = create_view(\n            View,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        responses = inspector.get_responses(path, method)\n        assert responses['201']['content']['application/json']['schema']['$ref'] == '#/components/schemas/Item'\n        components = inspector.get_components(path, method)\n        assert components['Item']\n\n        schema = components['Item']\n        assert sorted(schema['required']) == ['nested', 'text']\n        assert sorted(list(schema['properties'].keys())) == ['nested', 'text']\n        assert schema['properties']['nested']['type'] == 'object'\n        assert list(schema['properties']['nested']['properties'].keys()) == ['number']\n        assert schema['properties']['nested']['required'] == ['number']\n\n    def test_response_body_partial_serializer(self):\n        path = '/'\n        method = 'GET'\n\n        class ItemSerializer(serializers.Serializer):\n            text = serializers.CharField()\n\n            def __init__(self, *args, **kwargs):\n                super().__init__(*args, **kwargs)\n                self.partial = True\n\n        class View(generics.GenericAPIView):\n            serializer_class = ItemSerializer\n\n        view = create_view(\n            View,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        responses = inspector.get_responses(path, method)\n        assert responses == {\n            '200': {\n                'description': '',\n                'content': {\n                    'application/json': {\n                        'schema': {\n                            'type': 'array',\n                            'items': {\n                                '$ref': '#/components/schemas/Item'\n                            },\n                        },\n                    },\n                },\n            },\n        }\n        components = inspector.get_components(path, method)\n        assert components == {\n            'Item': {\n                'type': 'object',\n                'properties': {\n                    'text': {\n                        'type': 'string',\n                    },\n                },\n            }\n        }\n\n    def test_list_response_body_generation(self):\n        \"\"\"Test that an array schema is returned for list views.\"\"\"\n        path = '/'\n        method = 'GET'\n\n        class ItemSerializer(serializers.Serializer):\n            text = serializers.CharField()\n\n        class View(generics.GenericAPIView):\n            serializer_class = ItemSerializer\n\n        view = create_view(\n            View,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        responses = inspector.get_responses(path, method)\n        assert responses == {\n            '200': {\n                'description': '',\n                'content': {\n                    'application/json': {\n                        'schema': {\n                            'type': 'array',\n                            'items': {\n                                '$ref': '#/components/schemas/Item'\n                            },\n                        },\n                    },\n                },\n            },\n        }\n        components = inspector.get_components(path, method)\n        assert components == {\n            'Item': {\n                'type': 'object',\n                'properties': {\n                    'text': {\n                        'type': 'string',\n                    },\n                },\n                'required': ['text'],\n            }\n        }\n\n    def test_paginated_list_response_body_generation(self):\n        \"\"\"Test that pagination properties are added for a paginated list view.\"\"\"\n        path = '/'\n        method = 'GET'\n\n        class Pagination(pagination.BasePagination):\n            def get_paginated_response_schema(self, schema):\n                return {\n                    'type': 'object',\n                    'item': schema,\n                }\n\n        class ItemSerializer(serializers.Serializer):\n            text = serializers.CharField()\n\n        class View(generics.GenericAPIView):\n            serializer_class = ItemSerializer\n            pagination_class = Pagination\n\n        view = create_view(\n            View,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        responses = inspector.get_responses(path, method)\n        assert responses == {\n            '200': {\n                'description': '',\n                'content': {\n                    'application/json': {\n                        'schema': {\n                            'type': 'object',\n                            'item': {\n                                'type': 'array',\n                                'items': {\n                                    '$ref': '#/components/schemas/Item'\n                                },\n                            },\n                        },\n                    },\n                },\n            },\n        }\n        components = inspector.get_components(path, method)\n        assert components == {\n            'Item': {\n                'type': 'object',\n                'properties': {\n                    'text': {\n                        'type': 'string',\n                    },\n                },\n                'required': ['text'],\n            }\n        }\n\n    def test_delete_response_body_generation(self):\n        \"\"\"Test that a view's delete method generates a proper response body schema.\"\"\"\n        path = '/{id}/'\n        method = 'DELETE'\n\n        class View(generics.DestroyAPIView):\n            serializer_class = views.ExampleSerializer\n\n        view = create_view(\n            View,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        responses = inspector.get_responses(path, method)\n        assert responses == {\n            '204': {\n                'description': '',\n            },\n        }\n\n    def test_parser_mapping(self):\n        \"\"\"Test that view's parsers are mapped to OA media types\"\"\"\n        path = '/{id}/'\n        method = 'POST'\n\n        class View(generics.CreateAPIView):\n            serializer_class = views.ExampleSerializer\n            parser_classes = [JSONParser, MultiPartParser]\n\n        view = create_view(\n            View,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        request_body = inspector.get_request_body(path, method)\n\n        assert len(request_body['content'].keys()) == 2\n        assert 'multipart/form-data' in request_body['content']\n        assert 'application/json' in request_body['content']\n\n    def test_renderer_mapping(self):\n        \"\"\"Test that view's renderers are mapped to OA media types\"\"\"\n        path = '/{id}/'\n        method = 'GET'\n\n        class CustomBrowsableAPIRenderer(BrowsableAPIRenderer):\n            media_type = 'image/jpeg'  # that's a wild API renderer\n\n        class TextRenderer(BaseRenderer):\n            media_type = 'text/plain'\n            format = 'text'\n\n        class View(generics.CreateAPIView):\n            serializer_class = views.ExampleSerializer\n            renderer_classes = [JSONRenderer, TextRenderer, BrowsableAPIRenderer, CustomBrowsableAPIRenderer]\n\n        view = create_view(\n            View,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        responses = inspector.get_responses(path, method)\n        # TODO this should be changed once the multiple response\n        # schema support is there\n        success_response = responses['200']\n\n        # Check that the API renderers aren't included, but custom renderers are\n        assert set(success_response['content']) == {'application/json', 'text/plain'}\n\n    def test_openapi_yaml_rendering_without_aliases(self):\n        renderer = OpenAPIRenderer()\n\n        reused_object = {'test': 'test'}\n        data = {\n            'o1': reused_object,\n            'o2': reused_object,\n        }\n        assert (\n            renderer.render(data) == b'o1:\\n  test: test\\no2:\\n  test: test\\n' or\n            renderer.render(data) == b'o2:\\n  test: test\\no1:\\n  test: test\\n'  # py <= 3.5\n        )\n\n    def test_openapi_yaml_safestring_render(self):\n        renderer = OpenAPIRenderer()\n        data = {'o1': SafeString('test')}\n        assert renderer.render(data) == b'o1: test\\n'\n\n    def test_serializer_filefield(self):\n        path = '/{id}/'\n        method = 'POST'\n\n        class ItemSerializer(serializers.Serializer):\n            attachment = serializers.FileField()\n\n        class View(generics.CreateAPIView):\n            serializer_class = ItemSerializer\n\n        view = create_view(\n            View,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        components = inspector.get_components(path, method)\n        component = components['Item']\n        properties = component['properties']\n        assert properties['attachment']['format'] == 'binary'\n\n    def test_retrieve_response_body_generation(self):\n        \"\"\"\n        Test that a list of properties is returned for retrieve item views.\n\n        Pagination properties should not be added as the view represents a single item.\n        \"\"\"\n        path = '/{id}/'\n        method = 'GET'\n\n        class Pagination(pagination.BasePagination):\n            def get_paginated_response_schema(self, schema):\n                return {\n                    'type': 'object',\n                    'item': schema,\n                }\n\n        class ItemSerializer(serializers.Serializer):\n            text = serializers.CharField()\n\n        class View(generics.GenericAPIView):\n            serializer_class = ItemSerializer\n            pagination_class = Pagination\n\n        view = create_view(\n            View,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        responses = inspector.get_responses(path, method)\n        assert responses == {\n            '200': {\n                'description': '',\n                'content': {\n                    'application/json': {\n                        'schema': {\n                            '$ref': '#/components/schemas/Item'\n                        },\n                    },\n                },\n            },\n        }\n\n        components = inspector.get_components(path, method)\n        assert components == {\n            'Item': {\n                'type': 'object',\n                'properties': {\n                    'text': {\n                        'type': 'string',\n                    },\n                },\n                'required': ['text'],\n            }\n        }\n\n    def test_operation_id_generation(self):\n        path = '/'\n        method = 'GET'\n\n        view = create_view(\n            views.ExampleGenericAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        operationId = inspector.get_operation_id(path, method)\n        assert operationId == 'listExamples'\n\n    def test_operation_id_custom_operation_id_base(self):\n        path = '/'\n        method = 'GET'\n\n        view = create_view(\n            views.ExampleGenericAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema(operation_id_base=\"Ulysse\")\n        inspector.view = view\n\n        operationId = inspector.get_operation_id(path, method)\n        assert operationId == 'listUlysses'\n\n    def test_operation_id_custom_name(self):\n        path = '/'\n        method = 'GET'\n\n        view = create_view(\n            views.ExampleGenericAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema(operation_id_base='Ulysse')\n        inspector.view = view\n\n        operationId = inspector.get_operation_id(path, method)\n        assert operationId == 'listUlysses'\n\n    def test_operation_id_plural(self):\n        path = '/'\n        method = 'GET'\n\n        view = create_view(\n            views.ExampleGenericAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema(operation_id_base='City')\n        inspector.view = view\n\n        operationId = inspector.get_operation_id(path, method)\n        assert operationId == 'listCities'\n\n    def test_operation_id_override_get(self):\n        class CustomSchema(AutoSchema):\n            def get_operation_id(self, path, method):\n                return 'myCustomOperationId'\n\n        path = '/'\n        method = 'GET'\n        view = create_view(\n            views.ExampleGenericAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = CustomSchema()\n        inspector.view = view\n\n        operationId = inspector.get_operation_id(path, method)\n        assert operationId == 'myCustomOperationId'\n\n    def test_operation_id_override_base(self):\n        class CustomSchema(AutoSchema):\n            def get_operation_id_base(self, path, method, action):\n                return 'Item'\n\n        path = '/'\n        method = 'GET'\n        view = create_view(\n            views.ExampleGenericAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = CustomSchema()\n        inspector.view = view\n\n        operationId = inspector.get_operation_id(path, method)\n        assert operationId == 'listItem'\n\n    def test_different_request_response_objects(self):\n        class RequestSerializer(serializers.Serializer):\n            text = serializers.CharField()\n\n        class ResponseSerializer(serializers.Serializer):\n            text = serializers.BooleanField()\n\n        class CustomSchema(AutoSchema):\n            def get_request_serializer(self, path, method):\n                return RequestSerializer()\n\n            def get_response_serializer(self, path, method):\n                return ResponseSerializer()\n\n        path = '/'\n        method = 'POST'\n        view = create_view(\n            views.ExampleGenericAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = CustomSchema()\n        inspector.view = view\n\n        components = inspector.get_components(path, method)\n        assert components == {\n            'Request': {\n                'properties': {\n                    'text': {\n                        'type': 'string'\n                    }\n                },\n                'required': ['text'],\n                'type': 'object'\n            },\n            'Response': {\n                'properties': {\n                    'text': {\n                        'type': 'boolean'\n                    }\n                },\n                'required': ['text'],\n                'type': 'object'\n            }\n        }\n\n        operation = inspector.get_operation(path, method)\n        assert operation == {\n            'operationId': 'createExample',\n            'description': '',\n            'parameters': [],\n            'requestBody': {\n                'content': {\n                    'application/json': {\n                        'schema': {\n                            '$ref': '#/components/schemas/Request'\n                        }\n                    },\n                    'application/x-www-form-urlencoded': {\n                        'schema': {\n                            '$ref': '#/components/schemas/Request'\n                        }\n                    },\n                    'multipart/form-data': {\n                        'schema': {\n                            '$ref': '#/components/schemas/Request'\n                        }\n                    }\n                }\n            },\n            'responses': {\n                '201': {\n                    'content': {\n                        'application/json': {\n                            'schema': {\n                                '$ref': '#/components/schemas/Response'\n                            }\n                        }\n                    },\n                    'description': ''\n                }\n            },\n            'tags': ['']\n        }\n\n    def test_repeat_operation_ids(self):\n        router = routers.SimpleRouter()\n        router.register('account', views.ExampleGenericViewSet, basename=\"account\")\n        urlpatterns = router.urls\n\n        generator = SchemaGenerator(patterns=urlpatterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n        schema_str = str(schema)\n        assert schema_str.count(\"operationId\") == 2\n        assert schema_str.count(\"newExample\") == 1\n        assert schema_str.count(\"oldExample\") == 1\n\n    def test_duplicate_operation_id(self):\n        patterns = [\n            path('duplicate1/', views.ExampleOperationIdDuplicate1.as_view()),\n            path('duplicate2/', views.ExampleOperationIdDuplicate2.as_view()),\n        ]\n\n        generator = SchemaGenerator(patterns=patterns)\n        request = create_request('/')\n\n        with warnings.catch_warnings(record=True) as w:\n            warnings.simplefilter('always')\n            generator.get_schema(request=request)\n\n            assert len(w) == 1\n            assert issubclass(w[-1].category, UserWarning)\n            assert 'You have a duplicated operationId' in str(w[-1].message)\n\n    def test_operation_id_viewset(self):\n        router = routers.SimpleRouter()\n        router.register('account', views.ExampleViewSet, basename=\"account\")\n        urlpatterns = router.urls\n\n        generator = SchemaGenerator(patterns=urlpatterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n        assert schema['paths']['/account/']['get']['operationId'] == 'listExampleViewSets'\n        assert schema['paths']['/account/']['post']['operationId'] == 'createExampleViewSet'\n        assert schema['paths']['/account/{id}/']['get']['operationId'] == 'retrieveExampleViewSet'\n        assert schema['paths']['/account/{id}/']['put']['operationId'] == 'updateExampleViewSet'\n        assert schema['paths']['/account/{id}/']['patch']['operationId'] == 'partialUpdateExampleViewSet'\n        assert schema['paths']['/account/{id}/']['delete']['operationId'] == 'destroyExampleViewSet'\n\n    def test_serializer_datefield(self):\n        path = '/'\n        method = 'GET'\n        view = create_view(\n            views.ExampleGenericAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        components = inspector.get_components(path, method)\n        component = components['Example']\n        properties = component['properties']\n        assert properties['date']['type'] == properties['datetime']['type'] == 'string'\n        assert properties['date']['format'] == 'date'\n        assert properties['datetime']['format'] == 'date-time'\n\n    def test_serializer_hstorefield(self):\n        path = '/'\n        method = 'GET'\n        view = create_view(\n            views.ExampleGenericAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        components = inspector.get_components(path, method)\n        component = components['Example']\n        properties = component['properties']\n        assert properties['hstore']['type'] == 'object'\n\n    def test_serializer_callable_default(self):\n        path = '/'\n        method = 'GET'\n        view = create_view(\n            views.ExampleGenericAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        components = inspector.get_components(path, method)\n        component = components['Example']\n        properties = component['properties']\n        assert 'default' not in properties['uuid_field']\n\n    def test_serializer_validators(self):\n        path = '/'\n        method = 'GET'\n        view = create_view(\n            views.ExampleValidatedAPIView,\n            method,\n            create_request(path),\n        )\n        inspector = AutoSchema()\n        inspector.view = view\n\n        components = inspector.get_components(path, method)\n        component = components['ExampleValidated']\n        properties = component['properties']\n\n        assert properties['integer']['type'] == 'integer'\n        assert properties['integer']['maximum'] == 99\n        assert properties['integer']['minimum'] == -11\n\n        assert properties['string']['minLength'] == 2\n        assert properties['string']['maxLength'] == 10\n\n        assert properties['lst']['minItems'] == 2\n        assert properties['lst']['maxItems'] == 10\n\n        assert properties['regex']['pattern'] == r'[ABC]12{3}'\n        assert properties['regex']['description'] == 'must have an A, B, or C followed by 1222'\n\n        assert properties['decimal1']['type'] == 'number'\n        assert properties['decimal1']['multipleOf'] == .01\n        assert properties['decimal1']['maximum'] == 10000\n        assert properties['decimal1']['minimum'] == -10000\n\n        assert properties['decimal2']['type'] == 'number'\n        assert properties['decimal2']['multipleOf'] == .0001\n\n        assert properties['decimal3'] == {\n            'type': 'string', 'format': 'decimal', 'maximum': 1000000, 'minimum': -1000000, 'multipleOf': 0.01\n        }\n        assert properties['decimal4'] == {\n            'type': 'string', 'format': 'decimal', 'maximum': 1000000, 'minimum': -1000000, 'multipleOf': 0.01\n        }\n        assert properties['decimal5'] == {\n            'type': 'string', 'format': 'decimal', 'maximum': 10000, 'minimum': -10000, 'multipleOf': 0.01\n        }\n\n        assert properties['email']['type'] == 'string'\n        assert properties['email']['format'] == 'email'\n        assert properties['email']['default'] == 'foo@bar.com'\n\n        assert properties['url']['type'] == 'string'\n        assert properties['url']['nullable'] is True\n        assert properties['url']['default'] == 'http://www.example.com'\n        assert '\\\\Z' not in properties['url']['pattern']\n\n        assert properties['uuid']['type'] == 'string'\n        assert properties['uuid']['format'] == 'uuid'\n\n        assert properties['ip4']['type'] == 'string'\n        assert properties['ip4']['format'] == 'ipv4'\n\n        assert properties['ip6']['type'] == 'string'\n        assert properties['ip6']['format'] == 'ipv6'\n\n        assert properties['ip']['type'] == 'string'\n        assert 'format' not in properties['ip']\n\n    def test_overridden_tags(self):\n        class ExampleStringTagsViewSet(views.ExampleGenericAPIView):\n            schema = AutoSchema(tags=['example1', 'example2'])\n\n        url_patterns = [\n            path('test/', ExampleStringTagsViewSet.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=url_patterns)\n        schema = generator.get_schema(request=create_request('/'))\n        assert schema['paths']['/test/']['get']['tags'] == ['example1', 'example2']\n\n    def test_overridden_get_tags_method(self):\n        class MySchema(AutoSchema):\n            def get_tags(self, path, method):\n                if path.endswith('/new/'):\n                    tags = ['tag1', 'tag2']\n                elif path.endswith('/old/'):\n                    tags = ['tag2', 'tag3']\n                else:\n                    tags = ['tag4', 'tag5']\n\n                return tags\n\n        class ExampleStringTagsViewSet(views.ExampleGenericViewSet):\n            schema = MySchema()\n\n        router = routers.SimpleRouter()\n        router.register('example', ExampleStringTagsViewSet, basename=\"example\")\n        generator = SchemaGenerator(patterns=router.urls)\n        schema = generator.get_schema(request=create_request('/'))\n        assert schema['paths']['/example/new/']['get']['tags'] == ['tag1', 'tag2']\n        assert schema['paths']['/example/old/']['get']['tags'] == ['tag2', 'tag3']\n\n    def test_auto_generated_apiview_tags(self):\n        class RestaurantAPIView(views.ExampleGenericAPIView):\n            schema = AutoSchema(operation_id_base=\"restaurant\")\n            pass\n\n        class BranchAPIView(views.ExampleGenericAPIView):\n            pass\n\n        url_patterns = [\n            path('any-dash_underscore/', RestaurantAPIView.as_view()),\n            path('restaurants/branches/', BranchAPIView.as_view())\n        ]\n        generator = SchemaGenerator(patterns=url_patterns)\n        schema = generator.get_schema(request=create_request('/'))\n        assert schema['paths']['/any-dash_underscore/']['get']['tags'] == ['any-dash-underscore']\n        assert schema['paths']['/restaurants/branches/']['get']['tags'] == ['restaurants']\n\n\n@pytest.mark.skipif(uritemplate is None, reason='uritemplate not installed.')\n@override_settings(REST_FRAMEWORK={'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.openapi.AutoSchema'})\nclass TestGenerator(TestCase):\n\n    def test_override_settings(self):\n        assert isinstance(views.ExampleListView.schema, AutoSchema)\n\n    def test_paths_construction(self):\n        \"\"\"Construction of the `paths` key.\"\"\"\n        patterns = [\n            path('example/', views.ExampleListView.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=patterns)\n        generator._initialise_endpoints()\n\n        paths = generator.get_schema()[\"paths\"]\n\n        assert '/example/' in paths\n        example_operations = paths['/example/']\n        assert len(example_operations) == 2\n        assert 'get' in example_operations\n        assert 'post' in example_operations\n\n    def test_prefixed_paths_construction(self):\n        \"\"\"Construction of the `paths` key maintains a common prefix.\"\"\"\n        patterns = [\n            path('v1/example/', views.ExampleListView.as_view()),\n            path('v1/example/{pk}/', views.ExampleDetailView.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=patterns)\n        generator._initialise_endpoints()\n\n        paths = generator.get_schema()[\"paths\"]\n\n        assert '/v1/example/' in paths\n        assert '/v1/example/{id}/' in paths\n\n    def test_mount_url_prefixed_to_paths(self):\n        patterns = [\n            path('example/', views.ExampleListView.as_view()),\n            path('example/{pk}/', views.ExampleDetailView.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=patterns, url='/api')\n        generator._initialise_endpoints()\n\n        paths = generator.get_schema()[\"paths\"]\n\n        assert '/api/example/' in paths\n        assert '/api/example/{id}/' in paths\n\n    def test_schema_construction(self):\n        \"\"\"Construction of the top level dictionary.\"\"\"\n        patterns = [\n            path('example/', views.ExampleListView.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=patterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n\n        assert 'openapi' in schema\n        assert 'paths' in schema\n\n    def test_schema_rendering_to_json(self):\n        patterns = [\n            path('example/', views.ExampleGenericAPIView.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=patterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n        ret = JSONOpenAPIRenderer().render(schema)\n\n        assert b'\"openapi\": \"' in ret\n        assert b'\"default\": \"0.0\"' in ret\n\n    def test_schema_rendering_to_yaml(self):\n        patterns = [\n            path('example/', views.ExampleGenericAPIView.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=patterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n        ret = OpenAPIRenderer().render(schema)\n        assert b\"openapi: \" in ret\n        assert b\"default: '0.0'\" in ret\n\n    def test_schema_rendering_timedelta_to_yaml_with_validator(self):\n\n        patterns = [\n            path('example/', views.ExampleValidatedAPIView.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=patterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n        ret = OpenAPIRenderer().render(schema)\n        assert b\"openapi: \" in ret\n        assert b\"duration:\\n          type: string\\n          minimum: \\'10.0\\'\\n\" in ret\n\n    def test_schema_with_no_paths(self):\n        patterns = []\n        generator = SchemaGenerator(patterns=patterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n\n        assert schema['paths'] == {}\n\n    def test_schema_information(self):\n        \"\"\"Construction of the top level dictionary.\"\"\"\n        patterns = [\n            path('example/', views.ExampleListView.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=patterns, title='My title', version='1.2.3', description='My description')\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n\n        assert schema['info']['title'] == 'My title'\n        assert schema['info']['version'] == '1.2.3'\n        assert schema['info']['description'] == 'My description'\n\n    def test_schema_information_empty(self):\n        \"\"\"Construction of the top level dictionary.\"\"\"\n        patterns = [\n            path('example/', views.ExampleListView.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=patterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n\n        assert schema['info']['title'] == ''\n        assert schema['info']['version'] == ''\n\n    def test_serializer_model(self):\n        \"\"\"Construction of the top level dictionary.\"\"\"\n        patterns = [\n            path('example/', views.ExampleGenericAPIViewModel.as_view()),\n        ]\n\n        generator = SchemaGenerator(patterns=patterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n\n        assert 'components' in schema\n        assert 'schemas' in schema['components']\n        assert 'ExampleModel' in schema['components']['schemas']\n\n    def test_authtoken_serializer(self):\n        patterns = [\n            path('api-token-auth/', obtain_auth_token)\n        ]\n        generator = SchemaGenerator(patterns=patterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n\n        route = schema['paths']['/api-token-auth/']['post']\n        body_schema = route['requestBody']['content']['application/json']['schema']\n\n        assert body_schema == {\n            '$ref': '#/components/schemas/AuthToken'\n        }\n        assert schema['components']['schemas']['AuthToken'] == {\n            'type': 'object',\n            'properties': {\n                'username': {'type': 'string', 'writeOnly': True},\n                'password': {'type': 'string', 'writeOnly': True},\n                'token': {'type': 'string', 'readOnly': True},\n            },\n            'required': ['username', 'password']\n        }\n\n    def test_component_name(self):\n        patterns = [\n            path('example/', views.ExampleAutoSchemaComponentName.as_view()),\n        ]\n\n        generator = SchemaGenerator(patterns=patterns)\n\n        request = create_request('/')\n        schema = generator.get_schema(request=request)\n\n        assert 'components' in schema\n        assert 'schemas' in schema['components']\n        assert 'Ulysses' in schema['components']['schemas']\n\n    def test_duplicate_component_name(self):\n        patterns = [\n            path('duplicate1/', views.ExampleAutoSchemaDuplicate1.as_view()),\n            path('duplicate2/', views.ExampleAutoSchemaDuplicate2.as_view()),\n        ]\n\n        generator = SchemaGenerator(patterns=patterns)\n        request = create_request('/')\n\n        with warnings.catch_warnings(record=True) as w:\n            warnings.simplefilter('always')\n            schema = generator.get_schema(request=request)\n\n            assert len(w) == 1\n            assert issubclass(w[-1].category, UserWarning)\n            assert 'has been overridden with a different value.' in str(w[-1].message)\n\n        assert 'components' in schema\n        assert 'schemas' in schema['components']\n        assert 'Duplicate' in schema['components']['schemas']\n\n    def test_component_should_not_be_generated_for_delete_method(self):\n        class ExampleView(generics.DestroyAPIView):\n            schema = AutoSchema(operation_id_base='example')\n\n        url_patterns = [\n            path('example/', ExampleView.as_view()),\n        ]\n        generator = SchemaGenerator(patterns=url_patterns)\n        schema = generator.get_schema(request=create_request('/'))\n        assert 'components' not in schema\n        assert 'content' not in schema['paths']['/example/']['delete']['responses']['204']\n"
  },
  {
    "path": "tests/schemas/views.py",
    "content": "import uuid\nfrom datetime import timedelta\n\nfrom django.core.validators import (\n    DecimalValidator, MaxLengthValidator, MaxValueValidator,\n    MinLengthValidator, MinValueValidator, RegexValidator\n)\nfrom django.db import models\n\nfrom rest_framework import generics, permissions, serializers\nfrom rest_framework.decorators import action\nfrom rest_framework.response import Response\nfrom rest_framework.schemas.openapi import AutoSchema\nfrom rest_framework.views import APIView\nfrom rest_framework.viewsets import GenericViewSet, ViewSet\n\n\nclass ExampleListView(APIView):\n    permission_classes = [permissions.IsAuthenticatedOrReadOnly]\n\n    def get(self, *args, **kwargs):\n        pass\n\n    def post(self, request, *args, **kwargs):\n        pass\n\n\nclass ExampleDetailView(APIView):\n    permission_classes = [permissions.IsAuthenticatedOrReadOnly]\n\n    def get(self, *args, **kwargs):\n        pass\n\n\nclass DocStringExampleListView(APIView):\n    \"\"\"\n    get: A description of my GET operation.\n    post: A description of my POST operation.\n    \"\"\"\n    permission_classes = [permissions.IsAuthenticatedOrReadOnly]\n\n    def get(self, *args, **kwargs):\n        pass\n\n    def post(self, request, *args, **kwargs):\n        pass\n\n\nclass DocStringExampleDetailView(APIView):\n    permission_classes = [permissions.IsAuthenticatedOrReadOnly]\n\n    def get(self, *args, **kwargs):\n        \"\"\"\n        A description of my GET operation.\n        \"\"\"\n        pass\n\n\n# Generics.\nclass ExampleSerializer(serializers.Serializer):\n    date = serializers.DateField()\n    datetime = serializers.DateTimeField()\n    duration = serializers.DurationField(default=timedelta())\n    hstore = serializers.HStoreField()\n    uuid_field = serializers.UUIDField(default=uuid.uuid4)\n\n\nclass ExampleGenericAPIView(generics.GenericAPIView):\n    serializer_class = ExampleSerializer\n\n    def get(self, *args, **kwargs):\n        from datetime import datetime\n        now = datetime.now()\n\n        serializer = self.get_serializer(data=now.date(), datetime=now)\n        return Response(serializer.data)\n\n\nclass ExampleGenericViewSet(GenericViewSet):\n    serializer_class = ExampleSerializer\n\n    def get(self, *args, **kwargs):\n        from datetime import datetime\n        now = datetime.now()\n\n        serializer = self.get_serializer(data=now.date(), datetime=now)\n        return Response(serializer.data)\n\n    @action(detail=False)\n    def new(self, *args, **kwargs):\n        pass\n\n    @action(detail=False)\n    def old(self, *args, **kwargs):\n        pass\n\n\n# Validators and/or equivalent Field attributes.\nclass ExampleValidatedSerializer(serializers.Serializer):\n    integer = serializers.IntegerField(\n        validators=(\n            MaxValueValidator(limit_value=99),\n            MinValueValidator(limit_value=-11),\n        )\n    )\n    string = serializers.CharField(\n        validators=(\n            MaxLengthValidator(limit_value=10),\n            MinLengthValidator(limit_value=2),\n        )\n    )\n    regex = serializers.CharField(\n        validators=(\n            RegexValidator(regex=r'[ABC]12{3}'),\n        ),\n        help_text='must have an A, B, or C followed by 1222'\n    )\n    lst = serializers.ListField(\n        validators=(\n            MaxLengthValidator(limit_value=10),\n            MinLengthValidator(limit_value=2),\n        )\n    )\n    decimal1 = serializers.DecimalField(max_digits=6, decimal_places=2, coerce_to_string=False)\n    decimal2 = serializers.DecimalField(max_digits=5, decimal_places=0, coerce_to_string=False,\n                                        validators=(DecimalValidator(max_digits=17, decimal_places=4),))\n    decimal3 = serializers.DecimalField(max_digits=8, decimal_places=2, coerce_to_string=True)\n    decimal4 = serializers.DecimalField(max_digits=8, decimal_places=2, coerce_to_string=True,\n                                        validators=(DecimalValidator(max_digits=17, decimal_places=4),))\n    decimal5 = serializers.DecimalField(max_digits=6, decimal_places=2)\n    email = serializers.EmailField(default='foo@bar.com')\n    url = serializers.URLField(default='http://www.example.com', allow_null=True)\n    uuid = serializers.UUIDField()\n    ip4 = serializers.IPAddressField(protocol='ipv4')\n    ip6 = serializers.IPAddressField(protocol='ipv6')\n    ip = serializers.IPAddressField()\n    duration = serializers.DurationField(\n        validators=(\n            MinValueValidator(timedelta(seconds=10)),\n        )\n    )\n\n\nclass ExampleValidatedAPIView(generics.GenericAPIView):\n    serializer_class = ExampleValidatedSerializer\n\n    def get(self, *args, **kwargs):\n        serializer = self.get_serializer(integer=33, string='hello', regex='foo', decimal1=3.55,\n                                         decimal2=5.33, email='a@b.co',\n                                         url='http://localhost', uuid=uuid.uuid4(), ip4='127.0.0.1', ip6='::1',\n                                         ip='192.168.1.1')\n        return Response(serializer.data)\n\n\n# Serializer with model.\nclass OpenAPIExample(models.Model):\n    first_name = models.CharField(max_length=30)\n\n\nclass ExampleSerializerModel(serializers.Serializer):\n    date = serializers.DateField()\n    datetime = serializers.DateTimeField()\n    hstore = serializers.HStoreField()\n    uuid_field = serializers.UUIDField(default=uuid.uuid4)\n\n    class Meta:\n        model = OpenAPIExample\n\n\nclass ExampleOperationIdDuplicate1(generics.GenericAPIView):\n    serializer_class = ExampleSerializerModel\n\n    def get(self, *args, **kwargs):\n        pass\n\n\nclass ExampleOperationIdDuplicate2(generics.GenericAPIView):\n    serializer_class = ExampleSerializerModel\n\n    def get(self, *args, **kwargs):\n        pass\n\n\nclass ExampleGenericAPIViewModel(generics.GenericAPIView):\n    serializer_class = ExampleSerializerModel\n\n    def get(self, *args, **kwargs):\n        from datetime import datetime\n        now = datetime.now()\n\n        serializer = self.get_serializer(data=now.date(), datetime=now)\n        return Response(serializer.data)\n\n\nclass ExampleAutoSchemaComponentName(generics.GenericAPIView):\n    serializer_class = ExampleSerializerModel\n    schema = AutoSchema(component_name=\"Ulysses\")\n\n    def get(self, *args, **kwargs):\n        from datetime import datetime\n        now = datetime.now()\n\n        serializer = self.get_serializer(data=now.date(), datetime=now)\n        return Response(serializer.data)\n\n\nclass ExampleAutoSchemaDuplicate1(generics.GenericAPIView):\n    serializer_class = ExampleValidatedSerializer\n    schema = AutoSchema(component_name=\"Duplicate\")\n\n    def get(self, *args, **kwargs):\n        from datetime import datetime\n        now = datetime.now()\n\n        serializer = self.get_serializer(data=now.date(), datetime=now)\n        return Response(serializer.data)\n\n\nclass ExampleAutoSchemaDuplicate2(generics.GenericAPIView):\n    serializer_class = ExampleSerializerModel\n    schema = AutoSchema(component_name=\"Duplicate\")\n\n    def get(self, *args, **kwargs):\n        from datetime import datetime\n        now = datetime.now()\n\n        serializer = self.get_serializer(data=now.date(), datetime=now)\n        return Response(serializer.data)\n\n\nclass ExampleViewSet(ViewSet):\n    serializer_class = ExampleSerializerModel\n\n    def list(self, request):\n        pass\n\n    def create(self, request):\n        pass\n\n    def retrieve(self, request, pk=None):\n        pass\n\n    def update(self, request, pk=None):\n        pass\n\n    def partial_update(self, request, pk=None):\n        pass\n\n    def destroy(self, request, pk=None):\n        pass\n"
  },
  {
    "path": "tests/test_atomic_requests.py",
    "content": "import unittest\n\nfrom django.db import connection, connections, transaction\nfrom django.http import Http404\nfrom django.test import TestCase, TransactionTestCase, override_settings\nfrom django.urls import path\n\nfrom rest_framework import status\nfrom rest_framework.exceptions import APIException\nfrom rest_framework.response import Response\nfrom rest_framework.test import APIRequestFactory\nfrom rest_framework.views import APIView\nfrom tests.models import BasicModel\n\nfactory = APIRequestFactory()\n\n\nclass BasicView(APIView):\n    def post(self, request, *args, **kwargs):\n        BasicModel.objects.create()\n        return Response({'method': 'GET'})\n\n\nclass ErrorView(APIView):\n    def post(self, request, *args, **kwargs):\n        BasicModel.objects.create()\n        raise Exception\n\n\nclass APIExceptionView(APIView):\n    def post(self, request, *args, **kwargs):\n        BasicModel.objects.create()\n        raise APIException\n\n\nclass NonAtomicAPIExceptionView(APIView):\n    @transaction.non_atomic_requests\n    def dispatch(self, *args, **kwargs):\n        return super().dispatch(*args, **kwargs)\n\n    def get(self, request, *args, **kwargs):\n        BasicModel.objects.all()\n        raise Http404\n\n\nurlpatterns = (\n    path('', NonAtomicAPIExceptionView.as_view()),\n)\n\n\n@unittest.skipUnless(\n    connection.features.uses_savepoints,\n    \"'atomic' requires transactions and savepoints.\"\n)\nclass DBTransactionTests(TestCase):\n    def setUp(self):\n        self.view = BasicView.as_view()\n        connections.databases['default']['ATOMIC_REQUESTS'] = True\n\n    def tearDown(self):\n        connections.databases['default']['ATOMIC_REQUESTS'] = False\n\n    def test_no_exception_commit_transaction(self):\n        request = factory.post('/')\n\n        with self.assertNumQueries(1):\n            response = self.view(request)\n        assert not transaction.get_rollback()\n        assert response.status_code == status.HTTP_200_OK\n        assert BasicModel.objects.count() == 1\n\n\n@unittest.skipUnless(\n    connection.features.uses_savepoints,\n    \"'atomic' requires transactions and savepoints.\"\n)\nclass DBTransactionErrorTests(TestCase):\n    def setUp(self):\n        self.view = ErrorView.as_view()\n        connections.databases['default']['ATOMIC_REQUESTS'] = True\n\n    def tearDown(self):\n        connections.databases['default']['ATOMIC_REQUESTS'] = False\n\n    def test_generic_exception_delegate_transaction_management(self):\n        \"\"\"\n        Transaction is eventually managed by outer-most transaction atomic\n        block. DRF do not try to interfere here.\n\n        We let django deal with the transaction when it will catch the Exception.\n        \"\"\"\n        request = factory.post('/')\n        with self.assertNumQueries(3):\n            # 1 - begin savepoint\n            # 2 - insert\n            # 3 - release savepoint\n            with transaction.atomic():\n                self.assertRaises(Exception, self.view, request)\n                assert not transaction.get_rollback()\n        assert BasicModel.objects.count() == 1\n\n\n@unittest.skipUnless(\n    connection.features.uses_savepoints,\n    \"'atomic' requires transactions and savepoints.\"\n)\nclass DBTransactionAPIExceptionTests(TestCase):\n    def setUp(self):\n        self.view = APIExceptionView.as_view()\n        connections.databases['default']['ATOMIC_REQUESTS'] = True\n\n    def tearDown(self):\n        connections.databases['default']['ATOMIC_REQUESTS'] = False\n\n    def test_api_exception_rollback_transaction(self):\n        \"\"\"\n        Transaction is rollbacked by our transaction atomic block.\n        \"\"\"\n        request = factory.post('/')\n        num_queries = 4 if connection.features.can_release_savepoints else 3\n        with self.assertNumQueries(num_queries):\n            # 1 - begin savepoint\n            # 2 - insert\n            # 3 - rollback savepoint\n            # 4 - release savepoint\n            with transaction.atomic():\n                response = self.view(request)\n                assert transaction.get_rollback()\n        assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR\n        assert BasicModel.objects.count() == 0\n\n\n@unittest.skipUnless(\n    connection.features.uses_savepoints,\n    \"'atomic' requires transactions and savepoints.\"\n)\nclass MultiDBTransactionAPIExceptionTests(TestCase):\n    databases = '__all__'\n\n    def setUp(self):\n        self.view = APIExceptionView.as_view()\n        connections.databases['default']['ATOMIC_REQUESTS'] = True\n        connections.databases['secondary']['ATOMIC_REQUESTS'] = True\n\n    def tearDown(self):\n        connections.databases['default']['ATOMIC_REQUESTS'] = False\n        connections.databases['secondary']['ATOMIC_REQUESTS'] = False\n\n    def test_api_exception_rollback_transaction(self):\n        \"\"\"\n        Transaction is rollbacked by our transaction atomic block.\n        \"\"\"\n        request = factory.post('/')\n        num_queries = 4 if connection.features.can_release_savepoints else 3\n        with self.assertNumQueries(num_queries):\n            # 1 - begin savepoint\n            # 2 - insert\n            # 3 - rollback savepoint\n            # 4 - release savepoint\n            with transaction.atomic(), transaction.atomic(using='secondary'):\n                response = self.view(request)\n                assert transaction.get_rollback()\n                assert transaction.get_rollback(using='secondary')\n        assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR\n        assert BasicModel.objects.count() == 0\n\n\n@unittest.skipUnless(\n    connection.features.uses_savepoints,\n    \"'atomic' requires transactions and savepoints.\"\n)\n@override_settings(ROOT_URLCONF='tests.test_atomic_requests')\nclass NonAtomicDBTransactionAPIExceptionTests(TransactionTestCase):\n    def setUp(self):\n        connections.databases['default']['ATOMIC_REQUESTS'] = True\n\n    def tearDown(self):\n        connections.databases['default']['ATOMIC_REQUESTS'] = False\n\n    def test_api_exception_rollback_transaction_non_atomic_view(self):\n        response = self.client.get('/')\n\n        # without checking connection.in_atomic_block view raises 500\n        # due attempt to rollback without transaction\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n"
  },
  {
    "path": "tests/test_authtoken.py",
    "content": "import importlib\nfrom io import StringIO\nfrom unittest.mock import patch\n\nimport pytest\nfrom django.contrib.admin import site\nfrom django.contrib.auth.models import User\nfrom django.core.management import CommandError, call_command\nfrom django.db import IntegrityError\nfrom django.test import TestCase, modify_settings\n\nfrom rest_framework.authtoken.admin import TokenAdmin\nfrom rest_framework.authtoken.management.commands.drf_create_token import \\\n    Command as AuthTokenCommand\nfrom rest_framework.authtoken.models import Token, TokenProxy\nfrom rest_framework.authtoken.serializers import AuthTokenSerializer\nfrom rest_framework.exceptions import ValidationError\n\n\nclass AuthTokenTests(TestCase):\n\n    def setUp(self):\n        self.site = site\n        self.user = User.objects.create_user(username='test_user')\n        self.token = Token.objects.create(key='test token', user=self.user)\n\n    def test_authtoken_can_be_imported_when_not_included_in_installed_apps(self):\n        import rest_framework.authtoken.models\n        with modify_settings(INSTALLED_APPS={'remove': 'rest_framework.authtoken'}):\n            importlib.reload(rest_framework.authtoken.models)\n        # Set the proxy and abstract properties back to the version,\n        # where authtoken is among INSTALLED_APPS.\n        importlib.reload(rest_framework.authtoken.models)\n\n    def test_model_admin_displayed_fields(self):\n        mock_request = object()\n        token_admin = TokenAdmin(self.token, self.site)\n        assert token_admin.get_fields(mock_request) == ('user',)\n\n    @patch('django.contrib.admin.site.register')  # avoid duplicate registrations\n    def test_model_admin__username_field(self, mock_register):\n        import rest_framework.authtoken.admin as authtoken_admin_m\n\n        class EmailUser(User):\n            USERNAME_FIELD = 'email'\n            username = None\n\n        for user_model in (User, EmailUser):\n            with (\n                self.subTest(user_model=user_model),\n                patch('django.contrib.auth.get_user_model', return_value=user_model) as get_user_model\n            ):\n                importlib.reload(authtoken_admin_m)  # reload after patching\n                assert get_user_model.call_count == 1\n\n                mock_request = object()\n                token_admin = authtoken_admin_m.TokenAdmin(TokenProxy, self.site)\n                assert token_admin.get_search_fields(mock_request) == (f'user__{user_model.USERNAME_FIELD}',)\n                assert token_admin.get_ordering(mock_request) == (f'user__{user_model.USERNAME_FIELD}',)\n\n        importlib.reload(authtoken_admin_m)  # restore after testing\n\n    def test_token_string_representation(self):\n        assert str(self.token) == 'test token'\n\n    def test_validate_raise_error_if_no_credentials_provided(self):\n        with pytest.raises(ValidationError):\n            AuthTokenSerializer().validate({})\n\n    def test_whitespace_in_password(self):\n        data = {'username': self.user.username, 'password': 'test pass '}\n        self.user.set_password(data['password'])\n        self.user.save()\n        assert AuthTokenSerializer(data=data).is_valid()\n\n    def test_token_creation_collision_raises_integrity_error(self):\n        user2 = User.objects.create_user('user2', 'user2@example.com', 'p')\n        existing_token = Token.objects.create(user=user2)\n\n        # Try to create another token with the same key\n        with self.assertRaises(IntegrityError):\n            Token.objects.create(key=existing_token.key, user=self.user)\n\n    def test_key_generated_on_save_when_cleared(self):\n        # Create a new user for this test to avoid conflicts with setUp token\n        user2 = User.objects.create_user('test_user2', 'test2@example.com', 'password')\n\n        # Create a token without a key - it should generate one automatically\n        token = Token(user=user2)\n        token.key = \"\"  # Explicitly clear the key\n        token.save()\n\n        # Verify the key was generated\n        self.assertEqual(len(token.key), 40)\n        self.assertEqual(token.user, user2)\n\n    def test_clearing_key_on_existing_token_raises_integrity_error(self):\n        \"\"\"Test that clearing the key on an existing token raises IntegrityError.\"\"\"\n        user = User.objects.create_user('test_user3', 'test3@example.com', 'password')\n        token = Token.objects.create(user=user)\n        token.key = \"\"\n\n        # This should raise IntegrityError because:\n        # 1. We're trying to update a record with an empty primary key\n        # 2. The OneToOneField constraint would be violated\n        with self.assertRaises(Exception):  # Could be IntegrityError or DatabaseError\n            token.save()\n\n    def test_saving_existing_token_without_changes_does_not_alter_key(self):\n        original_key = self.token.key\n\n        self.token.save()\n        self.assertEqual(self.token.key, original_key)\n\n\nclass AuthTokenCommandTests(TestCase):\n\n    def setUp(self):\n        self.site = site\n        self.user = User.objects.create_user(username='test_user')\n\n    def test_command_create_user_token(self):\n        token = AuthTokenCommand().create_user_token(self.user.username, False)\n        assert token is not None\n        token_saved = Token.objects.first()\n        assert token.key == token_saved.key\n\n    def test_command_create_user_token_invalid_user(self):\n        with pytest.raises(User.DoesNotExist):\n            AuthTokenCommand().create_user_token('not_existing_user', False)\n\n    def test_command_reset_user_token(self):\n        AuthTokenCommand().create_user_token(self.user.username, False)\n        first_token_key = Token.objects.first().key\n        AuthTokenCommand().create_user_token(self.user.username, True)\n        second_token_key = Token.objects.first().key\n\n        assert first_token_key != second_token_key\n\n    def test_command_do_not_reset_user_token(self):\n        AuthTokenCommand().create_user_token(self.user.username, False)\n        first_token_key = Token.objects.first().key\n        AuthTokenCommand().create_user_token(self.user.username, False)\n        second_token_key = Token.objects.first().key\n\n        assert first_token_key == second_token_key\n\n    def test_command_raising_error_for_invalid_user(self):\n        out = StringIO()\n        with pytest.raises(CommandError):\n            call_command('drf_create_token', 'not_existing_user', stdout=out)\n\n    def test_command_output(self):\n        out = StringIO()\n        call_command('drf_create_token', self.user.username, stdout=out)\n        token_saved = Token.objects.first()\n        self.assertIn('Generated token', out.getvalue())\n        self.assertIn(self.user.username, out.getvalue())\n        self.assertIn(token_saved.key, out.getvalue())\n"
  },
  {
    "path": "tests/test_bound_fields.py",
    "content": "from django.http import QueryDict\n\nfrom rest_framework import serializers\nfrom rest_framework.exceptions import ValidationError\n\n\nclass TestSimpleBoundField:\n    def test_empty_bound_field(self):\n        class ExampleSerializer(serializers.Serializer):\n            text = serializers.CharField(max_length=100)\n            amount = serializers.IntegerField()\n\n        serializer = ExampleSerializer()\n\n        assert serializer['text'].value == ''\n        assert serializer['text'].errors is None\n        assert serializer['text'].name == 'text'\n        assert serializer['amount'].value is None\n        assert serializer['amount'].errors is None\n        assert serializer['amount'].name == 'amount'\n\n    def test_populated_bound_field(self):\n        class ExampleSerializer(serializers.Serializer):\n            text = serializers.CharField(max_length=100)\n            amount = serializers.IntegerField()\n\n        serializer = ExampleSerializer(data={'text': 'abc', 'amount': 123})\n        assert serializer.is_valid()\n        assert serializer['text'].value == 'abc'\n        assert serializer['text'].errors is None\n        assert serializer['text'].name == 'text'\n        assert serializer['amount'].value == 123\n        assert serializer['amount'].errors is None\n        assert serializer['amount'].name == 'amount'\n\n    def test_error_bound_field(self):\n        class ExampleSerializer(serializers.Serializer):\n            text = serializers.CharField(max_length=100)\n            amount = serializers.IntegerField()\n\n        serializer = ExampleSerializer(data={'text': 'x' * 1000, 'amount': 123})\n        serializer.is_valid()\n\n        assert serializer['text'].value == 'x' * 1000\n        assert serializer['text'].errors == ['Ensure this field has no more than 100 characters.']\n        assert serializer['text'].name == 'text'\n        assert serializer['amount'].value == 123\n        assert serializer['amount'].errors is None\n        assert serializer['amount'].name == 'amount'\n\n    def test_delete_field(self):\n        class ExampleSerializer(serializers.Serializer):\n            text = serializers.CharField(max_length=100)\n            amount = serializers.IntegerField()\n\n        serializer = ExampleSerializer()\n        del serializer.fields['text']\n        assert 'text' not in serializer.fields\n\n    def test_as_form_fields(self):\n        class ExampleSerializer(serializers.Serializer):\n            bool_field = serializers.BooleanField()\n            null_field = serializers.IntegerField(allow_null=True)\n\n        serializer = ExampleSerializer(data={'bool_field': False, 'null_field': None})\n        assert serializer.is_valid()\n        assert serializer['bool_field'].as_form_field().value == ''\n        assert serializer['null_field'].as_form_field().value == ''\n\n    def test_rendering_boolean_field(self):\n        from rest_framework.renderers import HTMLFormRenderer\n\n        class ExampleSerializer(serializers.Serializer):\n            bool_field = serializers.BooleanField(\n                style={'base_template': 'checkbox.html', 'template_pack': 'rest_framework/vertical'})\n\n        serializer = ExampleSerializer(data={'bool_field': True})\n        assert serializer.is_valid()\n        renderer = HTMLFormRenderer()\n        rendered = renderer.render_field(serializer['bool_field'], {})\n        expected_packed = (\n            '<divclass=\"form-group\">'\n            '<divclass=\"checkbox\">'\n            '<label>'\n            '<inputtype=\"checkbox\"name=\"bool_field\"value=\"true\"checked>'\n            'Boolfield'\n            '</label>'\n            '</div>'\n            '</div>'\n        )\n        rendered_packed = ''.join(rendered.split())\n        assert rendered_packed == expected_packed\n\n\nclass CustomJSONField(serializers.JSONField):\n    pass\n\n\nclass TestNestedBoundField:\n    def test_nested_empty_bound_field(self):\n        class Nested(serializers.Serializer):\n            more_text = serializers.CharField(max_length=100)\n            amount = serializers.IntegerField()\n\n        class ExampleSerializer(serializers.Serializer):\n            text = serializers.CharField(max_length=100)\n            nested = Nested()\n\n        serializer = ExampleSerializer()\n\n        assert serializer['text'].value == ''\n        assert serializer['text'].errors is None\n        assert serializer['text'].name == 'text'\n        assert serializer['nested']['more_text'].value == ''\n        assert serializer['nested']['more_text'].errors is None\n        assert serializer['nested']['more_text'].name == 'nested.more_text'\n        assert serializer['nested']['amount'].value is None\n        assert serializer['nested']['amount'].errors is None\n        assert serializer['nested']['amount'].name == 'nested.amount'\n\n    def test_as_form_fields(self):\n        class Nested(serializers.Serializer):\n            bool_field = serializers.BooleanField()\n            null_field = serializers.IntegerField(allow_null=True)\n            json_field = serializers.JSONField()\n            custom_json_field = CustomJSONField()\n\n        class ExampleSerializer(serializers.Serializer):\n            nested = Nested()\n\n        serializer = ExampleSerializer(\n            data={'nested': {\n                'bool_field': False, 'null_field': None,\n                'json_field': {'bool_item': True, 'number': 1, 'text_item': 'text'},\n                'custom_json_field': {'bool_item': True, 'number': 1, 'text_item': 'text'},\n            }})\n        assert serializer.is_valid()\n        assert serializer['nested']['bool_field'].as_form_field().value == ''\n        assert serializer['nested']['null_field'].as_form_field().value == ''\n        assert serializer['nested']['json_field'].as_form_field().value == '''{\n    \"bool_item\": true,\n    \"number\": 1,\n    \"text_item\": \"text\"\n}'''\n        assert serializer['nested']['custom_json_field'].as_form_field().value == '''{\n    \"bool_item\": true,\n    \"number\": 1,\n    \"text_item\": \"text\"\n}'''\n\n    def test_rendering_nested_fields_with_none_value(self):\n        from rest_framework.renderers import HTMLFormRenderer\n\n        class Nested1(serializers.Serializer):\n            text_field = serializers.CharField()\n\n        class Nested2(serializers.Serializer):\n            nested1 = Nested1(allow_null=True)\n            text_field = serializers.CharField()\n\n        class ExampleSerializer(serializers.Serializer):\n            nested2 = Nested2()\n\n        serializer = ExampleSerializer(data={'nested2': {'nested1': None, 'text_field': 'test'}})\n        assert serializer.is_valid()\n        renderer = HTMLFormRenderer()\n        for field in serializer:\n            rendered = renderer.render_field(field, {})\n            expected_packed = (\n                '<fieldset>'\n                '<legend>Nested2</legend>'\n                '<fieldset>'\n                '<legend>Nested1</legend>'\n                '<divclass=\"form-group\">'\n                '<label>Textfield</label>'\n                '<inputname=\"nested2.nested1.text_field\"class=\"form-control\"type=\"text\"value=\"\">'\n                '</div>'\n                '</fieldset>'\n                '<divclass=\"form-group\">'\n                '<label>Textfield</label>'\n                '<inputname=\"nested2.text_field\"class=\"form-control\"type=\"text\"value=\"test\">'\n                '</div>'\n                '</fieldset>'\n            )\n            rendered_packed = ''.join(rendered.split())\n            assert rendered_packed == expected_packed\n\n    def test_rendering_nested_fields_with_not_mappable_value(self):\n        from rest_framework.renderers import HTMLFormRenderer\n\n        class Nested(serializers.Serializer):\n            text_field = serializers.CharField()\n\n        class ExampleSerializer(serializers.Serializer):\n            nested = Nested()\n\n        serializer = ExampleSerializer(data={'nested': 1})\n        assert not serializer.is_valid()\n        renderer = HTMLFormRenderer()\n        for field in serializer:\n            rendered = renderer.render_field(field, {})\n            expected_packed = (\n                '<fieldset>'\n                '<legend>Nested</legend>'\n                '<divclass=\"form-group\">'\n                '<label>Textfield</label>'\n                '<inputname=\"nested.text_field\"class=\"form-control\"type=\"text\"value=\"\">'\n                '</div>'\n                '</fieldset>'\n            )\n\n            rendered_packed = ''.join(rendered.split())\n            assert rendered_packed == expected_packed\n\n    def test_child_bound_field_after_parent_validation_error(self):\n        class ChildSerializer(serializers.Serializer):\n            value = serializers.CharField()\n\n        class ParentSerializer(serializers.Serializer):\n            nested = ChildSerializer()\n\n            def validate_nested(self, nested):\n                # Raise parent-level (non-field) validation error\n                raise ValidationError([\"parent-level nested error\"])\n\n        serializer = ParentSerializer(data={\"nested\": {\"value\": \"ignored\"}})\n        assert not serializer.is_valid()\n\n        # Parent-level error is a list (current problematic case)\n        assert serializer.errors[\"nested\"] == [\"parent-level nested error\"]\n        parent_bound = serializer[\"nested\"]\n        child_bound = parent_bound[\"value\"]\n        assert child_bound.errors is None\n        assert child_bound.value == \"ignored\"\n        assert child_bound.name == \"nested.value\"\n\n\nclass TestJSONBoundField:\n    def test_as_form_fields(self):\n        class TestSerializer(serializers.Serializer):\n            json_field = serializers.JSONField()\n\n        data = QueryDict(mutable=True)\n        data.update({'json_field': '{\"some\": [\"json\"}'})\n        serializer = TestSerializer(data=data)\n        assert serializer.is_valid() is False\n        assert serializer['json_field'].as_form_field().value == '{\"some\": [\"json\"}'\n"
  },
  {
    "path": "tests/test_decorators.py",
    "content": "import sys\n\nimport pytest\nfrom django.test import TestCase\n\nfrom rest_framework import status\nfrom rest_framework.authentication import BasicAuthentication\nfrom rest_framework.decorators import (\n    action, api_view, authentication_classes, content_negotiation_class,\n    metadata_class, parser_classes, permission_classes, renderer_classes,\n    schema, throttle_classes, versioning_class\n)\nfrom rest_framework.negotiation import BaseContentNegotiation\nfrom rest_framework.parsers import JSONParser\nfrom rest_framework.permissions import IsAuthenticated\nfrom rest_framework.renderers import JSONRenderer\nfrom rest_framework.response import Response\nfrom rest_framework.schemas import AutoSchema\nfrom rest_framework.test import APIRequestFactory\nfrom rest_framework.throttling import UserRateThrottle\nfrom rest_framework.versioning import QueryParameterVersioning\nfrom rest_framework.views import APIView\n\n\nclass DecoratorTestCase(TestCase):\n\n    def setUp(self):\n        self.factory = APIRequestFactory()\n\n    def test_api_view_incorrect(self):\n        \"\"\"\n        If @api_view is not applied correct, we should raise an assertion.\n        \"\"\"\n\n        @api_view\n        def view(request):\n            return Response()\n\n        request = self.factory.get('/')\n        self.assertRaises(AssertionError, view, request)\n\n    def test_api_view_incorrect_arguments(self):\n        \"\"\"\n        If @api_view is missing arguments, we should raise an assertion.\n        \"\"\"\n\n        with self.assertRaises(AssertionError):\n            @api_view('GET')\n            def view(request):\n                return Response()\n\n    def test_calling_method(self):\n\n        @api_view(['GET'])\n        def view(request):\n            return Response({})\n\n        request = self.factory.get('/')\n        response = view(request)\n        assert response.status_code == status.HTTP_200_OK\n\n        request = self.factory.post('/')\n        response = view(request)\n        assert response.status_code == status.HTTP_405_METHOD_NOT_ALLOWED\n\n    def test_calling_put_method(self):\n\n        @api_view(['GET', 'PUT'])\n        def view(request):\n            return Response({})\n\n        request = self.factory.put('/')\n        response = view(request)\n        assert response.status_code == status.HTTP_200_OK\n\n        request = self.factory.post('/')\n        response = view(request)\n        assert response.status_code == status.HTTP_405_METHOD_NOT_ALLOWED\n\n    def test_calling_patch_method(self):\n\n        @api_view(['GET', 'PATCH'])\n        def view(request):\n            return Response({})\n\n        request = self.factory.patch('/')\n        response = view(request)\n        assert response.status_code == status.HTTP_200_OK\n\n        request = self.factory.post('/')\n        response = view(request)\n        assert response.status_code == status.HTTP_405_METHOD_NOT_ALLOWED\n\n    def test_renderer_classes(self):\n\n        @api_view(['GET'])\n        @renderer_classes([JSONRenderer])\n        def view(request):\n            return Response({})\n\n        request = self.factory.get('/')\n        response = view(request)\n        assert isinstance(response.accepted_renderer, JSONRenderer)\n\n    def test_parser_classes(self):\n\n        @api_view(['GET'])\n        @parser_classes([JSONParser])\n        def view(request):\n            assert len(request.parsers) == 1\n            assert isinstance(request.parsers[0], JSONParser)\n            return Response({})\n\n        request = self.factory.get('/')\n        view(request)\n\n    def test_authentication_classes(self):\n\n        @api_view(['GET'])\n        @authentication_classes([BasicAuthentication])\n        def view(request):\n            assert len(request.authenticators) == 1\n            assert isinstance(request.authenticators[0], BasicAuthentication)\n            return Response({})\n\n        request = self.factory.get('/')\n        view(request)\n\n    def test_permission_classes(self):\n\n        @api_view(['GET'])\n        @permission_classes([IsAuthenticated])\n        def view(request):\n            return Response({})\n\n        request = self.factory.get('/')\n        response = view(request)\n        assert response.status_code == status.HTTP_403_FORBIDDEN\n\n    def test_throttle_classes(self):\n        class OncePerDayUserThrottle(UserRateThrottle):\n            rate = '1/day'\n\n        @api_view(['GET'])\n        @throttle_classes([OncePerDayUserThrottle])\n        def view(request):\n            return Response({})\n\n        request = self.factory.get('/')\n        response = view(request)\n        assert response.status_code == status.HTTP_200_OK\n\n        response = view(request)\n        assert response.status_code == status.HTTP_429_TOO_MANY_REQUESTS\n\n    def test_versioning_class(self):\n        @api_view([\"GET\"])\n        @versioning_class(QueryParameterVersioning)\n        def view(request):\n            return Response({\"version\": request.version})\n\n        request = self.factory.get(\"/?version=1.2.3\")\n        response = view(request)\n        assert response.data == {\"version\": \"1.2.3\"}\n\n    def test_metadata_class(self):\n        # From TestMetadata.test_none_metadata()\n        @api_view()\n        @metadata_class(None)\n        def view(request):\n            return Response({})\n\n        request = self.factory.options('/')\n        response = view(request)\n        assert response.status_code == status.HTTP_405_METHOD_NOT_ALLOWED\n        assert response.data == {'detail': 'Method \"OPTIONS\" not allowed.'}\n\n    def test_content_negotiation(self):\n        class CustomContentNegotiation(BaseContentNegotiation):\n            def select_renderer(self, request, renderers, format_suffix):\n                assert request.META['HTTP_ACCEPT'] == 'custom/type'\n                return (renderers[0], renderers[0].media_type)\n\n        @api_view([\"GET\"])\n        @content_negotiation_class(CustomContentNegotiation)\n        def view(request):\n            return Response({})\n\n        request = self.factory.get('/', HTTP_ACCEPT='custom/type')\n        response = view(request)\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_schema(self):\n        \"\"\"\n        Checks CustomSchema class is set on view\n        \"\"\"\n        class CustomSchema(AutoSchema):\n            pass\n\n        @api_view(['GET'])\n        @schema(CustomSchema())\n        def view(request):\n            return Response({})\n\n        assert isinstance(view.cls.schema, CustomSchema)\n\n    def test_incorrect_decorator_order_permission_classes(self):\n        \"\"\"\n        If @permission_classes is applied after @api_view, we should raise a TypeError.\n        \"\"\"\n        with self.assertRaises(TypeError) as cm:\n            @permission_classes([IsAuthenticated])\n            @api_view(['GET'])\n            def view(request):\n                return Response({})\n\n        assert '@permission_classes must come after (below) the @api_view decorator' in str(cm.exception)\n\n    def test_incorrect_decorator_order_renderer_classes(self):\n        \"\"\"\n        If @renderer_classes is applied after @api_view, we should raise a TypeError.\n        \"\"\"\n        with self.assertRaises(TypeError) as cm:\n            @renderer_classes([JSONRenderer])\n            @api_view(['GET'])\n            def view(request):\n                return Response({})\n\n        assert '@renderer_classes must come after (below) the @api_view decorator' in str(cm.exception)\n\n    def test_incorrect_decorator_order_parser_classes(self):\n        \"\"\"\n        If @parser_classes is applied after @api_view, we should raise a TypeError.\n        \"\"\"\n        with self.assertRaises(TypeError) as cm:\n            @parser_classes([JSONParser])\n            @api_view(['GET'])\n            def view(request):\n                return Response({})\n\n        assert '@parser_classes must come after (below) the @api_view decorator' in str(cm.exception)\n\n    def test_incorrect_decorator_order_authentication_classes(self):\n        \"\"\"\n        If @authentication_classes is applied after @api_view, we should raise a TypeError.\n        \"\"\"\n        with self.assertRaises(TypeError) as cm:\n            @authentication_classes([BasicAuthentication])\n            @api_view(['GET'])\n            def view(request):\n                return Response({})\n\n        assert '@authentication_classes must come after (below) the @api_view decorator' in str(cm.exception)\n\n    def test_incorrect_decorator_order_throttle_classes(self):\n        \"\"\"\n        If @throttle_classes is applied after @api_view, we should raise a TypeError.\n        \"\"\"\n        class OncePerDayUserThrottle(UserRateThrottle):\n            rate = '1/day'\n\n        with self.assertRaises(TypeError) as cm:\n            @throttle_classes([OncePerDayUserThrottle])\n            @api_view(['GET'])\n            def view(request):\n                return Response({})\n\n        assert '@throttle_classes must come after (below) the @api_view decorator' in str(cm.exception)\n\n    def test_incorrect_decorator_order_versioning_class(self):\n        \"\"\"\n        If @versioning_class is applied after @api_view, we should raise a TypeError.\n        \"\"\"\n        with self.assertRaises(TypeError) as cm:\n            @versioning_class(QueryParameterVersioning)\n            @api_view(['GET'])\n            def view(request):\n                return Response({})\n\n        assert '@versioning_class must come after (below) the @api_view decorator' in str(cm.exception)\n\n    def test_incorrect_decorator_order_metadata_class(self):\n        \"\"\"\n        If @metadata_class is applied after @api_view, we should raise a TypeError.\n        \"\"\"\n        with self.assertRaises(TypeError) as cm:\n            @metadata_class(None)\n            @api_view(['GET'])\n            def view(request):\n                return Response({})\n\n        assert '@metadata_class must come after (below) the @api_view decorator' in str(cm.exception)\n\n    def test_incorrect_decorator_order_content_negotiation_class(self):\n        \"\"\"\n        If @content_negotiation_class is applied after @api_view, we should raise a TypeError.\n        \"\"\"\n        class CustomContentNegotiation(BaseContentNegotiation):\n            def select_renderer(self, request, renderers, format_suffix):\n                return (renderers[0], renderers[0].media_type)\n\n        with self.assertRaises(TypeError) as cm:\n            @content_negotiation_class(CustomContentNegotiation)\n            @api_view(['GET'])\n            def view(request):\n                return Response({})\n\n        assert '@content_negotiation_class must come after (below) the @api_view decorator' in str(cm.exception)\n\n    def test_incorrect_decorator_order_schema(self):\n        \"\"\"\n        If @schema is applied after @api_view, we should raise a TypeError.\n        \"\"\"\n        class CustomSchema(AutoSchema):\n            pass\n\n        with self.assertRaises(TypeError) as cm:\n            @schema(CustomSchema())\n            @api_view(['GET'])\n            def view(request):\n                return Response({})\n\n        assert '@schema must come after (below) the @api_view decorator' in str(cm.exception)\n\n\nclass ActionDecoratorTestCase(TestCase):\n\n    def test_defaults(self):\n        @action(detail=True)\n        def test_action(request):\n            \"\"\"Description\"\"\"\n\n        assert test_action.mapping == {'get': 'test_action'}\n        assert test_action.detail is True\n        assert test_action.url_path == 'test_action'\n        assert test_action.url_name == 'test-action'\n        assert test_action.kwargs == {\n            'name': 'Test action',\n            'description': 'Description',\n        }\n\n    def test_detail_required(self):\n        with pytest.raises(AssertionError) as excinfo:\n            @action()\n            def test_action(request):\n                raise NotImplementedError\n\n        assert str(excinfo.value) == \"@action() missing required argument: 'detail'\"\n\n    @pytest.mark.skipif(sys.version_info < (3, 11), reason=\"HTTPMethod was added in Python 3.11\")\n    def test_method_mapping_http_method(self):\n        from http import HTTPMethod\n\n        method_names = [getattr(HTTPMethod, name.upper()) for name in APIView.http_method_names]\n\n        @action(detail=False, methods=method_names)\n        def test_action():\n            raise NotImplementedError\n\n        expected_mapping = {name: test_action.__name__ for name in APIView.http_method_names}\n\n        assert test_action.mapping == expected_mapping\n\n    def test_method_mapping_http_methods(self):\n        # All HTTP methods should be mappable\n        @action(detail=False, methods=[])\n        def test_action():\n            raise NotImplementedError\n\n        for name in APIView.http_method_names:\n            def method():\n                raise NotImplementedError\n\n            method.__name__ = name\n            getattr(test_action.mapping, name)(method)\n\n        # ensure the mapping returns the correct method name\n        for name in APIView.http_method_names:\n            assert test_action.mapping[name] == name\n\n    def test_view_name_kwargs(self):\n        \"\"\"\n        'name' and 'suffix' are mutually exclusive kwargs used for generating\n        a view's display name.\n        \"\"\"\n        # by default, generate name from method\n        @action(detail=True)\n        def test_action(request):\n            raise NotImplementedError\n\n        assert test_action.kwargs == {\n            'description': None,\n            'name': 'Test action',\n        }\n\n        # name kwarg supersedes name generation\n        @action(detail=True, name='test name')\n        def test_action(request):\n            raise NotImplementedError\n\n        assert test_action.kwargs == {\n            'description': None,\n            'name': 'test name',\n        }\n\n        # suffix kwarg supersedes name generation\n        @action(detail=True, suffix='Suffix')\n        def test_action(request):\n            raise NotImplementedError\n\n        assert test_action.kwargs == {\n            'description': None,\n            'suffix': 'Suffix',\n        }\n\n        # name + suffix is a conflict.\n        with pytest.raises(TypeError) as excinfo:\n            action(detail=True, name='test name', suffix='Suffix')\n\n        assert str(excinfo.value) == \"`name` and `suffix` are mutually exclusive arguments.\"\n\n    def test_method_mapping(self):\n        @action(detail=False)\n        def test_action(request):\n            raise NotImplementedError\n\n        @test_action.mapping.post\n        def test_action_post(request):\n            raise NotImplementedError\n\n        # The secondary handler methods should not have the action attributes\n        for name in ['mapping', 'detail', 'url_path', 'url_name', 'kwargs']:\n            assert hasattr(test_action, name) and not hasattr(test_action_post, name)\n\n    def test_method_mapping_already_mapped(self):\n        @action(detail=True)\n        def test_action(request):\n            raise NotImplementedError\n\n        msg = \"Method 'get' has already been mapped to '.test_action'.\"\n        with self.assertRaisesMessage(AssertionError, msg):\n            @test_action.mapping.get\n            def test_action_get(request):\n                raise NotImplementedError\n\n    def test_method_mapping_overwrite(self):\n        @action(detail=True)\n        def test_action():\n            raise NotImplementedError\n\n        msg = (\"Method mapping does not behave like the property decorator. You \"\n               \"cannot use the same method name for each mapping declaration.\")\n        with self.assertRaisesMessage(AssertionError, msg):\n            @test_action.mapping.post\n            def test_action():\n                raise NotImplementedError\n"
  },
  {
    "path": "tests/test_description.py",
    "content": "import pytest\nfrom django.test import TestCase\n\nfrom rest_framework.compat import apply_markdown\nfrom rest_framework.utils.formatting import dedent\nfrom rest_framework.views import APIView\n\n# We check that docstrings get nicely un-indented.\nDESCRIPTION = \"\"\"an example docstring\n====================\n\n* list\n* list\n\nanother header\n--------------\n\n    code block\n\nindented\n\n# hash style header #\n\n```json\n[{\n    \"alpha\": 1,\n    \"beta\": \"this is a string\"\n}]\n```\"\"\"\n\n\n# If markdown is installed we also test it's working\n# (and that our wrapped forces '=' to h2 and '-' to h3)\nMARKDOWN_DOCSTRING = \"\"\"<h2 id=\"an-example-docstring\">an example docstring</h2>\n<ul>\n<li>list</li>\n<li>list</li>\n</ul>\n<h3 id=\"another-header\">another header</h3>\n<pre><code>code block\n</code></pre>\n<p>indented</p>\n<h2 id=\"hash-style-header\">hash style header</h2>\n<div class=\"highlight\"><pre><span></span><span class=\"p\">[{</span><br /><span class=\"w\">    </span><span class=\"nt\">&quot;alpha&quot;</span><span class=\"p\">:</span><span class=\"w\"> </span><span class=\"mi\">1</span><span class=\"p\">,</span><br /><span class=\"w\">    </span><span class=\"nt\">&quot;beta&quot;</span><span class=\"p\">:</span><span class=\"w\"> </span><span class=\"s2\">&quot;this is a string&quot;</span><br /><span class=\"p\">}]</span><br /></pre></div>\n<p><br /></p>\"\"\"\n\n\nclass TestViewNamesAndDescriptions(TestCase):\n    def test_view_name_uses_class_name(self):\n        \"\"\"\n        Ensure view names are based on the class name.\n        \"\"\"\n        class MockView(APIView):\n            pass\n        assert MockView().get_view_name() == 'Mock'\n\n    def test_view_name_uses_name_attribute(self):\n        class MockView(APIView):\n            name = 'Foo'\n        assert MockView().get_view_name() == 'Foo'\n\n    def test_view_name_uses_suffix_attribute(self):\n        class MockView(APIView):\n            suffix = 'List'\n        assert MockView().get_view_name() == 'Mock List'\n\n    def test_view_name_preferences_name_over_suffix(self):\n        class MockView(APIView):\n            name = 'Foo'\n            suffix = 'List'\n        assert MockView().get_view_name() == 'Foo'\n\n    def test_view_description_uses_docstring(self):\n        \"\"\"Ensure view descriptions are based on the docstring.\"\"\"\n        class MockView(APIView):\n            \"\"\"an example docstring\n            ====================\n\n            * list\n            * list\n\n            another header\n            --------------\n\n                code block\n\n            indented\n\n            # hash style header #\n\n            ```json\n            [{\n                \"alpha\": 1,\n                \"beta\": \"this is a string\"\n            }]\n            ```\"\"\"\n\n        assert MockView().get_view_description() == DESCRIPTION\n\n    def test_view_description_uses_description_attribute(self):\n        class MockView(APIView):\n            description = 'Foo'\n        assert MockView().get_view_description() == 'Foo'\n\n    def test_view_description_allows_empty_description(self):\n        class MockView(APIView):\n            \"\"\"Description.\"\"\"\n            description = ''\n        assert MockView().get_view_description() == ''\n\n    def test_view_description_can_be_empty(self):\n        \"\"\"\n        Ensure that if a view has no docstring,\n        then it's description is the empty string.\n        \"\"\"\n        class MockView(APIView):\n            pass\n        assert MockView().get_view_description() == ''\n\n    def test_view_description_can_be_promise(self):\n        \"\"\"\n        Ensure a view may have a docstring that is actually a lazily evaluated\n        class that can be converted to a string.\n\n        See: https://github.com/encode/django-rest-framework/issues/1708\n        \"\"\"\n        # use a mock object instead of gettext_lazy to ensure that we can't end\n        # up with a test case string in our l10n catalog\n\n        class MockLazyStr:\n            def __init__(self, string):\n                self.s = string\n\n            def __str__(self):\n                return self.s\n\n        class MockView(APIView):\n            __doc__ = MockLazyStr(\"a gettext string\")\n\n        assert MockView().get_view_description() == 'a gettext string'\n\n    @pytest.mark.skipif(not apply_markdown, reason=\"Markdown is not installed\")\n    def test_markdown(self):\n        \"\"\"\n        Ensure markdown to HTML works as expected.\n        \"\"\"\n        assert apply_markdown(DESCRIPTION) == MARKDOWN_DOCSTRING\n\n\ndef test_dedent_tabs():\n    result = 'first string\\n\\nsecond string'\n    assert dedent(\"    first string\\n\\n    second string\") == result\n    assert dedent(\"first string\\n\\n    second string\") == result\n    assert dedent(\"\\tfirst string\\n\\n\\tsecond string\") == result\n    assert dedent(\"first string\\n\\n\\tsecond string\") == result\n"
  },
  {
    "path": "tests/test_encoders.py",
    "content": "import ipaddress\nfrom datetime import date, datetime, timedelta, timezone\nfrom decimal import Decimal\nfrom uuid import uuid4\n\nimport pytest\nfrom django.test import TestCase\n\nfrom rest_framework.utils.encoders import JSONEncoder\nfrom rest_framework.utils.serializer_helpers import ReturnList\n\nutc = timezone.utc\n\n\nclass MockList:\n    def tolist(self):\n        return [1, 2, 3]\n\n\nclass JSONEncoderTests(TestCase):\n    \"\"\"\n    Tests the JSONEncoder method\n    \"\"\"\n\n    def setUp(self):\n        self.encoder = JSONEncoder()\n\n    def test_encode_decimal(self):\n        \"\"\"\n        Tests encoding a decimal\n        \"\"\"\n        d = Decimal(3.14)\n        assert self.encoder.default(d) == float(d)\n\n    def test_encode_datetime(self):\n        \"\"\"\n        Tests encoding a datetime object\n        \"\"\"\n        current_time = datetime.now()\n        assert self.encoder.default(current_time) == current_time.isoformat()\n        current_time_utc = current_time.replace(tzinfo=utc)\n        assert self.encoder.default(current_time_utc) == current_time.isoformat() + 'Z'\n\n    def test_encode_time(self):\n        \"\"\"\n        Tests encoding a timezone\n        \"\"\"\n        current_time = datetime.now().time()\n        assert self.encoder.default(current_time) == current_time.isoformat()\n\n    def test_encode_time_tz(self):\n        \"\"\"\n        Tests encoding a timezone aware timestamp\n        \"\"\"\n        current_time = datetime.now().time()\n        current_time = current_time.replace(tzinfo=utc)\n        with pytest.raises(ValueError):\n            self.encoder.default(current_time)\n\n    def test_encode_date(self):\n        \"\"\"\n        Tests encoding a date object\n        \"\"\"\n        current_date = date.today()\n        assert self.encoder.default(current_date) == current_date.isoformat()\n\n    def test_encode_timedelta(self):\n        \"\"\"\n        Tests encoding a timedelta object\n        \"\"\"\n        delta = timedelta(hours=1)\n        assert self.encoder.default(delta) == str(delta.total_seconds())\n\n    def test_encode_uuid(self):\n        \"\"\"\n        Tests encoding a UUID object\n        \"\"\"\n        unique_id = uuid4()\n        assert self.encoder.default(unique_id) == str(unique_id)\n\n    def test_encode_ipaddress_ipv4address(self):\n        \"\"\"\n        Tests encoding ipaddress IPv4Address object\n        \"\"\"\n        obj = ipaddress.IPv4Address(\"192.168.1.1\")\n        assert self.encoder.default(obj) == \"192.168.1.1\"\n\n    def test_encode_ipaddress_ipv6address(self):\n        \"\"\"\n        Tests encoding ipaddress IPv6Address object\n        \"\"\"\n        obj = ipaddress.IPv6Address(\"2001:0db8:85a3:0000:0000:8a2e:0370:7334\")\n        assert self.encoder.default(obj) == \"2001:db8:85a3::8a2e:370:7334\"\n\n    def test_encode_ipaddress_ipv4network(self):\n        \"\"\"\n        Tests encoding ipaddress IPv4Network object\n        \"\"\"\n        obj = ipaddress.IPv4Network(\"192.0.2.8/29\")\n        assert self.encoder.default(obj) == \"192.0.2.8/29\"\n\n    def test_encode_ipaddress_ipv6network(self):\n        \"\"\"\n        Tests encoding ipaddress IPv4Network object\n        \"\"\"\n        obj = ipaddress.IPv6Network(\"2001:4860:0000::0000/32\")\n        assert self.encoder.default(obj) == \"2001:4860::/32\"\n\n    def test_encode_ipaddress_ipv4interface(self):\n        \"\"\"\n        Tests encoding ipaddress IPv4Interface object\n        \"\"\"\n        obj = ipaddress.IPv4Interface(\"192.0.2.8/29\")\n        assert self.encoder.default(obj) == \"192.0.2.8/29\"\n\n    def test_encode_ipaddress_ipv6interface(self):\n        \"\"\"\n        Tests encoding ipaddress IPv4Network object\n        \"\"\"\n        obj = ipaddress.IPv6Interface(\"2001:4860:4860::8888/32\")\n        assert self.encoder.default(obj) == \"2001:4860:4860::8888/32\"\n\n    def test_encode_object_with_tolist(self):\n        \"\"\"\n        Tests encoding a object with tolist method\n        \"\"\"\n        foo = MockList()\n        assert self.encoder.default(foo) == [1, 2, 3]\n\n    def test_encode_empty_returnlist(self):\n        \"\"\"\n        Tests encoding an empty ReturnList\n        \"\"\"\n        foo = ReturnList(serializer=None)\n        assert self.encoder.default(foo) == []\n"
  },
  {
    "path": "tests/test_exceptions.py",
    "content": "from django.test import RequestFactory, TestCase\nfrom django.utils import translation\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework.exceptions import (\n    APIException, ErrorDetail, Throttled, _get_error_details, bad_request,\n    server_error\n)\n\n\nclass ExceptionTestCase(TestCase):\n\n    def test_get_error_details(self):\n\n        example = \"string\"\n        lazy_example = _(example)\n\n        assert _get_error_details(lazy_example) == example\n\n        assert isinstance(\n            _get_error_details(lazy_example),\n            ErrorDetail\n        )\n\n        assert _get_error_details({'nested': lazy_example})['nested'] == example\n\n        assert isinstance(\n            _get_error_details({'nested': lazy_example})['nested'],\n            ErrorDetail\n        )\n\n        assert _get_error_details([[lazy_example]])[0][0] == example\n\n        assert isinstance(\n            _get_error_details([[lazy_example]])[0][0],\n            ErrorDetail\n        )\n\n    def test_get_full_details_with_throttling(self):\n        exception = Throttled()\n        assert exception.get_full_details() == {\n            'message': 'Request was throttled.', 'code': 'throttled'}\n\n        exception = Throttled(wait=2)\n        assert exception.get_full_details() == {\n            'message': f'Request was throttled. Expected available in {2} seconds.',\n            'code': 'throttled'}\n\n        exception = Throttled(wait=2, detail='Slow down!')\n        assert exception.get_full_details() == {\n            'message': f'Slow down! Expected available in {2} seconds.',\n            'code': 'throttled'}\n\n\nclass ErrorDetailTests(TestCase):\n\n    def test_eq(self):\n        assert ErrorDetail('msg') == ErrorDetail('msg')\n        assert ErrorDetail('msg', 'code') == ErrorDetail('msg', code='code')\n\n        assert ErrorDetail('msg') == 'msg'\n        assert ErrorDetail('msg', 'code') == 'msg'\n\n    def test_ne(self):\n        assert ErrorDetail('msg1') != ErrorDetail('msg2')\n        assert ErrorDetail('msg') != ErrorDetail('msg', code='invalid')\n\n        assert ErrorDetail('msg1') != 'msg2'\n        assert ErrorDetail('msg1', 'code') != 'msg2'\n\n    def test_repr(self):\n        assert repr(ErrorDetail('msg1')) == \\\n            'ErrorDetail(string={!r}, code=None)'.format('msg1')\n        assert repr(ErrorDetail('msg1', 'code')) == \\\n            'ErrorDetail(string={!r}, code={!r})'.format('msg1', 'code')\n\n    def test_str(self):\n        assert str(ErrorDetail('msg1')) == 'msg1'\n        assert str(ErrorDetail('msg1', 'code')) == 'msg1'\n\n    def test_hash(self):\n        assert hash(ErrorDetail('msg')) == hash('msg')\n        assert hash(ErrorDetail('msg', 'code')) == hash('msg')\n\n\nclass TranslationTests(TestCase):\n\n    @translation.override('fr')\n    def test_message(self):\n        # this test largely acts as a sanity test to ensure the translation files are present.\n        self.assertEqual(_('A server error occurred.'), 'Une erreur du serveur est survenue.')\n        self.assertEqual(str(APIException()), 'Une erreur du serveur est survenue.')\n\n\ndef test_server_error():\n    request = RequestFactory().get('/')\n    response = server_error(request)\n    assert response.status_code == 500\n    assert response[\"content-type\"] == 'application/json'\n\n\ndef test_bad_request():\n    request = RequestFactory().get('/')\n    exception = Exception('Something went wrong — Not used')\n    response = bad_request(request, exception)\n    assert response.status_code == 400\n    assert response[\"content-type\"] == 'application/json'\n"
  },
  {
    "path": "tests/test_fields.py",
    "content": "import datetime\nimport math\nimport os\nimport re\nimport uuid\nimport warnings\nfrom decimal import ROUND_DOWN, ROUND_UP, Decimal\nfrom enum import auto\nfrom unittest.mock import patch\nfrom zoneinfo import ZoneInfo\n\nimport django\nimport pytest\nimport pytz\nfrom django.core.exceptions import ValidationError as DjangoValidationError\nfrom django.db.models import IntegerChoices, TextChoices\nfrom django.http import QueryDict\nfrom django.test import TestCase, override_settings\nfrom django.utils.timezone import activate, deactivate, override\n\nimport rest_framework\nfrom rest_framework import exceptions, serializers\nfrom rest_framework.fields import (\n    BuiltinSignatureError, DjangoImageField, SkipField, empty,\n    is_simple_callable\n)\nfrom rest_framework.utils import json\nfrom tests.models import UUIDForeignKeyTarget\n\nutc = datetime.timezone.utc\n\n# Tests for helper functions.\n# ---------------------------\n\n\nclass TestIsSimpleCallable:\n\n    def test_method(self):\n        class Foo:\n            @classmethod\n            def classmethod(cls):\n                pass\n\n            def valid(self):\n                pass\n\n            def valid_kwargs(self, param='value'):\n                pass\n\n            def valid_vargs_kwargs(self, *args, **kwargs):\n                pass\n\n            def invalid(self, param):\n                pass\n\n        assert is_simple_callable(Foo.classmethod)\n\n        # unbound methods\n        assert not is_simple_callable(Foo.valid)\n        assert not is_simple_callable(Foo.valid_kwargs)\n        assert not is_simple_callable(Foo.valid_vargs_kwargs)\n        assert not is_simple_callable(Foo.invalid)\n\n        # bound methods\n        assert is_simple_callable(Foo().valid)\n        assert is_simple_callable(Foo().valid_kwargs)\n        assert is_simple_callable(Foo().valid_vargs_kwargs)\n        assert not is_simple_callable(Foo().invalid)\n\n    def test_function(self):\n        def simple():\n            pass\n\n        def valid(param='value', param2='value'):\n            pass\n\n        def valid_vargs_kwargs(*args, **kwargs):\n            pass\n\n        def invalid(param, param2='value'):\n            pass\n\n        assert is_simple_callable(simple)\n        assert is_simple_callable(valid)\n        assert is_simple_callable(valid_vargs_kwargs)\n        assert not is_simple_callable(invalid)\n\n    @pytest.mark.parametrize('obj', (True, None, \"str\", b'bytes', 123, 1.23))\n    def test_not_callable(self, obj):\n        assert not is_simple_callable(obj)\n\n    def test_4602_regression(self):\n        from django.db import models\n\n        class ChoiceModel(models.Model):\n            choice_field = models.CharField(\n                max_length=1, default='a',\n                choices=(('a', 'A'), ('b', 'B')),\n            )\n\n            class Meta:\n                app_label = 'tests'\n\n        assert is_simple_callable(ChoiceModel().get_choice_field_display)\n\n    def test_builtin_function(self):\n        # Built-in function signatures are not easily inspectable, so the\n        # current expectation is to just raise a helpful error message.\n        timestamp = datetime.datetime.now()\n\n        with pytest.raises(BuiltinSignatureError) as exc_info:\n            is_simple_callable(timestamp.date)\n\n        assert str(exc_info.value) == (\n            'Built-in function signatures are not inspectable. Wrap the '\n            'function call in a simple, pure Python function.')\n\n    def test_type_annotation(self):\n        # The annotation will otherwise raise a syntax error in python < 3.5\n        locals = {}\n        exec(\"def valid(param: str='value'):  pass\", locals)\n        valid = locals['valid']\n\n        assert is_simple_callable(valid)\n\n\n# Tests for field keyword arguments and core functionality.\n# ---------------------------------------------------------\n\nclass TestEmpty:\n    \"\"\"\n    Tests for `required`, `allow_null`, `allow_blank`, `default`.\n    \"\"\"\n    def test_required(self):\n        \"\"\"\n        By default a field must be included in the input.\n        \"\"\"\n        field = serializers.IntegerField()\n        with pytest.raises(serializers.ValidationError) as exc_info:\n            field.run_validation()\n        assert exc_info.value.detail == ['This field is required.']\n\n    def test_not_required(self):\n        \"\"\"\n        If `required=False` then a field may be omitted from the input.\n        \"\"\"\n        field = serializers.IntegerField(required=False)\n        with pytest.raises(serializers.SkipField):\n            field.run_validation()\n\n    def test_disallow_null(self):\n        \"\"\"\n        By default `None` is not a valid input.\n        \"\"\"\n        field = serializers.IntegerField()\n        with pytest.raises(serializers.ValidationError) as exc_info:\n            field.run_validation(None)\n        assert exc_info.value.detail == ['This field may not be null.']\n\n    def test_allow_null(self):\n        \"\"\"\n        If `allow_null=True` then `None` is a valid input.\n        \"\"\"\n        field = serializers.IntegerField(allow_null=True)\n        output = field.run_validation(None)\n        assert output is None\n\n    def test_disallow_blank(self):\n        \"\"\"\n        By default '' is not a valid input.\n        \"\"\"\n        field = serializers.CharField()\n        with pytest.raises(serializers.ValidationError) as exc_info:\n            field.run_validation('')\n        assert exc_info.value.detail == ['This field may not be blank.']\n\n    def test_allow_blank(self):\n        \"\"\"\n        If `allow_blank=True` then '' is a valid input.\n        \"\"\"\n        field = serializers.CharField(allow_blank=True)\n        output = field.run_validation('')\n        assert output == ''\n\n    def test_default(self):\n        \"\"\"\n        If `default` is set, then omitted values get the default input.\n        \"\"\"\n        field = serializers.IntegerField(default=123)\n        output = field.run_validation()\n        assert output == 123\n\n\nclass TestSource:\n    def test_source(self):\n        class ExampleSerializer(serializers.Serializer):\n            example_field = serializers.CharField(source='other')\n        serializer = ExampleSerializer(data={'example_field': 'abc'})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'other': 'abc'}\n\n    def test_redundant_source(self):\n        class ExampleSerializer(serializers.Serializer):\n            example_field = serializers.CharField(source='example_field')\n        with pytest.raises(AssertionError) as exc_info:\n            ExampleSerializer().fields\n        assert str(exc_info.value) == (\n            \"It is redundant to specify `source='example_field'` on field \"\n            \"'CharField' in serializer 'ExampleSerializer', because it is the \"\n            \"same as the field name. Remove the `source` keyword argument.\"\n        )\n\n    def test_callable_source(self):\n        class ExampleSerializer(serializers.Serializer):\n            example_field = serializers.CharField(source='example_callable')\n\n        class ExampleInstance:\n            def example_callable(self):\n                return 'example callable value'\n\n        serializer = ExampleSerializer(ExampleInstance())\n        assert serializer.data['example_field'] == 'example callable value'\n\n    def test_callable_source_raises(self):\n        class ExampleSerializer(serializers.Serializer):\n            example_field = serializers.CharField(source='example_callable', read_only=True)\n\n        class ExampleInstance:\n            def example_callable(self):\n                raise AttributeError('method call failed')\n\n        with pytest.raises(ValueError) as exc_info:\n            serializer = ExampleSerializer(ExampleInstance())\n            serializer.data.items()\n\n        assert 'method call failed' in str(exc_info.value)\n\n    def test_builtin_callable_source_raises(self):\n        class BuiltinSerializer(serializers.Serializer):\n            date = serializers.ReadOnlyField(source='timestamp.date')\n\n        with pytest.raises(BuiltinSignatureError) as exc_info:\n            BuiltinSerializer({'timestamp': datetime.datetime.now()}).data\n\n        assert str(exc_info.value) == (\n            'Field source for `BuiltinSerializer.date` maps to a built-in '\n            'function type and is invalid. Define a property or method on '\n            'the `dict` instance that wraps the call to the built-in function.')\n\n\nclass TestReadOnly:\n    def setup_method(self):\n        class TestSerializer(serializers.Serializer):\n            read_only = serializers.ReadOnlyField(default=\"789\")\n            writable = serializers.IntegerField()\n        self.Serializer = TestSerializer\n\n    def test_writable_fields(self):\n        \"\"\"\n        Read-only fields should not be writable, even with default ()\n        \"\"\"\n        serializer = self.Serializer()\n        assert len(list(serializer._writable_fields)) == 1\n\n    def test_validate_read_only(self):\n        \"\"\"\n        Read-only serializers.should not be included in validation.\n        \"\"\"\n        data = {'read_only': 123, 'writable': 456}\n        serializer = self.Serializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'writable': 456}\n\n    def test_serialize_read_only(self):\n        \"\"\"\n        Read-only serializers.should be serialized.\n        \"\"\"\n        instance = {'read_only': 123, 'writable': 456}\n        serializer = self.Serializer(instance)\n        assert serializer.data == {'read_only': 123, 'writable': 456}\n\n\nclass TestWriteOnly:\n    def setup_method(self):\n        class TestSerializer(serializers.Serializer):\n            write_only = serializers.IntegerField(write_only=True)\n            readable = serializers.IntegerField()\n        self.Serializer = TestSerializer\n\n    def test_validate_write_only(self):\n        \"\"\"\n        Write-only serializers.should be included in validation.\n        \"\"\"\n        data = {'write_only': 123, 'readable': 456}\n        serializer = self.Serializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'write_only': 123, 'readable': 456}\n\n    def test_serialize_write_only(self):\n        \"\"\"\n        Write-only serializers.should not be serialized.\n        \"\"\"\n        instance = {'write_only': 123, 'readable': 456}\n        serializer = self.Serializer(instance)\n        assert serializer.data == {'readable': 456}\n\n\nclass TestInitial:\n    def setup_method(self):\n        class TestSerializer(serializers.Serializer):\n            initial_field = serializers.IntegerField(initial=123)\n            blank_field = serializers.IntegerField()\n        self.serializer = TestSerializer()\n\n    def test_initial(self):\n        \"\"\"\n        Initial values should be included when serializing a new representation.\n        \"\"\"\n        assert self.serializer.data == {\n            'initial_field': 123,\n            'blank_field': None\n        }\n\n\nclass TestInitialWithCallable:\n    def setup_method(self):\n        def initial_value():\n            return 123\n\n        class TestSerializer(serializers.Serializer):\n            initial_field = serializers.IntegerField(initial=initial_value)\n        self.serializer = TestSerializer()\n\n    def test_initial_should_accept_callable(self):\n        \"\"\"\n        Follows the default ``Field.initial`` behavior where they accept a\n        callable to produce the initial value\"\"\"\n        assert self.serializer.data == {\n            'initial_field': 123,\n        }\n\n\nclass TestLabel:\n    def setup_method(self):\n        class TestSerializer(serializers.Serializer):\n            labeled = serializers.IntegerField(label='My label')\n        self.serializer = TestSerializer()\n\n    def test_label(self):\n        \"\"\"\n        A field's label may be set with the `label` argument.\n        \"\"\"\n        fields = self.serializer.fields\n        assert fields['labeled'].label == 'My label'\n\n\nclass TestInvalidErrorKey:\n    def setup_method(self):\n        class ExampleField(serializers.Field):\n            def to_native(self, data):\n                self.fail('incorrect')\n        self.field = ExampleField()\n\n    def test_invalid_error_key(self):\n        \"\"\"\n        If a field raises a validation error, but does not have a corresponding\n        error message, then raise an appropriate assertion error.\n        \"\"\"\n        with pytest.raises(AssertionError) as exc_info:\n            self.field.to_native(123)\n        expected = (\n            'ValidationError raised by `ExampleField`, but error key '\n            '`incorrect` does not exist in the `error_messages` dictionary.'\n        )\n        assert str(exc_info.value) == expected\n\n\nclass TestBooleanHTMLInput:\n    def test_empty_html_checkbox(self):\n        \"\"\"\n        HTML checkboxes do not send any value, but should be treated\n        as `False` by BooleanField if allow_null=False.\n        \"\"\"\n        class TestSerializer(serializers.Serializer):\n            archived = serializers.BooleanField()\n\n        serializer = TestSerializer(data=QueryDict(''))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'archived': False}\n\n    def test_empty_html_checkbox_not_required(self):\n        \"\"\"\n        HTML checkboxes do not send any value, but should be treated\n        as `False` by BooleanField when the field is required=False\n        and allow_null=False.\n        \"\"\"\n        class TestSerializer(serializers.Serializer):\n            archived = serializers.BooleanField(required=False)\n\n        serializer = TestSerializer(data=QueryDict(''))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'archived': False}\n\n    def test_empty_html_checkbox_allow_null(self):\n        \"\"\"\n        HTML checkboxes do not send any value and should be treated\n        as `None` by BooleanField if allow_null is True.\n        \"\"\"\n        class TestSerializer(serializers.Serializer):\n            archived = serializers.BooleanField(allow_null=True)\n\n        serializer = TestSerializer(data=QueryDict(''))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'archived': None}\n\n    def test_empty_html_checkbox_allow_null_with_default(self):\n        \"\"\"\n        BooleanField should respect default if set and still allow\n        setting null values.\n        \"\"\"\n        class TestSerializer(serializers.Serializer):\n            archived = serializers.BooleanField(allow_null=True, default=True)\n\n        serializer = TestSerializer(data=QueryDict(''))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'archived': True}\n\n        serializer = TestSerializer(data=QueryDict('archived='))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'archived': None}\n\n\nclass TestHTMLInput:\n    def test_empty_html_charfield_with_default(self):\n        class TestSerializer(serializers.Serializer):\n            message = serializers.CharField(default='happy')\n\n        serializer = TestSerializer(data=QueryDict(''))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'message': 'happy'}\n\n    def test_empty_html_charfield_without_default(self):\n        class TestSerializer(serializers.Serializer):\n            message = serializers.CharField(allow_blank=True)\n\n        serializer = TestSerializer(data=QueryDict('message='))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'message': ''}\n\n    def test_empty_html_charfield_without_default_not_required(self):\n        class TestSerializer(serializers.Serializer):\n            message = serializers.CharField(allow_blank=True, required=False)\n\n        serializer = TestSerializer(data=QueryDict('message='))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'message': ''}\n\n    def test_empty_html_integerfield(self):\n        class TestSerializer(serializers.Serializer):\n            message = serializers.IntegerField(default=123)\n\n        serializer = TestSerializer(data=QueryDict('message='))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'message': 123}\n\n    def test_empty_html_uuidfield_with_default(self):\n        class TestSerializer(serializers.Serializer):\n            message = serializers.UUIDField(default=uuid.uuid4)\n\n        serializer = TestSerializer(data=QueryDict('message='))\n        assert serializer.is_valid()\n        assert list(serializer.validated_data) == ['message']\n\n    def test_empty_html_uuidfield_with_optional(self):\n        class TestSerializer(serializers.Serializer):\n            message = serializers.UUIDField(required=False)\n\n        serializer = TestSerializer(data=QueryDict('message='))\n        assert serializer.is_valid()\n        assert list(serializer.validated_data) == []\n\n    def test_empty_html_charfield_allow_null(self):\n        class TestSerializer(serializers.Serializer):\n            message = serializers.CharField(allow_null=True)\n\n        serializer = TestSerializer(data=QueryDict('message='))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'message': None}\n\n    def test_empty_html_datefield_allow_null(self):\n        class TestSerializer(serializers.Serializer):\n            expiry = serializers.DateField(allow_null=True)\n\n        serializer = TestSerializer(data=QueryDict('expiry='))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'expiry': None}\n\n    def test_empty_html_charfield_allow_null_allow_blank(self):\n        class TestSerializer(serializers.Serializer):\n            message = serializers.CharField(allow_null=True, allow_blank=True)\n\n        serializer = TestSerializer(data=QueryDict('message='))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'message': ''}\n\n    def test_empty_html_charfield_required_false(self):\n        class TestSerializer(serializers.Serializer):\n            message = serializers.CharField(required=False)\n\n        serializer = TestSerializer(data=QueryDict(''))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {}\n\n    def test_querydict_list_input(self):\n        class TestSerializer(serializers.Serializer):\n            scores = serializers.ListField(child=serializers.IntegerField())\n\n        serializer = TestSerializer(data=QueryDict('scores=1&scores=3'))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'scores': [1, 3]}\n\n    def test_querydict_list_input_only_one_input(self):\n        class TestSerializer(serializers.Serializer):\n            scores = serializers.ListField(child=serializers.IntegerField())\n\n        serializer = TestSerializer(data=QueryDict('scores=1&'))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'scores': [1]}\n\n    def test_querydict_list_input_no_values_uses_default(self):\n        \"\"\"\n        When there are no values passed in, and default is set\n        The field should return the default value\n        \"\"\"\n        class TestSerializer(serializers.Serializer):\n            a = serializers.IntegerField(required=True)\n            scores = serializers.ListField(default=lambda: [1, 3])\n\n        serializer = TestSerializer(data=QueryDict('a=1&'))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'a': 1, 'scores': [1, 3]}\n\n    def test_querydict_list_input_supports_indexed_keys(self):\n        \"\"\"\n        When data is passed in the format `scores[0]=1&scores[1]=3`\n        The field should return the correct list, ignoring the default\n        \"\"\"\n        class TestSerializer(serializers.Serializer):\n            scores = serializers.ListField(default=lambda: [1, 3])\n\n        serializer = TestSerializer(data=QueryDict(\"scores[0]=5&scores[1]=6\"))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'scores': ['5', '6']}\n\n    def test_querydict_list_input_no_values_no_default_and_not_required(self):\n        \"\"\"\n        When there are no keys passed, there is no default, and required=False\n        The field should be skipped\n        \"\"\"\n        class TestSerializer(serializers.Serializer):\n            scores = serializers.ListField(required=False)\n\n        serializer = TestSerializer(data=QueryDict(''))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {}\n\n    def test_querydict_list_input_posts_key_but_no_values(self):\n        \"\"\"\n        When there are no keys passed, there is no default, and required=False\n        The field should return an array of 1 item, blank\n        \"\"\"\n        class TestSerializer(serializers.Serializer):\n            scores = serializers.ListField(required=False)\n\n        serializer = TestSerializer(data=QueryDict('scores=&'))\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'scores': ['']}\n\n\nclass TestCreateOnlyDefault:\n    def setup_method(self):\n        default = serializers.CreateOnlyDefault('2001-01-01')\n\n        class TestSerializer(serializers.Serializer):\n            published = serializers.HiddenField(default=default)\n            text = serializers.CharField()\n        self.Serializer = TestSerializer\n\n    def test_create_only_default_is_provided(self):\n        serializer = self.Serializer(data={'text': 'example'})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'text': 'example', 'published': '2001-01-01'\n        }\n\n    def test_create_only_default_is_not_provided_on_update(self):\n        instance = {\n            'text': 'example', 'published': '2001-01-01'\n        }\n        serializer = self.Serializer(instance, data={'text': 'example'})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'text': 'example',\n        }\n\n    def test_create_only_default_callable_sets_context(self):\n        \"\"\"\n        CreateOnlyDefault instances with a callable default should set context\n        on the callable if possible\n        \"\"\"\n        class TestCallableDefault:\n            requires_context = True\n\n            def __call__(self, field=None):\n                return \"success\" if field is not None else \"failure\"\n\n        class TestSerializer(serializers.Serializer):\n            context_set = serializers.CharField(default=serializers.CreateOnlyDefault(TestCallableDefault()))\n\n        serializer = TestSerializer(data={})\n        assert serializer.is_valid()\n        assert serializer.validated_data['context_set'] == 'success'\n\n\nclass Test5087Regression:\n    def test_parent_binding(self):\n        parent = serializers.Serializer()\n        field = serializers.CharField()\n\n        assert field.root is field\n        field.bind('name', parent)\n        assert field.root is parent\n\n\nclass TestTyping(TestCase):\n    def test_field_is_subscriptable(self):\n        assert serializers.Field is serializers.Field[\"foo\"]\n\n\n# Tests for field input and output values.\n# ----------------------------------------\n\ndef get_items(mapping_or_list_of_two_tuples):\n    # Tests accept either lists of two tuples, or dictionaries.\n    if isinstance(mapping_or_list_of_two_tuples, dict):\n        # {value: expected}\n        return mapping_or_list_of_two_tuples.items()\n    # [(value, expected), ...]\n    return mapping_or_list_of_two_tuples\n\n\nclass FieldValues:\n    \"\"\"\n    Base class for testing valid and invalid input values.\n    \"\"\"\n    def test_valid_inputs(self, *args):\n        \"\"\"\n        Ensure that valid values return the expected validated data.\n        \"\"\"\n        for input_value, expected_output in get_items(self.valid_inputs):\n            assert self.field.run_validation(input_value) == expected_output, \\\n                f'input value: {repr(input_value)}'\n\n    def test_invalid_inputs(self, *args):\n        \"\"\"\n        Ensure that invalid values raise the expected validation error.\n        \"\"\"\n        for input_value, expected_failure in get_items(self.invalid_inputs):\n            with pytest.raises(serializers.ValidationError) as exc_info:\n                self.field.run_validation(input_value)\n            assert exc_info.value.detail == expected_failure, \\\n                f'input value: {repr(input_value)}'\n\n    def test_outputs(self, *args):\n        for output_value, expected_output in get_items(self.outputs):\n            assert self.field.to_representation(output_value) == expected_output, \\\n                f'output value: {repr(output_value)}'\n\n\n# Boolean types...\n\nclass TestBooleanField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `BooleanField`.\n    \"\"\"\n    valid_inputs = {\n        'True': True,\n        'TRUE': True,\n        'tRuE': True,\n        't': True,\n        'T': True,\n        'true': True,\n        'on': True,\n        'ON': True,\n        'oN': True,\n        'False': False,\n        'FALSE': False,\n        'fALse': False,\n        'f': False,\n        'F': False,\n        'false': False,\n        'off': False,\n        'OFF': False,\n        'oFf': False,\n        '1': True,\n        '0': False,\n        1: True,\n        0: False,\n        True: True,\n        False: False,\n    }\n    invalid_inputs = {\n        'foo': ['Must be a valid boolean.'],\n        None: ['This field may not be null.']\n    }\n    outputs = {\n        'True': True,\n        'TRUE': True,\n        'tRuE': True,\n        't': True,\n        'T': True,\n        'true': True,\n        'on': True,\n        'ON': True,\n        'oN': True,\n        'False': False,\n        'FALSE': False,\n        'fALse': False,\n        'f': False,\n        'F': False,\n        'false': False,\n        'off': False,\n        'OFF': False,\n        'oFf': False,\n        '1': True,\n        '0': False,\n        1: True,\n        0: False,\n        True: True,\n        False: False,\n        'other': True\n    }\n    field = serializers.BooleanField()\n\n    def test_disallow_unhashable_collection_types(self):\n        inputs = (\n            [],\n            {},\n        )\n        field = self.field\n        for input_value in inputs:\n            with pytest.raises(serializers.ValidationError) as exc_info:\n                field.run_validation(input_value)\n            expected = ['Must be a valid boolean.']\n            assert exc_info.value.detail == expected\n\n\nclass TestNullableBooleanField(TestBooleanField):\n    \"\"\"\n    Valid and invalid values for `BooleanField` when `allow_null=True`.\n    \"\"\"\n    valid_inputs = {\n        'true': True,\n        'false': False,\n        'null': None,\n        True: True,\n        False: False,\n        None: None\n    }\n    invalid_inputs = {\n        'foo': ['Must be a valid boolean.'],\n    }\n    outputs = {\n        'true': True,\n        'false': False,\n        'null': None,\n        True: True,\n        False: False,\n        None: None,\n        'other': True\n    }\n    field = serializers.BooleanField(allow_null=True)\n\n\n# String types...\n\nclass TestCharField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `CharField`.\n    \"\"\"\n    valid_inputs = {\n        1: '1',\n        'abc': 'abc'\n    }\n    invalid_inputs = {\n        (): ['Not a valid string.'],\n        True: ['Not a valid string.'],\n        '': ['This field may not be blank.']\n    }\n    outputs = {\n        1: '1',\n        'abc': 'abc'\n    }\n    field = serializers.CharField()\n\n    def test_trim_whitespace_default(self):\n        field = serializers.CharField()\n        assert field.to_internal_value(' abc ') == 'abc'\n\n    def test_trim_whitespace_disabled(self):\n        field = serializers.CharField(trim_whitespace=False)\n        assert field.to_internal_value(' abc ') == ' abc '\n\n    def test_disallow_blank_with_trim_whitespace(self):\n        field = serializers.CharField(allow_blank=False, trim_whitespace=True)\n\n        with pytest.raises(serializers.ValidationError) as exc_info:\n            field.run_validation('   ')\n        assert exc_info.value.detail == ['This field may not be blank.']\n\n    def test_null_bytes(self):\n        field = serializers.CharField()\n\n        for value in ('\\0', 'foo\\0', '\\0foo', 'foo\\0foo'):\n            with pytest.raises(serializers.ValidationError) as exc_info:\n                field.run_validation(value)\n            assert exc_info.value.detail == [\n                'Null characters are not allowed.'\n            ]\n\n    def test_surrogate_characters(self):\n        field = serializers.CharField()\n\n        for code_point, expected_message in (\n            (0xD800, 'Surrogate characters are not allowed: U+D800.'),\n            (0xDFFF, 'Surrogate characters are not allowed: U+DFFF.'),\n        ):\n            with pytest.raises(serializers.ValidationError) as exc_info:\n                field.run_validation(chr(code_point))\n            assert exc_info.value.detail[0].code == 'surrogate_characters_not_allowed'\n            assert str(exc_info.value.detail[0]) == expected_message\n\n        for code_point in (0xD800 - 1, 0xDFFF + 1):\n            field.run_validation(chr(code_point))\n\n    def test_iterable_validators(self):\n        \"\"\"\n        Ensure `validators` parameter is compatible with reasonable iterables.\n        \"\"\"\n        value = 'example'\n\n        for validators in ([], (), set()):\n            field = serializers.CharField(validators=validators)\n            field.run_validation(value)\n\n        def raise_exception(value):\n            raise exceptions.ValidationError('Raised error')\n\n        for validators in ([raise_exception], (raise_exception,), {raise_exception}):\n            field = serializers.CharField(validators=validators)\n            with pytest.raises(serializers.ValidationError) as exc_info:\n                field.run_validation(value)\n            assert exc_info.value.detail == ['Raised error']\n\n\nclass TestEmailField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `EmailField`.\n    \"\"\"\n    valid_inputs = {\n        'example@example.com': 'example@example.com',\n        ' example@example.com ': 'example@example.com',\n    }\n    invalid_inputs = {\n        'examplecom': ['Enter a valid email address.']\n    }\n    outputs = {}\n    field = serializers.EmailField()\n\n\nclass TestRegexField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `RegexField`.\n    \"\"\"\n    valid_inputs = {\n        'a9': 'a9',\n    }\n    invalid_inputs = {\n        'A9': [\"This value does not match the required pattern.\"]\n    }\n    outputs = {}\n    field = serializers.RegexField(regex='[a-z][0-9]')\n\n\nclass TestiCompiledRegexField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `RegexField`.\n    \"\"\"\n    valid_inputs = {\n        'a9': 'a9',\n    }\n    invalid_inputs = {\n        'A9': [\"This value does not match the required pattern.\"]\n    }\n    outputs = {}\n    field = serializers.RegexField(regex=re.compile('[a-z][0-9]'))\n\n\nclass TestSlugField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `SlugField`.\n    \"\"\"\n    valid_inputs = {\n        'slug-99': 'slug-99',\n    }\n    invalid_inputs = {\n        'slug 99': ['Enter a valid \"slug\" consisting of letters, numbers, underscores or hyphens.']\n    }\n    outputs = {}\n    field = serializers.SlugField()\n\n    def test_allow_unicode_true(self):\n        field = serializers.SlugField(allow_unicode=True)\n\n        validation_error = False\n        try:\n            field.run_validation('slug-99-\\u0420')\n        except serializers.ValidationError:\n            validation_error = True\n\n        assert not validation_error\n\n\nclass TestURLField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `URLField`.\n    \"\"\"\n    valid_inputs = {\n        'http://example.com': 'http://example.com',\n    }\n    invalid_inputs = {\n        'example.com': ['Enter a valid URL.']\n    }\n    outputs = {}\n    field = serializers.URLField()\n\n\nclass TestUUIDField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `UUIDField`.\n    \"\"\"\n    valid_inputs = {\n        '825d7aeb-05a9-45b5-a5b7-05df87923cda': uuid.UUID('825d7aeb-05a9-45b5-a5b7-05df87923cda'),\n        '825d7aeb05a945b5a5b705df87923cda': uuid.UUID('825d7aeb-05a9-45b5-a5b7-05df87923cda'),\n        'urn:uuid:213b7d9b-244f-410d-828c-dabce7a2615d': uuid.UUID('213b7d9b-244f-410d-828c-dabce7a2615d'),\n        284758210125106368185219588917561929842: uuid.UUID('d63a6fb6-88d5-40c7-a91c-9edf73283072')\n    }\n    invalid_inputs = {\n        '825d7aeb-05a9-45b5-a5b7': ['Must be a valid UUID.'],\n        (1, 2, 3): ['Must be a valid UUID.']\n    }\n    outputs = {\n        uuid.UUID('825d7aeb-05a9-45b5-a5b7-05df87923cda'): '825d7aeb-05a9-45b5-a5b7-05df87923cda'\n    }\n    field = serializers.UUIDField()\n\n    def _test_format(self, uuid_format, formatted_uuid_0):\n        field = serializers.UUIDField(format=uuid_format)\n        assert field.to_representation(uuid.UUID(int=0)) == formatted_uuid_0\n        assert field.to_internal_value(formatted_uuid_0) == uuid.UUID(int=0)\n\n    def test_formats(self):\n        self._test_format('int', 0)\n        self._test_format('hex_verbose', '00000000-0000-0000-0000-000000000000')\n        self._test_format('urn', 'urn:uuid:00000000-0000-0000-0000-000000000000')\n        self._test_format('hex', '0' * 32)\n\n\nclass TestIPAddressField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `IPAddressField`\n    \"\"\"\n    valid_inputs = {\n        '127.0.0.1': '127.0.0.1',\n        '192.168.33.255': '192.168.33.255',\n        '2001:0db8:85a3:0042:1000:8a2e:0370:7334': '2001:db8:85a3:42:1000:8a2e:370:7334',\n        '2001:cdba:0:0:0:0:3257:9652': '2001:cdba::3257:9652',\n        '2001:cdba::3257:9652': '2001:cdba::3257:9652'\n    }\n    invalid_inputs = {\n        '127001': ['Enter a valid IPv4 or IPv6 address.'],\n        '127.122.111.2231': ['Enter a valid IPv4 or IPv6 address.'],\n        '2001:::9652': ['Enter a valid IPv4 or IPv6 address.'],\n        '2001:0db8:85a3:0042:1000:8a2e:0370:73341': ['Enter a valid IPv4 or IPv6 address.'],\n        1000: ['Enter a valid IPv4 or IPv6 address.'],\n    }\n    outputs = {}\n    field = serializers.IPAddressField()\n\n\nclass TestIPv4AddressField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `IPAddressField`\n    \"\"\"\n    valid_inputs = {\n        '127.0.0.1': '127.0.0.1',\n        '192.168.33.255': '192.168.33.255',\n    }\n    invalid_inputs = {\n        '127001': ['Enter a valid IPv4 address.'],\n        '127.122.111.2231': ['Enter a valid IPv4 address.'],\n    }\n    outputs = {}\n    field = serializers.IPAddressField(protocol='IPv4')\n\n\nclass TestIPv6AddressField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `IPAddressField`\n    \"\"\"\n    valid_inputs = {\n        '2001:0db8:85a3:0042:1000:8a2e:0370:7334': '2001:db8:85a3:42:1000:8a2e:370:7334',\n        '2001:cdba:0:0:0:0:3257:9652': '2001:cdba::3257:9652',\n        '2001:cdba::3257:9652': '2001:cdba::3257:9652'\n    }\n    invalid_inputs = {\n        '2001:::9652': ['Enter a valid IPv4 or IPv6 address.'],\n        '2001:0db8:85a3:0042:1000:8a2e:0370:73341': ['Enter a valid IPv4 or IPv6 address.'],\n    }\n    outputs = {}\n    field = serializers.IPAddressField(protocol='IPv6')\n\n\nclass TestFilePathField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `FilePathField`\n    \"\"\"\n\n    valid_inputs = {\n        __file__: __file__,\n    }\n    invalid_inputs = {\n        'wrong_path': ['\"wrong_path\" is not a valid path choice.']\n    }\n    outputs = {\n    }\n    field = serializers.FilePathField(\n        path=os.path.abspath(os.path.dirname(__file__))\n    )\n\n\n# Number types...\n\nclass TestIntegerField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `IntegerField`.\n    \"\"\"\n    valid_inputs = {\n        '1': 1,\n        '0': 0,\n        1: 1,\n        0: 0,\n        1.0: 1,\n        0.0: 0,\n        '1.0': 1\n    }\n    invalid_inputs = {\n        0.5: ['A valid integer is required.'],\n        'abc': ['A valid integer is required.'],\n        '0.5': ['A valid integer is required.']\n    }\n    outputs = {\n        '1': 1,\n        '0': 0,\n        1: 1,\n        0: 0,\n        1.0: 1,\n        0.0: 0\n    }\n    field = serializers.IntegerField()\n\n\nclass TestMinMaxIntegerField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `IntegerField` with min and max limits.\n    \"\"\"\n    valid_inputs = {\n        '1': 1,\n        '3': 3,\n        1: 1,\n        3: 3,\n    }\n    invalid_inputs = {\n        0: ['Ensure this value is greater than or equal to 1.'],\n        4: ['Ensure this value is less than or equal to 3.'],\n        '0': ['Ensure this value is greater than or equal to 1.'],\n        '4': ['Ensure this value is less than or equal to 3.'],\n    }\n    outputs = {}\n    field = serializers.IntegerField(min_value=1, max_value=3)\n\n\nclass TestBigIntegerField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `BigIntegerField`.\n    \"\"\"\n    valid_inputs = {\n        '1': 1,\n        '0': 0,\n        1: 1,\n        0: 0,\n        123: 123,\n        -123: -123,\n        '999999999999999999999999999': 999999999999999999999999999,\n        -999999999999999999999999999: -999999999999999999999999999,\n        1.0: 1,\n        0.0: 0,\n        '1.0': 1\n    }\n    invalid_inputs = {\n        0.5: ['A valid biginteger is required.'],\n        'abc': ['A valid biginteger is required.'],\n        '0.5': ['A valid biginteger is required.']\n    }\n    outputs = {\n        '1': 1,\n        '0': 0,\n        1: 1,\n        0: 0,\n        1.0: 1,\n        0.0: 0,\n        '999999999999999999999999999': 999999999999999999999999999,\n        -999999999999999999999999999: -999999999999999999999999999\n    }\n    field = serializers.BigIntegerField()\n\n\nclass TestMinMaxBigIntegerField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `BigIntegerField` with min and max limits.\n    \"\"\"\n    valid_inputs = {\n        '1': 1,\n        '3': 3,\n        1: 1,\n        3: 3,\n    }\n    invalid_inputs = {\n        0: ['Ensure this value is greater than or equal to 1.'],\n        4: ['Ensure this value is less than or equal to 3.'],\n        '0': ['Ensure this value is greater than or equal to 1.'],\n        '4': ['Ensure this value is less than or equal to 3.'],\n    }\n    outputs = {}\n    field = serializers.BigIntegerField(min_value=1, max_value=3)\n\n\nclass TestCoercionBigIntegerField(TestCase):\n\n    def test_force_coerce_to_string(self):\n        field = serializers.BigIntegerField(coerce_to_string=True)\n        value = field.to_representation(1)\n        assert isinstance(value, str)\n        assert value == \"1\"\n\n\nclass TestFloatField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `FloatField`.\n    \"\"\"\n    valid_inputs = {\n        '1': 1.0,\n        '0': 0.0,\n        1: 1.0,\n        0: 0.0,\n        1.0: 1.0,\n        0.0: 0.0,\n    }\n    invalid_inputs = {\n        'abc': [\"A valid number is required.\"]\n    }\n    outputs = {\n        '1': 1.0,\n        '0': 0.0,\n        1: 1.0,\n        0: 0.0,\n        1.0: 1.0,\n        0.0: 0.0,\n    }\n    field = serializers.FloatField()\n\n\nclass TestMinMaxFloatField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `FloatField` with min and max limits.\n    \"\"\"\n    valid_inputs = {\n        '1': 1,\n        '3': 3,\n        1: 1,\n        3: 3,\n        1.0: 1.0,\n        3.0: 3.0,\n    }\n    invalid_inputs = {\n        0.9: ['Ensure this value is greater than or equal to 1.'],\n        3.1: ['Ensure this value is less than or equal to 3.'],\n        '0.0': ['Ensure this value is greater than or equal to 1.'],\n        '3.1': ['Ensure this value is less than or equal to 3.'],\n    }\n    outputs = {}\n    field = serializers.FloatField(min_value=1, max_value=3)\n\n\nclass TestFloatFieldOverFlowError(TestCase):\n    def test_overflow_error_float_field(self):\n        field = serializers.FloatField()\n        with pytest.raises(serializers.ValidationError) as exec_info:\n            field.to_internal_value(data=math.factorial(171))\n        assert \"Integer value too large to convert to float\" in str(exec_info.value.detail)\n\n\nclass TestDecimalField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `DecimalField`.\n    \"\"\"\n    valid_inputs = {\n        '12.3': Decimal('12.3'),\n        '0.1': Decimal('0.1'),\n        10: Decimal('10'),\n        0: Decimal('0'),\n        12.3: Decimal('12.3'),\n        0.1: Decimal('0.1'),\n        '2E+1': Decimal('20'),\n    }\n    invalid_inputs = (\n        (None, [\"This field may not be null.\"]),\n        ('', [\"A valid number is required.\"]),\n        (' ', [\"A valid number is required.\"]),\n        ('abc', [\"A valid number is required.\"]),\n        (Decimal('Nan'), [\"A valid number is required.\"]),\n        (Decimal('Snan'), [\"A valid number is required.\"]),\n        (Decimal('Inf'), [\"A valid number is required.\"]),\n        ('12.345', [\"Ensure that there are no more than 3 digits in total.\"]),\n        (200000000000.0, [\"Ensure that there are no more than 3 digits in total.\"]),\n        ('0.01', [\"Ensure that there are no more than 1 decimal places.\"]),\n        (123, [\"Ensure that there are no more than 2 digits before the decimal point.\"]),\n        ('2E+2', [\"Ensure that there are no more than 2 digits before the decimal point.\"])\n    )\n    outputs = {\n        '1': '1.0',\n        '0': '0.0',\n        '1.09': '1.1',\n        '0.04': '0.0',\n        1: '1.0',\n        0: '0.0',\n        Decimal('1.0'): '1.0',\n        Decimal('0.0'): '0.0',\n        Decimal('1.09'): '1.1',\n        Decimal('0.04'): '0.0'\n    }\n    field = serializers.DecimalField(max_digits=3, decimal_places=1)\n\n\nclass TestAllowNullDecimalField(FieldValues):\n    valid_inputs = {\n        None: None,\n        '': None,\n        ' ': None,\n    }\n    invalid_inputs = {}\n    outputs = {\n        None: '',\n    }\n    field = serializers.DecimalField(max_digits=3, decimal_places=1, allow_null=True)\n\n\nclass TestAllowNullNoStringCoercionDecimalField(FieldValues):\n    valid_inputs = {\n        None: None,\n        '': None,\n        ' ': None,\n    }\n    invalid_inputs = {}\n    outputs = {\n        None: None,\n    }\n    field = serializers.DecimalField(max_digits=3, decimal_places=1, allow_null=True, coerce_to_string=False)\n\n\nclass TestMinMaxDecimalField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `DecimalField` with min and max limits.\n    \"\"\"\n    valid_inputs = {\n        '10.0': Decimal('10.0'),\n        '20.0': Decimal('20.0'),\n    }\n    invalid_inputs = {\n        '9.9': ['Ensure this value is greater than or equal to 10.0.'],\n        '20.1': ['Ensure this value is less than or equal to 20.0.'],\n    }\n    outputs = {}\n    field = serializers.DecimalField(\n        max_digits=3, decimal_places=1,\n        min_value=10.0, max_value=20.0\n    )\n\n    def test_warning_when_not_decimal_types(self, caplog):\n        with warnings.catch_warnings(record=True) as w:\n            warnings.simplefilter('always')\n\n            serializers.DecimalField(\n                max_digits=3, decimal_places=1,\n                min_value=10.0, max_value=20.0\n            )\n\n            assert len(w) == 2\n            assert all(issubclass(i.category, UserWarning) for i in w)\n\n            assert 'max_value should be an integer or Decimal instance' in str(w[0].message)\n            assert 'min_value should be an integer or Decimal instance' in str(w[1].message)\n\n\nclass TestAllowEmptyStrDecimalFieldWithValidators(FieldValues):\n    \"\"\"\n    Check that empty string ('', ' ') is acceptable value for the DecimalField\n    if allow_null=True and there are max/min validators\n    \"\"\"\n    valid_inputs = {\n        None: None,\n        '': None,\n        ' ': None,\n        '  ': None,\n        5: Decimal('5'),\n        '0': Decimal('0'),\n        '10': Decimal('10'),\n    }\n    invalid_inputs = {\n        -1: ['Ensure this value is greater than or equal to 0.'],\n        11: ['Ensure this value is less than or equal to 10.'],\n    }\n    outputs = {\n        None: '',\n    }\n    field = serializers.DecimalField(max_digits=3, decimal_places=1, allow_null=True, min_value=0, max_value=10)\n\n\nclass TestNoMaxDigitsDecimalField(FieldValues):\n    field = serializers.DecimalField(\n        max_value=100, min_value=0,\n        decimal_places=2, max_digits=None\n    )\n    valid_inputs = {\n        '10': Decimal('10.00')\n    }\n    invalid_inputs = {}\n    outputs = {}\n\n\nclass TestNoStringCoercionDecimalField(FieldValues):\n    \"\"\"\n    Output values for `DecimalField` with `coerce_to_string=False`.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {}\n    outputs = {\n        1.09: Decimal('1.1'),\n        0.04: Decimal('0.0'),\n        '1.09': Decimal('1.1'),\n        '0.04': Decimal('0.0'),\n        Decimal('1.09'): Decimal('1.1'),\n        Decimal('0.04'): Decimal('0.0'),\n    }\n    field = serializers.DecimalField(\n        max_digits=3, decimal_places=1,\n        coerce_to_string=False\n    )\n\n\nclass TestLocalizedDecimalField(TestCase):\n    @override_settings(LANGUAGE_CODE='pl')\n    def test_to_internal_value(self):\n        field = serializers.DecimalField(max_digits=2, decimal_places=1, localize=True)\n        assert field.to_internal_value('1,1') == Decimal('1.1')\n\n    @override_settings(LANGUAGE_CODE='pl')\n    def test_to_representation(self):\n        field = serializers.DecimalField(max_digits=2, decimal_places=1, localize=True)\n        assert field.to_representation(Decimal('1.1')) == '1,1'\n\n    def test_localize_forces_coerce_to_string(self):\n        field = serializers.DecimalField(max_digits=2, decimal_places=1, coerce_to_string=False, localize=True)\n        assert isinstance(field.to_representation(Decimal('1.1')), str)\n\n\nclass TestQuantizedValueForDecimal(TestCase):\n    def test_int_quantized_value_for_decimal(self):\n        field = serializers.DecimalField(max_digits=4, decimal_places=2)\n        value = field.to_internal_value(12).as_tuple()\n        expected_digit_tuple = (0, (1, 2, 0, 0), -2)\n        assert value == expected_digit_tuple\n\n    def test_string_quantized_value_for_decimal(self):\n        field = serializers.DecimalField(max_digits=4, decimal_places=2)\n        value = field.to_internal_value('12').as_tuple()\n        expected_digit_tuple = (0, (1, 2, 0, 0), -2)\n        assert value == expected_digit_tuple\n\n    def test_part_precision_string_quantized_value_for_decimal(self):\n        field = serializers.DecimalField(max_digits=4, decimal_places=2)\n        value = field.to_internal_value('12.0').as_tuple()\n        expected_digit_tuple = (0, (1, 2, 0, 0), -2)\n        assert value == expected_digit_tuple\n\n\nclass TestNormalizedOutputValueDecimalField(TestCase):\n    \"\"\"\n    Test that we get the expected behavior of on DecimalField when normalize=True\n    \"\"\"\n\n    def test_normalize_output(self):\n        field = serializers.DecimalField(max_digits=4, decimal_places=3, normalize_output=True)\n        output = field.to_representation(Decimal('1.000'))\n        assert output == '1'\n\n    def test_non_normalize_output(self):\n        field = serializers.DecimalField(max_digits=4, decimal_places=3, normalize_output=False)\n        output = field.to_representation(Decimal('1.000'))\n        assert output == '1.000'\n\n    def test_normalize_coeherce_to_string(self):\n        field = serializers.DecimalField(max_digits=4, decimal_places=3, normalize_output=True, coerce_to_string=False)\n        output = field.to_representation(Decimal('1.000'))\n        assert output == Decimal('1')\n\n\nclass TestNoDecimalPlaces(FieldValues):\n    valid_inputs = {\n        '0.12345': Decimal('0.12345'),\n    }\n    invalid_inputs = {\n        '0.1234567': ['Ensure that there are no more than 6 digits in total.']\n    }\n    outputs = {\n        '1.2345': '1.2345',\n        '0': '0',\n        '1.1': '1.1',\n    }\n    field = serializers.DecimalField(max_digits=6, decimal_places=None)\n\n\nclass TestRoundingDecimalField(TestCase):\n    def test_valid_rounding(self):\n        field = serializers.DecimalField(max_digits=4, decimal_places=2, rounding=ROUND_UP)\n        assert field.to_representation(Decimal('1.234')) == '1.24'\n\n        field = serializers.DecimalField(max_digits=4, decimal_places=2, rounding=ROUND_DOWN)\n        assert field.to_representation(Decimal('1.234')) == '1.23'\n\n    def test_invalid_rounding(self):\n        with pytest.raises(AssertionError) as excinfo:\n            serializers.DecimalField(max_digits=1, decimal_places=1, rounding='ROUND_UNKNOWN')\n        assert 'Invalid rounding option' in str(excinfo.value)\n\n\n# Date & time serializers...\nclass TestDateField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `DateField`.\n    \"\"\"\n    valid_inputs = {\n        '2001-01-01': datetime.date(2001, 1, 1),\n        datetime.date(2001, 1, 1): datetime.date(2001, 1, 1),\n    }\n    invalid_inputs = {\n        'abc': ['Date has wrong format. Use one of these formats instead: YYYY-MM-DD.'],\n        '2001-99-99': ['Date has wrong format. Use one of these formats instead: YYYY-MM-DD.'],\n        '2001-01': ['Date has wrong format. Use one of these formats instead: YYYY-MM-DD.'],\n        '2001': ['Date has wrong format. Use one of these formats instead: YYYY-MM-DD.'],\n        datetime.datetime(2001, 1, 1, 12, 00): ['Expected a date but got a datetime.'],\n    }\n    outputs = {\n        datetime.date(2001, 1, 1): '2001-01-01',\n        '2001-01-01': '2001-01-01',\n        '2016-01-10': '2016-01-10',\n        None: None,\n        '': None,\n    }\n    field = serializers.DateField()\n\n\nclass TestCustomInputFormatDateField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `DateField` with a custom input format.\n    \"\"\"\n    valid_inputs = {\n        '1 Jan 2001': datetime.date(2001, 1, 1),\n    }\n    invalid_inputs = {\n        '2001-01-01': ['Date has wrong format. Use one of these formats instead: DD [Jan-Dec] YYYY.']\n    }\n    outputs = {}\n    field = serializers.DateField(input_formats=['%d %b %Y'])\n\n\nclass TestCustomOutputFormatDateField(FieldValues):\n    \"\"\"\n    Values for `DateField` with a custom output format.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {}\n    outputs = {\n        datetime.date(2001, 1, 1): '01 Jan 2001'\n    }\n    field = serializers.DateField(format='%d %b %Y')\n\n\nclass TestNoOutputFormatDateField(FieldValues):\n    \"\"\"\n    Values for `DateField` with no output format.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {}\n    outputs = {\n        datetime.date(2001, 1, 1): datetime.date(2001, 1, 1)\n    }\n    field = serializers.DateField(format=None)\n\n\nclass TestDateTimeField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `DateTimeField`.\n    \"\"\"\n    valid_inputs = {\n        '2001-01-01 13:00': datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc),\n        '2001-01-01T13:00': datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc),\n        '2001-01-01T13:00Z': datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc),\n        datetime.datetime(2001, 1, 1, 13, 00): datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc),\n        datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc): datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc),\n    }\n    invalid_inputs = {\n        'abc': ['Datetime has wrong format. Use one of these formats instead: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z].'],\n        '2001-99-99T99:00': ['Datetime has wrong format. Use one of these formats instead: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z].'],\n        '2018-08-16 22:00-24:00': ['Datetime has wrong format. Use one of these formats instead: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z].'],\n        datetime.date(2001, 1, 1): ['Expected a datetime but got a date.'],\n        '9999-12-31T21:59:59.99990-03:00': ['Datetime value out of range.'],\n    }\n    outputs = {\n        datetime.datetime(2001, 1, 1, 13, 00): '2001-01-01T13:00:00Z',\n        datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc): '2001-01-01T13:00:00Z',\n        '2001-01-01T00:00:00': '2001-01-01T00:00:00',\n        '2016-01-10T00:00:00': '2016-01-10T00:00:00',\n        None: None,\n        '': None,\n    }\n    field = serializers.DateTimeField(default_timezone=utc)\n\n\nclass TestCustomInputFormatDateTimeField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `DateTimeField` with a custom input format.\n    \"\"\"\n    valid_inputs = {\n        '1:35pm, 1 Jan 2001': datetime.datetime(2001, 1, 1, 13, 35, tzinfo=utc),\n    }\n    invalid_inputs = {\n        '2001-01-01T20:50': ['Datetime has wrong format. Use one of these formats instead: hh:mm[AM|PM], DD [Jan-Dec] YYYY.']\n    }\n    outputs = {}\n    field = serializers.DateTimeField(default_timezone=utc, input_formats=['%I:%M%p, %d %b %Y'])\n\n\nclass TestCustomOutputFormatDateTimeField(FieldValues):\n    \"\"\"\n    Values for `DateTimeField` with a custom output format.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {}\n    outputs = {\n        datetime.datetime(2001, 1, 1, 13, 00): '01:00PM, 01 Jan 2001',\n    }\n    field = serializers.DateTimeField(format='%I:%M%p, %d %b %Y')\n\n\nclass TestNoOutputFormatDateTimeField(FieldValues):\n    \"\"\"\n    Values for `DateTimeField` with no output format.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {}\n    outputs = {\n        datetime.datetime(2001, 1, 1, 13, 00): datetime.datetime(2001, 1, 1, 13, 00),\n    }\n    field = serializers.DateTimeField(format=None)\n\n\n@override_settings(TIME_ZONE='UTC', USE_TZ=False)\nclass TestNaiveDateTimeField(FieldValues, TestCase):\n    \"\"\"\n    Valid and invalid values for `DateTimeField` with naive datetimes.\n    \"\"\"\n    valid_inputs = {\n        datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc): datetime.datetime(2001, 1, 1, 13, 00),\n        '2001-01-01 13:00': datetime.datetime(2001, 1, 1, 13, 00),\n    }\n    invalid_inputs = {}\n    outputs = {\n        datetime.datetime(2001, 1, 1, 13, 00): '2001-01-01T13:00:00',\n        datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc): '2001-01-01T13:00:00',\n    }\n    field = serializers.DateTimeField(default_timezone=None)\n\n\nclass TestTZWithDateTimeField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `DateTimeField` when not using UTC as the timezone.\n    \"\"\"\n    @classmethod\n    def setup_class(cls):\n        # use class setup method, as class-level attribute will still be evaluated even if test is skipped\n        kolkata = ZoneInfo('Asia/Kolkata')\n\n        cls.valid_inputs = {\n            '2016-12-19T10:00:00': datetime.datetime(2016, 12, 19, 10, tzinfo=kolkata),\n            '2016-12-19T10:00:00+05:30': datetime.datetime(2016, 12, 19, 10, tzinfo=kolkata),\n            datetime.datetime(2016, 12, 19, 10): datetime.datetime(2016, 12, 19, 10, tzinfo=kolkata),\n        }\n        cls.invalid_inputs = {}\n        cls.outputs = {\n            datetime.datetime(2016, 12, 19, 10): '2016-12-19T10:00:00+05:30',\n            datetime.datetime(2016, 12, 19, 4, 30, tzinfo=utc): '2016-12-19T10:00:00+05:30',\n        }\n        cls.field = serializers.DateTimeField(default_timezone=kolkata)\n\n\n@override_settings(TIME_ZONE='UTC', USE_TZ=True)\nclass TestDefaultTZDateTimeField(TestCase):\n    \"\"\"\n    Test the current/default timezone handling in `DateTimeField`.\n    \"\"\"\n\n    @classmethod\n    def setup_class(cls):\n        cls.field = serializers.DateTimeField()\n        cls.kolkata = ZoneInfo('Asia/Kolkata')\n\n    def assertUTC(self, tzinfo):\n        \"\"\"\n        Check UTC for datetime.timezone, ZoneInfo, and pytz tzinfo instances.\n        \"\"\"\n        assert (\n            tzinfo is utc or\n            (getattr(tzinfo, \"key\", None) or getattr(tzinfo, \"zone\", None)) == \"UTC\"\n        )\n\n    def test_default_timezone(self):\n        self.assertUTC(self.field.default_timezone())\n\n    def test_current_timezone(self):\n        self.assertUTC(self.field.default_timezone())\n        activate(self.kolkata)\n        assert self.field.default_timezone() == self.kolkata\n        deactivate()\n        self.assertUTC(self.field.default_timezone())\n\n\n@override_settings(TIME_ZONE='UTC', USE_TZ=True)\nclass TestCustomTimezoneForDateTimeField(TestCase):\n\n    @classmethod\n    def setup_class(cls):\n        cls.kolkata = ZoneInfo('Asia/Kolkata')\n        cls.date_format = '%d/%m/%Y %H:%M'\n\n    def test_should_render_date_time_in_default_timezone(self):\n        field = serializers.DateTimeField(default_timezone=self.kolkata, format=self.date_format)\n        dt = datetime.datetime(2018, 2, 8, 14, 15, 16, tzinfo=ZoneInfo(\"UTC\"))\n\n        with override(self.kolkata):\n            rendered_date = field.to_representation(dt)\n\n        rendered_date_in_timezone = dt.astimezone(self.kolkata).strftime(self.date_format)\n\n        assert rendered_date == rendered_date_in_timezone\n\n\n@pytest.mark.skipif(\n    condition=django.VERSION >= (5,),\n    reason=\"Django 5.0 has removed pytz; this test should eventually be able to get removed.\",\n)\nclass TestPytzNaiveDayLightSavingTimeTimeZoneDateTimeField(FieldValues):\n    \"\"\"\n    Invalid values for `DateTimeField` with datetime in DST shift (non-existing or ambiguous) and timezone with DST.\n    Timezone America/New_York has DST shift from 2017-03-12T02:00:00 to 2017-03-12T03:00:00 and\n     from 2017-11-05T02:00:00 to 2017-11-05T01:00:00 in 2017.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {\n        '2017-03-12T02:30:00': ['Invalid datetime for the timezone \"America/New_York\".'],\n        '2017-11-05T01:30:00': ['Invalid datetime for the timezone \"America/New_York\".']\n    }\n    outputs = {}\n\n    class MockTimezone(pytz.BaseTzInfo):\n        @staticmethod\n        def localize(value, is_dst):\n            raise pytz.InvalidTimeError()\n\n        def __str__(self):\n            return 'America/New_York'\n\n    field = serializers.DateTimeField(default_timezone=MockTimezone())\n\n\n@patch('rest_framework.utils.timezone.datetime_ambiguous', return_value=True)\nclass TestNaiveDayLightSavingTimeTimeZoneDateTimeField(FieldValues):\n    \"\"\"\n    Invalid values for `DateTimeField` with datetime in DST shift (non-existing or ambiguous) and timezone with DST.\n    Timezone America/New_York has DST shift from 2017-03-12T02:00:00 to 2017-03-12T03:00:00 and\n     from 2017-11-05T02:00:00 to 2017-11-05T01:00:00 in 2017.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {\n        '2017-03-12T02:30:00': ['Invalid datetime for the timezone \"America/New_York\".'],\n        '2017-11-05T01:30:00': ['Invalid datetime for the timezone \"America/New_York\".']\n    }\n    outputs = {}\n\n    class MockZoneInfoTimezone(datetime.tzinfo):\n        def __str__(self):\n            return 'America/New_York'\n\n    field = serializers.DateTimeField(default_timezone=MockZoneInfoTimezone())\n\n\nclass TestTimeField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `TimeField`.\n    \"\"\"\n    valid_inputs = {\n        '13:00': datetime.time(13, 00),\n        datetime.time(13, 00): datetime.time(13, 00),\n    }\n    invalid_inputs = {\n        'abc': ['Time has wrong format. Use one of these formats instead: hh:mm[:ss[.uuuuuu]].'],\n        '99:99': ['Time has wrong format. Use one of these formats instead: hh:mm[:ss[.uuuuuu]].'],\n    }\n    outputs = {\n        datetime.time(13, 0): '13:00:00',\n        datetime.time(0, 0): '00:00:00',\n        '00:00:00': '00:00:00',\n        None: None,\n        '': None,\n    }\n    field = serializers.TimeField()\n\n\nclass TestCustomInputFormatTimeField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `TimeField` with a custom input format.\n    \"\"\"\n    valid_inputs = {\n        '1:00pm': datetime.time(13, 00),\n    }\n    invalid_inputs = {\n        '13:00': ['Time has wrong format. Use one of these formats instead: hh:mm[AM|PM].'],\n    }\n    outputs = {}\n    field = serializers.TimeField(input_formats=['%I:%M%p'])\n\n\nclass TestCustomOutputFormatTimeField(FieldValues):\n    \"\"\"\n    Values for `TimeField` with a custom output format.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {}\n    outputs = {\n        datetime.time(13, 00): '01:00PM'\n    }\n    field = serializers.TimeField(format='%I:%M%p')\n\n\nclass TestNoOutputFormatTimeField(FieldValues):\n    \"\"\"\n    Values for `TimeField` with a no output format.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {}\n    outputs = {\n        datetime.time(13, 00): datetime.time(13, 00)\n    }\n    field = serializers.TimeField(format=None)\n\n\nclass TestMinMaxDurationField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `DurationField` with min and max limits.\n    \"\"\"\n    valid_inputs = {\n        '3 08:32:01.000123': datetime.timedelta(days=3, hours=8, minutes=32, seconds=1, microseconds=123),\n        86401: datetime.timedelta(days=1, seconds=1),\n    }\n    invalid_inputs = {\n        3600: ['Ensure this value is greater than or equal to 1 day, 0:00:00.'],\n        '4 08:32:01.000123': ['Ensure this value is less than or equal to 4 days, 0:00:00.'],\n        '3600': ['Ensure this value is greater than or equal to 1 day, 0:00:00.'],\n    }\n    outputs = {}\n    field = serializers.DurationField(min_value=datetime.timedelta(days=1), max_value=datetime.timedelta(days=4))\n\n\nclass TestDurationField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `DurationField`.\n    \"\"\"\n    valid_inputs = {\n        '13': datetime.timedelta(seconds=13),\n        '3 08:32:01.000123': datetime.timedelta(days=3, hours=8, minutes=32, seconds=1, microseconds=123),\n        '08:01': datetime.timedelta(minutes=8, seconds=1),\n        datetime.timedelta(days=3, hours=8, minutes=32, seconds=1, microseconds=123): datetime.timedelta(days=3, hours=8, minutes=32, seconds=1, microseconds=123),\n        3600: datetime.timedelta(hours=1),\n        '-999999999 00': datetime.timedelta(days=-999999999),\n        '999999999 00': datetime.timedelta(days=999999999),\n    }\n    invalid_inputs = {\n        'abc': ['Duration has wrong format. Use one of these formats instead: [DD] [HH:[MM:]]ss[.uuuuuu].'],\n        '3 08:32 01.123': ['Duration has wrong format. Use one of these formats instead: [DD] [HH:[MM:]]ss[.uuuuuu].'],\n        '-1000000000 00': ['The number of days must be between -999999999 and 999999999.'],\n        '1000000000 00': ['The number of days must be between -999999999 and 999999999.'],\n    }\n    outputs = {\n        datetime.timedelta(days=3, hours=8, minutes=32, seconds=1, microseconds=123): '3 08:32:01.000123',\n    }\n    field = serializers.DurationField()\n\n    def test_invalid_format(self):\n        with pytest.raises(ValueError) as exc_info:\n            serializers.DurationField(format='unknown')\n        assert str(exc_info.value) == (\n            \"Unknown duration format provided, got 'unknown'\"\n            \" while expecting 'django', 'iso-8601' or `None`.\"\n        )\n        with pytest.raises(TypeError) as exc_info:\n            serializers.DurationField(format=123)\n        assert str(exc_info.value) == (\n            \"duration format must be either str or `None`, not int\"\n        )\n\n    def test_invalid_format_in_config(self):\n        field = serializers.DurationField()\n\n        with override_settings(REST_FRAMEWORK={'DURATION_FORMAT': 'unknown'}):\n            with pytest.raises(ValueError) as exc_info:\n                field.to_representation(datetime.timedelta(days=1))\n\n        assert str(exc_info.value) == (\n            \"Unknown duration format provided, got 'unknown'\"\n            \" while expecting 'django', 'iso-8601' or `None`.\"\n        )\n        with override_settings(REST_FRAMEWORK={'DURATION_FORMAT': 123}):\n            with pytest.raises(TypeError) as exc_info:\n                field.to_representation(datetime.timedelta(days=1))\n        assert str(exc_info.value) == (\n            \"duration format must be either str or `None`, not int\"\n        )\n\n\nclass TestNoOutputFormatDurationField(FieldValues):\n    \"\"\"\n    Values for `DurationField` with a no output format.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {}\n    outputs = {\n        datetime.timedelta(1): datetime.timedelta(1)\n    }\n    field = serializers.DurationField(format=None)\n\n\nclass TestISOOutputFormatDurationField(FieldValues):\n    \"\"\"\n    Values for `DurationField` with a custom output format.\n    \"\"\"\n    valid_inputs = {\n        '13': datetime.timedelta(seconds=13),\n        'P3DT08H32M01.000123S': datetime.timedelta(days=3, hours=8, minutes=32, seconds=1, microseconds=123),\n        'PT8H1M': datetime.timedelta(hours=8, minutes=1),\n        '-P999999999D': datetime.timedelta(days=-999999999),\n        'P999999999D': datetime.timedelta(days=999999999)\n    }\n    invalid_inputs = {}\n    outputs = {\n        datetime.timedelta(days=3, hours=8, minutes=32, seconds=1, microseconds=123): 'P3DT08H32M01.000123S'\n    }\n    field = serializers.DurationField(format='iso-8601')\n\n\n# Choice types...\nclass TestChoiceField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `ChoiceField`.\n    \"\"\"\n    valid_inputs = {\n        'poor': 'poor',\n        'medium': 'medium',\n        'good': 'good',\n    }\n    invalid_inputs = {\n        'amazing': ['\"amazing\" is not a valid choice.']\n    }\n    outputs = {\n        'good': 'good',\n        '': '',\n        'amazing': 'amazing',\n    }\n    field = serializers.ChoiceField(\n        choices=[\n            ('poor', 'Poor quality'),\n            ('medium', 'Medium quality'),\n            ('good', 'Good quality'),\n        ]\n    )\n\n    def test_allow_blank(self):\n        \"\"\"\n        If `allow_blank=True` then '' is a valid input.\n        \"\"\"\n        field = serializers.ChoiceField(\n            allow_blank=True,\n            choices=[\n                ('poor', 'Poor quality'),\n                ('medium', 'Medium quality'),\n                ('good', 'Good quality'),\n            ]\n        )\n        output = field.run_validation('')\n        assert output == ''\n\n    def test_allow_null(self):\n        \"\"\"\n        If `allow_null=True` then '' on HTML forms is treated as None.\n        \"\"\"\n        field = serializers.ChoiceField(\n            allow_null=True,\n            choices=[\n                1, 2, 3\n            ]\n        )\n        field.field_name = 'example'\n        value = field.get_value(QueryDict('example='))\n        assert value is None\n        output = field.run_validation(None)\n        assert output is None\n\n    def test_iter_options(self):\n        \"\"\"\n        iter_options() should return a list of options and option groups.\n        \"\"\"\n        field = serializers.ChoiceField(\n            choices=[\n                ('Numbers', ['integer', 'float']),\n                ('Strings', ['text', 'email', 'url']),\n                'boolean'\n            ]\n        )\n        items = list(field.iter_options())\n\n        assert items[0].start_option_group\n        assert items[0].label == 'Numbers'\n        assert items[1].value == 'integer'\n        assert items[2].value == 'float'\n        assert items[3].end_option_group\n\n        assert items[4].start_option_group\n        assert items[4].label == 'Strings'\n        assert items[5].value == 'text'\n        assert items[6].value == 'email'\n        assert items[7].value == 'url'\n        assert items[8].end_option_group\n\n        assert items[9].value == 'boolean'\n\n    def test_edit_choices(self):\n        field = serializers.ChoiceField(\n            allow_null=True,\n            choices=[\n                1, 2,\n            ]\n        )\n        field.choices = [1]\n        assert field.run_validation(1) == 1\n        with pytest.raises(serializers.ValidationError) as exc_info:\n            field.run_validation(2)\n        assert exc_info.value.detail == ['\"2\" is not a valid choice.']\n\n    def test_enum_integer_choices(self):\n        from enum import IntEnum\n\n        class ChoiceCase(IntEnum):\n            first = auto()\n            second = auto()\n        # Enum validate\n        choices = [\n            (ChoiceCase.first, \"1\"),\n            (ChoiceCase.second, \"2\")\n        ]\n        field = serializers.ChoiceField(choices=choices)\n        assert field.run_validation(1) == 1\n        assert field.run_validation(ChoiceCase.first) == 1\n        assert field.run_validation(\"1\") == 1\n        # Enum.value validate\n        choices = [\n            (ChoiceCase.first.value, \"1\"),\n            (ChoiceCase.second.value, \"2\")\n        ]\n        field = serializers.ChoiceField(choices=choices)\n        assert field.run_validation(1) == 1\n        assert field.run_validation(ChoiceCase.first) == 1\n        assert field.run_validation(\"1\") == 1\n\n    def test_integer_choices(self):\n        class ChoiceCase(IntegerChoices):\n            first = auto()\n            second = auto()\n        # Enum validate\n        choices = [\n            (ChoiceCase.first, \"1\"),\n            (ChoiceCase.second, \"2\")\n        ]\n\n        field = serializers.ChoiceField(choices=choices)\n        assert field.run_validation(1) == 1\n        assert field.run_validation(ChoiceCase.first) == 1\n        assert field.run_validation(\"1\") == 1\n\n        choices = [\n            (ChoiceCase.first.value, \"1\"),\n            (ChoiceCase.second.value, \"2\")\n        ]\n\n        field = serializers.ChoiceField(choices=choices)\n        assert field.run_validation(1) == 1\n        assert field.run_validation(ChoiceCase.first) == 1\n        assert field.run_validation(\"1\") == 1\n\n    def test_text_choices(self):\n        class ChoiceCase(TextChoices):\n            first = auto()\n            second = auto()\n        # Enum validate\n        choices = [\n            (ChoiceCase.first, \"first\"),\n            (ChoiceCase.second, \"second\")\n        ]\n\n        field = serializers.ChoiceField(choices=choices)\n        assert field.run_validation(ChoiceCase.first) == \"first\"\n        assert field.run_validation(\"first\") == \"first\"\n\n        choices = [\n            (ChoiceCase.first.value, \"first\"),\n            (ChoiceCase.second.value, \"second\")\n        ]\n\n        field = serializers.ChoiceField(choices=choices)\n        assert field.run_validation(ChoiceCase.first) == \"first\"\n        assert field.run_validation(\"first\") == \"first\"\n\n\nclass TestChoiceFieldWithType(FieldValues):\n    \"\"\"\n    Valid and invalid values for a `Choice` field that uses an integer type,\n    instead of a char type.\n    \"\"\"\n    valid_inputs = {\n        '1': 1,\n        3: 3,\n    }\n    invalid_inputs = {\n        5: ['\"5\" is not a valid choice.'],\n        'abc': ['\"abc\" is not a valid choice.']\n    }\n    outputs = {\n        '1': 1,\n        1: 1\n    }\n    field = serializers.ChoiceField(\n        choices=[\n            (1, 'Poor quality'),\n            (2, 'Medium quality'),\n            (3, 'Good quality'),\n        ]\n    )\n\n\nclass TestChoiceFieldWithListChoices(FieldValues):\n    \"\"\"\n    Valid and invalid values for a `Choice` field that uses a flat list for the\n    choices, rather than a list of pairs of (`value`, `description`).\n    \"\"\"\n    valid_inputs = {\n        'poor': 'poor',\n        'medium': 'medium',\n        'good': 'good',\n    }\n    invalid_inputs = {\n        'awful': ['\"awful\" is not a valid choice.']\n    }\n    outputs = {\n        'good': 'good'\n    }\n    field = serializers.ChoiceField(choices=('poor', 'medium', 'good'))\n\n\nclass TestChoiceFieldWithGroupedChoices(FieldValues):\n    \"\"\"\n    Valid and invalid values for a `Choice` field that uses a grouped list for the\n    choices, rather than a list of pairs of (`value`, `description`).\n    \"\"\"\n    valid_inputs = {\n        'poor': 'poor',\n        'medium': 'medium',\n        'good': 'good',\n    }\n    invalid_inputs = {\n        'awful': ['\"awful\" is not a valid choice.']\n    }\n    outputs = {\n        'good': 'good'\n    }\n    field = serializers.ChoiceField(\n        choices=[\n            (\n                'Category',\n                (\n                    ('poor', 'Poor quality'),\n                    ('medium', 'Medium quality'),\n                ),\n            ),\n            ('good', 'Good quality'),\n        ]\n    )\n\n\nclass TestChoiceFieldWithMixedChoices(FieldValues):\n    \"\"\"\n    Valid and invalid values for a `Choice` field that uses a single paired or\n    grouped.\n    \"\"\"\n    valid_inputs = {\n        'poor': 'poor',\n        'medium': 'medium',\n        'good': 'good',\n    }\n    invalid_inputs = {\n        'awful': ['\"awful\" is not a valid choice.']\n    }\n    outputs = {\n        'good': 'good'\n    }\n    field = serializers.ChoiceField(\n        choices=[\n            (\n                'Category',\n                (\n                    ('poor', 'Poor quality'),\n                ),\n            ),\n            'medium',\n            ('good', 'Good quality'),\n        ]\n    )\n\n\nclass TestMultipleChoiceField(FieldValues):\n    \"\"\"\n    Valid and invalid values for `MultipleChoiceField`.\n    \"\"\"\n    valid_inputs = {\n        (): list(),\n        ('aircon',): ['aircon'],\n        ('aircon', 'aircon'): ['aircon'],\n        ('aircon', 'manual'): ['aircon', 'manual'],\n        ('manual', 'aircon'): ['manual', 'aircon'],\n    }\n    invalid_inputs = {\n        'abc': ['Expected a list of items but got type \"str\".'],\n        ('aircon', 'incorrect'): ['\"incorrect\" is not a valid choice.']\n    }\n    outputs = [\n        (['aircon', 'manual', 'incorrect'], ['aircon', 'manual', 'incorrect']),\n        (['manual', 'aircon', 'incorrect'], ['manual', 'aircon', 'incorrect']),\n        (['aircon', 'manual', 'aircon'], ['aircon', 'manual']),\n    ]\n    field = serializers.MultipleChoiceField(\n        choices=[\n            ('aircon', 'AirCon'),\n            ('manual', 'Manual drive'),\n            ('diesel', 'Diesel'),\n        ]\n    )\n\n    def test_against_partial_and_full_updates(self):\n        field = serializers.MultipleChoiceField(choices=(('a', 'a'), ('b', 'b')))\n        field.partial = False\n        assert field.get_value(QueryDict('')) == []\n        field.partial = True\n        assert field.get_value(QueryDict('')) == rest_framework.fields.empty\n\n    def test_valid_inputs_is_json_serializable(self):\n        for input_value, _ in get_items(self.valid_inputs):\n            validated = self.field.run_validation(input_value)\n\n            try:\n                json.dumps(validated)\n            except TypeError as e:\n                pytest.fail(f'Validated output not JSON serializable: {repr(validated)}; Error: {e}')\n\n    def test_output_is_json_serializable(self):\n        for output_value, _ in get_items(self.outputs):\n            representation = self.field.to_representation(output_value)\n\n            try:\n                json.dumps(representation)\n            except TypeError as e:\n                pytest.fail(\n                    f'to_representation output not JSON serializable: '\n                    f'{repr(representation)}; Error: {e}'\n                )\n\n\nclass TestEmptyMultipleChoiceField(FieldValues):\n    \"\"\"\n    Invalid values for `MultipleChoiceField(allow_empty=False)`.\n    \"\"\"\n    valid_inputs = {\n    }\n    invalid_inputs = (\n        ([], ['This selection may not be empty.']),\n    )\n    outputs = [\n    ]\n    field = serializers.MultipleChoiceField(\n        choices=[\n            ('consistency', 'Consistency'),\n            ('availability', 'Availability'),\n            ('partition', 'Partition tolerance'),\n        ],\n        allow_empty=False\n    )\n\n\n# File serializers...\n\nclass MockFile:\n    def __init__(self, name='', size=0, url=''):\n        self.name = name\n        self.size = size\n        self.url = url\n\n    def __eq__(self, other):\n        return (\n            isinstance(other, MockFile) and\n            self.name == other.name and\n            self.size == other.size and\n            self.url == other.url\n        )\n\n\nclass TestFileField(FieldValues):\n    \"\"\"\n    Values for `FileField`.\n    \"\"\"\n    valid_inputs = [\n        (MockFile(name='example', size=10), MockFile(name='example', size=10))\n    ]\n    invalid_inputs = [\n        ('invalid', ['The submitted data was not a file. Check the encoding type on the form.']),\n        (MockFile(name='example.txt', size=0), ['The submitted file is empty.']),\n        (MockFile(name='', size=10), ['No filename could be determined.']),\n        (MockFile(name='x' * 100, size=10), ['Ensure this filename has at most 10 characters (it has 100).'])\n    ]\n    outputs = [\n        (MockFile(name='example.txt', url='/example.txt'), '/example.txt'),\n        ('', None)\n    ]\n    field = serializers.FileField(max_length=10)\n\n\nclass TestFieldFieldWithName(FieldValues):\n    \"\"\"\n    Values for `FileField` with a filename output instead of URLs.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = {}\n    outputs = [\n        (MockFile(name='example.txt', url='/example.txt'), 'example.txt')\n    ]\n    field = serializers.FileField(use_url=False)\n\n\ndef ext_validator(value):\n    if not value.name.endswith('.png'):\n        raise serializers.ValidationError('File extension is not allowed. Allowed extensions is png.')\n\n\n# Stub out mock Django `forms.ImageField` class so we don't *actually*\n# call into it's regular validation, or require PIL for testing.\nclass PassImageValidation(DjangoImageField):\n    default_validators = [ext_validator]\n\n    def to_python(self, value):\n        return value\n\n\nclass FailImageValidation(PassImageValidation):\n    def to_python(self, value):\n        if value.name == 'badimage.png':\n            raise serializers.ValidationError(self.error_messages['invalid_image'])\n        return value\n\n\nclass TestInvalidImageField(FieldValues):\n    \"\"\"\n    Values for an invalid `ImageField`.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = [\n        (MockFile(name='badimage.png', size=10), ['Upload a valid image. The file you uploaded was either not an image or a corrupted image.']),\n        (MockFile(name='goodimage.html', size=10), ['File extension is not allowed. Allowed extensions is png.'])\n    ]\n    outputs = {}\n    field = serializers.ImageField(_DjangoImageField=FailImageValidation)\n\n\nclass TestValidImageField(FieldValues):\n    \"\"\"\n    Values for an valid `ImageField`.\n    \"\"\"\n    valid_inputs = [\n        (MockFile(name='example.png', size=10), MockFile(name='example.png', size=10))\n    ]\n    invalid_inputs = {}\n    outputs = {}\n    field = serializers.ImageField(_DjangoImageField=PassImageValidation)\n\n\n# Composite serializers...\n\nclass TestListField(FieldValues):\n    \"\"\"\n    Values for `ListField` with IntegerField as child.\n    \"\"\"\n    valid_inputs = [\n        ([1, 2, 3], [1, 2, 3]),\n        (['1', '2', '3'], [1, 2, 3]),\n        ([], [])\n    ]\n    invalid_inputs = [\n        ('not a list', ['Expected a list of items but got type \"str\".']),\n        ([1, 2, 'error', 'error'], {2: ['A valid integer is required.'], 3: ['A valid integer is required.']}),\n        ({'one': 'two'}, ['Expected a list of items but got type \"dict\".'])\n    ]\n    outputs = [\n        ([1, 2, 3], [1, 2, 3]),\n        (['1', '2', '3'], [1, 2, 3])\n    ]\n    field = serializers.ListField(child=serializers.IntegerField())\n\n    def test_no_source_on_child(self):\n        with pytest.raises(AssertionError) as exc_info:\n            serializers.ListField(child=serializers.IntegerField(source='other'))\n\n        assert str(exc_info.value) == (\n            \"The `source` argument is not meaningful when applied to a `child=` field. \"\n            \"Remove `source=` from the field declaration.\"\n        )\n\n    def test_collection_types_are_invalid_input(self):\n        field = serializers.ListField(child=serializers.CharField())\n        input_value = ({'one': 'two'})\n\n        with pytest.raises(serializers.ValidationError) as exc_info:\n            field.to_internal_value(input_value)\n        assert exc_info.value.detail == ['Expected a list of items but got type \"dict\".']\n\n    def test_constructor_misuse_raises(self):\n        # Test that `ListField` can only be instantiated with keyword arguments\n        with pytest.raises(TypeError):\n            serializers.ListField(serializers.CharField())\n\n\nclass TestNestedListField(FieldValues):\n    \"\"\"\n    Values for nested `ListField` with IntegerField as child.\n    \"\"\"\n    valid_inputs = [\n        ([[1, 2], [3]], [[1, 2], [3]]),\n        ([[]], [[]])\n    ]\n    invalid_inputs = [\n        (['not a list'], {0: ['Expected a list of items but got type \"str\".']}),\n        ([[1, 2, 'error'], ['error']], {0: {2: ['A valid integer is required.']}, 1: {0: ['A valid integer is required.']}}),\n        ([{'one': 'two'}], {0: ['Expected a list of items but got type \"dict\".']})\n    ]\n    outputs = [\n        ([[1, 2], [3]], [[1, 2], [3]]),\n    ]\n    field = serializers.ListField(child=serializers.ListField(child=serializers.IntegerField()))\n\n\nclass TestListFieldWithDjangoValidationErrors(FieldValues, TestCase):\n    \"\"\"\n    Values for `ListField` with UUIDField as child\n    (since UUIDField can throw ValidationErrors from Django).\n    The idea is to test that Django's ValidationErrors raised\n    from Django internals are caught and serializers in a way\n    that is structurally consistent with DRF's ValidationErrors.\n    \"\"\"\n\n    valid_inputs = []\n    invalid_inputs = [\n        (\n            ['not-a-valid-uuid', 'd7364368-d1b3-4455-aaa3-56439b460ca2', 'some-other-invalid-uuid'],\n            {\n                0: [exceptions.ErrorDetail(string='“not-a-valid-uuid” is not a valid UUID.', code='invalid')],\n                1: [\n                    exceptions.ErrorDetail(\n                        string='Invalid pk \"d7364368-d1b3-4455-aaa3-56439b460ca2\" - object does not exist.',\n                        code='does_not_exist',\n                    )\n                ],\n                2: [exceptions.ErrorDetail(string='“some-other-invalid-uuid” is not a valid UUID.', code='invalid')],\n            },\n        ),\n    ]\n    outputs = {}\n    field = serializers.ListField(child=serializers.PrimaryKeyRelatedField(queryset=UUIDForeignKeyTarget.objects.all()))\n\n\nclass TestEmptyListField(FieldValues):\n    \"\"\"\n    Values for `ListField` with allow_empty=False flag.\n    \"\"\"\n    valid_inputs = {}\n    invalid_inputs = [\n        ([], ['This list may not be empty.'])\n    ]\n    outputs = {}\n    field = serializers.ListField(child=serializers.IntegerField(), allow_empty=False)\n\n\nclass TestListFieldLengthLimit(FieldValues):\n    valid_inputs = ()\n    invalid_inputs = [\n        ((0, 1), ['Ensure this field has at least 3 elements.']),\n        ((0, 1, 2, 3, 4, 5), ['Ensure this field has no more than 4 elements.']),\n    ]\n    outputs = ()\n    field = serializers.ListField(child=serializers.IntegerField(), min_length=3, max_length=4)\n\n\nclass TestUnvalidatedListField(FieldValues):\n    \"\"\"\n    Values for `ListField` with no `child` argument.\n    \"\"\"\n    valid_inputs = [\n        ([1, '2', True, [4, 5, 6]], [1, '2', True, [4, 5, 6]]),\n    ]\n    invalid_inputs = [\n        ('not a list', ['Expected a list of items but got type \"str\".']),\n    ]\n    outputs = [\n        ([1, '2', True, [4, 5, 6]], [1, '2', True, [4, 5, 6]]),\n    ]\n    field = serializers.ListField()\n\n\nclass TestDictField(FieldValues):\n    \"\"\"\n    Values for `DictField` with CharField as child.\n    \"\"\"\n    valid_inputs = [\n        ({'a': 1, 'b': '2', 3: 3}, {'a': '1', 'b': '2', '3': '3'}),\n        ({}, {}),\n    ]\n    invalid_inputs = [\n        ({'a': 1, 'b': None, 'c': None}, {'b': ['This field may not be null.'], 'c': ['This field may not be null.']}),\n        ('not a dict', ['Expected a dictionary of items but got type \"str\".']),\n    ]\n    outputs = [\n        ({'a': 1, 'b': '2', 3: 3}, {'a': '1', 'b': '2', '3': '3'}),\n    ]\n    field = serializers.DictField(child=serializers.CharField())\n\n    def test_no_source_on_child(self):\n        with pytest.raises(AssertionError) as exc_info:\n            serializers.DictField(child=serializers.CharField(source='other'))\n\n        assert str(exc_info.value) == (\n            \"The `source` argument is not meaningful when applied to a `child=` field. \"\n            \"Remove `source=` from the field declaration.\"\n        )\n\n    def test_allow_null(self):\n        \"\"\"\n        If `allow_null=True` then `None` is a valid input.\n        \"\"\"\n        field = serializers.DictField(allow_null=True)\n        output = field.run_validation(None)\n        assert output is None\n\n    def test_allow_empty_disallowed(self):\n        \"\"\"\n        If allow_empty is False then an empty dict is not a valid input.\n        \"\"\"\n        field = serializers.DictField(allow_empty=False)\n        with pytest.raises(serializers.ValidationError) as exc_info:\n            field.run_validation({})\n\n        assert exc_info.value.detail == ['This dictionary may not be empty.']\n\n\nclass TestNestedDictField(FieldValues):\n    \"\"\"\n    Values for nested `DictField` with CharField as child.\n    \"\"\"\n    valid_inputs = [\n        ({0: {'a': 1, 'b': '2'}, 1: {3: 3}}, {'0': {'a': '1', 'b': '2'}, '1': {'3': '3'}}),\n    ]\n    invalid_inputs = [\n        ({0: {'a': 1, 'b': None}, 1: {'c': None}}, {'0': {'b': ['This field may not be null.']}, '1': {'c': ['This field may not be null.']}}),\n        ({0: 'not a dict'}, {'0': ['Expected a dictionary of items but got type \"str\".']}),\n    ]\n    outputs = [\n        ({0: {'a': 1, 'b': '2'}, 1: {3: 3}}, {'0': {'a': '1', 'b': '2'}, '1': {'3': '3'}}),\n    ]\n    field = serializers.DictField(child=serializers.DictField(child=serializers.CharField()))\n\n\nclass TestDictFieldWithNullChild(FieldValues):\n    \"\"\"\n    Values for `DictField` with allow_null CharField as child.\n    \"\"\"\n    valid_inputs = [\n        ({'a': None, 'b': '2', 3: 3}, {'a': None, 'b': '2', '3': '3'}),\n    ]\n    invalid_inputs = [\n    ]\n    outputs = [\n        ({'a': None, 'b': '2', 3: 3}, {'a': None, 'b': '2', '3': '3'}),\n    ]\n    field = serializers.DictField(child=serializers.CharField(allow_null=True))\n\n\nclass TestUnvalidatedDictField(FieldValues):\n    \"\"\"\n    Values for `DictField` with no `child` argument.\n    \"\"\"\n    valid_inputs = [\n        ({'a': 1, 'b': [4, 5, 6], 1: 123}, {'a': 1, 'b': [4, 5, 6], '1': 123}),\n    ]\n    invalid_inputs = [\n        ('not a dict', ['Expected a dictionary of items but got type \"str\".']),\n    ]\n    outputs = [\n        ({'a': 1, 'b': [4, 5, 6]}, {'a': 1, 'b': [4, 5, 6]}),\n    ]\n    field = serializers.DictField()\n\n\nclass TestHStoreField(FieldValues):\n    \"\"\"\n    Values for `ListField` with CharField as child.\n    \"\"\"\n    valid_inputs = [\n        ({'a': 1, 'b': '2', 3: 3}, {'a': '1', 'b': '2', '3': '3'}),\n        ({'a': 1, 'b': None}, {'a': '1', 'b': None}),\n    ]\n    invalid_inputs = [\n        ('not a dict', ['Expected a dictionary of items but got type \"str\".']),\n    ]\n    outputs = [\n        ({'a': 1, 'b': '2', 3: 3}, {'a': '1', 'b': '2', '3': '3'}),\n    ]\n    field = serializers.HStoreField()\n\n    def test_child_is_charfield(self):\n        with pytest.raises(AssertionError) as exc_info:\n            serializers.HStoreField(child=serializers.IntegerField())\n\n        assert str(exc_info.value) == (\n            \"The `child` argument must be an instance of `CharField`, \"\n            \"as the hstore extension stores values as strings.\"\n        )\n\n    def test_no_source_on_child(self):\n        with pytest.raises(AssertionError) as exc_info:\n            serializers.HStoreField(child=serializers.CharField(source='other'))\n\n        assert str(exc_info.value) == (\n            \"The `source` argument is not meaningful when applied to a `child=` field. \"\n            \"Remove `source=` from the field declaration.\"\n        )\n\n    def test_allow_null(self):\n        \"\"\"\n        If `allow_null=True` then `None` is a valid input.\n        \"\"\"\n        field = serializers.HStoreField(allow_null=True)\n        output = field.run_validation(None)\n        assert output is None\n\n\nclass TestJSONField(FieldValues):\n    \"\"\"\n    Values for `JSONField`.\n    \"\"\"\n    valid_inputs = [\n        ({\n            'a': 1,\n            'b': ['some', 'list', True, 1.23],\n            '3': None\n        }, {\n            'a': 1,\n            'b': ['some', 'list', True, 1.23],\n            '3': None\n        }),\n    ]\n    invalid_inputs = [\n        ({'a': set()}, ['Value must be valid JSON.']),\n        ({'a': float('inf')}, ['Value must be valid JSON.']),\n    ]\n    outputs = [\n        ({\n            'a': 1,\n            'b': ['some', 'list', True, 1.23],\n            '3': 3\n        }, {\n            'a': 1,\n            'b': ['some', 'list', True, 1.23],\n            '3': 3\n        }),\n    ]\n    field = serializers.JSONField()\n\n    def test_html_input_as_json_string(self):\n        \"\"\"\n        HTML inputs should be treated as a serialized JSON string.\n        \"\"\"\n        class TestSerializer(serializers.Serializer):\n            config = serializers.JSONField()\n\n        data = QueryDict(mutable=True)\n        data.update({'config': '{\"a\":1}'})\n        serializer = TestSerializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'config': {\"a\": 1}}\n\n\nclass TestBinaryJSONField(FieldValues):\n    \"\"\"\n    Values for `JSONField` with binary=True.\n    \"\"\"\n    valid_inputs = [\n        (b'{\"a\": 1, \"3\": null, \"b\": [\"some\", \"list\", true, 1.23]}', {\n            'a': 1,\n            'b': ['some', 'list', True, 1.23],\n            '3': None\n        }),\n    ]\n    invalid_inputs = [\n        ('{\"a\": \"unterminated string}', ['Value must be valid JSON.']),\n    ]\n    outputs = [\n        (['some', 'list', True, 1.23], b'[\"some\", \"list\", true, 1.23]'),\n    ]\n    field = serializers.JSONField(binary=True)\n\n\n# Tests for FileField.\n# --------------------\n\nclass MockRequest:\n    def build_absolute_uri(self, value):\n        return 'http://example.com' + value\n\n\nclass TestFileFieldContext:\n    def test_fully_qualified_when_request_in_context(self):\n        field = serializers.FileField(max_length=10)\n        field._context = {'request': MockRequest()}\n        obj = MockFile(name='example.txt', url='/example.txt')\n        value = field.to_representation(obj)\n        assert value == 'http://example.com/example.txt'\n\n\n# Tests for FilePathField.\n# --------------------\n\nclass TestFilePathFieldRequired:\n    def test_required_passed_to_both_django_file_path_field_and_base(self):\n        field = serializers.FilePathField(\n            path=os.path.abspath(os.path.dirname(__file__)),\n            required=False,\n        )\n        assert \"\" in field.choices  # Django adds empty choice if not required\n        assert field.required is False\n        with pytest.raises(SkipField):\n            field.run_validation(empty)\n\n\n# Tests for SerializerMethodField.\n# --------------------------------\n\nclass TestSerializerMethodField:\n    def test_serializer_method_field(self):\n        class ExampleSerializer(serializers.Serializer):\n            example_field = serializers.SerializerMethodField()\n\n            def get_example_field(self, obj):\n                return 'ran get_example_field(%d)' % obj['example_field']\n\n        serializer = ExampleSerializer({'example_field': 123})\n        assert serializer.data == {\n            'example_field': 'ran get_example_field(123)'\n        }\n\n    def test_redundant_method_name(self):\n        # Prior to v3.10, redundant method names were not allowed.\n        # This restriction has since been removed.\n        class ExampleSerializer(serializers.Serializer):\n            example_field = serializers.SerializerMethodField('get_example_field')\n\n        field = ExampleSerializer().fields['example_field']\n        assert field.method_name == 'get_example_field'\n\n\n# Tests for ModelField.\n# ---------------------\n\nclass TestModelField:\n    def test_max_length_init(self):\n        field = serializers.ModelField(None)\n        assert len(field.validators) == 0\n\n        field = serializers.ModelField(None, max_length=10)\n        assert len(field.validators) == 1\n\n\n# Tests for validation errors\n# ---------------------------\n\nclass TestValidationErrorCode:\n    @pytest.mark.parametrize('use_list', (False, True))\n    def test_validationerror_code_with_msg(self, use_list):\n\n        class ExampleSerializer(serializers.Serializer):\n            password = serializers.CharField()\n\n            def validate_password(self, obj):\n                err = DjangoValidationError(\n                    'exc_msg %s', code='exc_code', params=('exc_param',),\n                )\n                if use_list:\n                    err = DjangoValidationError([err])\n                raise err\n\n        serializer = ExampleSerializer(data={'password': 123})\n        serializer.is_valid()\n        assert serializer.errors == {'password': ['exc_msg exc_param']}\n        assert serializer.errors['password'][0].code == 'exc_code'\n\n    @pytest.mark.parametrize('use_list', (False, True))\n    def test_validationerror_code_with_msg_including_percent(self, use_list):\n\n        class ExampleSerializer(serializers.Serializer):\n            password = serializers.CharField()\n\n            def validate_password(self, obj):\n                err = DjangoValidationError('exc_msg with %', code='exc_code')\n                if use_list:\n                    err = DjangoValidationError([err])\n                raise err\n\n        serializer = ExampleSerializer(data={'password': 123})\n        serializer.is_valid()\n        assert serializer.errors == {'password': ['exc_msg with %']}\n        assert serializer.errors['password'][0].code == 'exc_code'\n\n    @pytest.mark.parametrize('code', (None, 'exc_code',))\n    @pytest.mark.parametrize('use_list', (False, True))\n    def test_validationerror_code_with_dict(self, use_list, code):\n\n        class ExampleSerializer(serializers.Serializer):\n\n            def validate(self, obj):\n                if code is None:\n                    err = DjangoValidationError({\n                        'email': 'email error',\n                    })\n                else:\n                    err = DjangoValidationError({\n                        'email': DjangoValidationError(\n                            'email error',\n                            code=code),\n                    })\n                if use_list:\n                    err = DjangoValidationError([err])\n                raise err\n\n        serializer = ExampleSerializer(data={})\n        serializer.is_valid()\n        expected_code = code if code else 'invalid'\n        if use_list:\n            assert serializer.errors == {\n                'non_field_errors': [\n                    exceptions.ErrorDetail(\n                        string='email error',\n                        code=expected_code\n                    )\n                ]\n            }\n        else:\n            assert serializer.errors == {\n                'email': ['email error'],\n            }\n            assert serializer.errors['email'][0].code == expected_code\n\n    @pytest.mark.parametrize('code', (None, 'exc_code',))\n    def test_validationerror_code_with_dict_list_same_code(self, code):\n\n        class ExampleSerializer(serializers.Serializer):\n\n            def validate(self, obj):\n                if code is None:\n                    raise DjangoValidationError({'email': ['email error 1',\n                                                           'email error 2']})\n                raise DjangoValidationError({'email': [\n                    DjangoValidationError('email error 1', code=code),\n                    DjangoValidationError('email error 2', code=code),\n                ]})\n\n        serializer = ExampleSerializer(data={})\n        serializer.is_valid()\n        expected_code = code if code else 'invalid'\n        assert serializer.errors == {\n            'email': [\n                exceptions.ErrorDetail(\n                    string='email error 1',\n                    code=expected_code\n                ),\n                exceptions.ErrorDetail(\n                    string='email error 2',\n                    code=expected_code\n                ),\n            ]\n        }\n"
  },
  {
    "path": "tests/test_filters.py",
    "content": "import datetime\nfrom importlib import reload as reload_module\n\nimport pytest\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.db import models\nfrom django.db.models import CharField, Transform\nfrom django.db.models.functions import Concat, Upper\nfrom django.test import SimpleTestCase, TestCase\nfrom django.test.utils import override_settings\n\nfrom rest_framework import filters, generics, serializers\nfrom rest_framework.exceptions import ValidationError\nfrom rest_framework.test import APIRequestFactory\n\nfactory = APIRequestFactory()\n\n\nclass SearchSplitTests(SimpleTestCase):\n\n    def test_keep_quoted_together_regardless_of_commas(self):\n        assert ['hello, world'] == list(filters.search_smart_split('\"hello, world\"'))\n\n    def test_strips_commas_around_quoted(self):\n        assert ['hello, world'] == list(filters.search_smart_split(',,\"hello, world\"'))\n        assert ['hello, world'] == list(filters.search_smart_split(',,\"hello, world\",,'))\n        assert ['hello, world'] == list(filters.search_smart_split('\"hello, world\",,'))\n\n    def test_splits_by_comma(self):\n        assert ['hello', 'world'] == list(filters.search_smart_split(',,hello, world'))\n        assert ['hello', 'world'] == list(filters.search_smart_split(',,hello, world,,'))\n        assert ['hello', 'world'] == list(filters.search_smart_split('hello, world,,'))\n\n    def test_splits_quotes_followed_by_comma_and_sentence(self):\n        assert ['\"hello', 'world\"', 'found'] == list(filters.search_smart_split('\"hello, world\",found'))\n\n\nclass BaseFilterTests(TestCase):\n    def setUp(self):\n        self.filter_backend = filters.BaseFilterBackend()\n\n    def test_filter_queryset_raises_error(self):\n        with pytest.raises(NotImplementedError):\n            self.filter_backend.filter_queryset(None, None, None)\n\n\nclass SearchFilterModel(models.Model):\n    title = models.CharField(max_length=20)\n    text = models.CharField(max_length=100)\n\n\nclass SearchFilterSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = SearchFilterModel\n        fields = '__all__'\n\n\nclass SearchFilterTests(TestCase):\n    @classmethod\n    def setUpTestData(cls):\n        # Sequence of title/text is:\n        #\n        # z   abc\n        # zz  bcd\n        # zzz cde\n        # ...\n        for idx in range(10):\n            title = 'z' * (idx + 1)\n            text = (\n                chr(idx + ord('a')) +\n                chr(idx + ord('b')) +\n                chr(idx + ord('c'))\n            )\n            SearchFilterModel(title=title, text=text).save()\n\n        SearchFilterModel(title='A title', text='The long text').save()\n        SearchFilterModel(title='The title', text='The \"text').save()\n\n    def test_search(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('title', 'text')\n\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': 'b'})\n        response = view(request)\n        assert response.data == [\n            {'id': 1, 'title': 'z', 'text': 'abc'},\n            {'id': 2, 'title': 'zz', 'text': 'bcd'}\n        ]\n\n    def test_search_returns_same_queryset_if_no_search_fields_or_terms_provided(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (filters.SearchFilter,)\n\n        view = SearchListView.as_view()\n        request = factory.get('/')\n        response = view(request)\n        expected = SearchFilterSerializer(SearchFilterModel.objects.all(),\n                                          many=True).data\n        assert response.data == expected\n\n    def test_exact_search(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('=title', 'text')\n\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': 'zzz'})\n        response = view(request)\n        assert response.data == [\n            {'id': 3, 'title': 'zzz', 'text': 'cde'}\n        ]\n\n    def test_startswith_search(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('title', '^text')\n\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': 'b'})\n        response = view(request)\n        assert response.data == [\n            {'id': 2, 'title': 'zz', 'text': 'bcd'}\n        ]\n\n    def test_regexp_search(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('$title', '$text')\n\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': 'z{2} ^b'})\n        response = view(request)\n        assert response.data == [\n            {'id': 2, 'title': 'zz', 'text': 'bcd'}\n        ]\n\n    def test_search_with_nonstandard_search_param(self):\n        with override_settings(REST_FRAMEWORK={'SEARCH_PARAM': 'query'}):\n            reload_module(filters)\n\n            class SearchListView(generics.ListAPIView):\n                queryset = SearchFilterModel.objects.all()\n                serializer_class = SearchFilterSerializer\n                filter_backends = (filters.SearchFilter,)\n                search_fields = ('title', 'text')\n\n            view = SearchListView.as_view()\n            request = factory.get('/', {'query': 'b'})\n            response = view(request)\n            assert response.data == [\n                {'id': 1, 'title': 'z', 'text': 'abc'},\n                {'id': 2, 'title': 'zz', 'text': 'bcd'}\n            ]\n\n        reload_module(filters)\n\n    def test_search_with_filter_subclass(self):\n        class CustomSearchFilter(filters.SearchFilter):\n            # Filter that dynamically changes search fields\n            def get_search_fields(self, view, request):\n                if request.query_params.get('title_only'):\n                    return ('$title',)\n                return super().get_search_fields(view, request)\n\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (CustomSearchFilter,)\n            search_fields = ('$title', '$text')\n\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': r'^\\w{3}$'})\n        response = view(request)\n        assert len(response.data) == 10\n\n        request = factory.get('/', {'search': r'^\\w{3}$', 'title_only': 'true'})\n        response = view(request)\n        assert response.data == [\n            {'id': 3, 'title': 'zzz', 'text': 'cde'}\n        ]\n\n    def test_search_field_with_null_characters(self):\n        view = generics.GenericAPIView()\n        request = factory.get('/?search=\\0as%00d\\x00f')\n        request = view.initialize_request(request)\n\n        with self.assertRaises(ValidationError):\n            filters.SearchFilter().get_search_terms(request)\n\n    def test_search_field_with_custom_lookup(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('text__iendswith',)\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': 'c'})\n        response = view(request)\n        assert response.data == [\n            {'id': 1, 'title': 'z', 'text': 'abc'},\n        ]\n\n    def test_search_field_with_additional_transforms(self):\n        from django.test.utils import register_lookup\n\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('text__trim', )\n\n        view = SearchListView.as_view()\n\n        # an example custom transform, that trims `a` from the string.\n        class TrimA(Transform):\n            function = 'TRIM'\n            lookup_name = 'trim'\n\n            def as_sql(self, compiler, connection):\n                sql, params = compiler.compile(self.lhs)\n                return \"trim(%s, 'a')\" % sql, params\n\n        with register_lookup(CharField, TrimA):\n            # Search including `a`\n            request = factory.get('/', {'search': 'abc'})\n\n            response = view(request)\n            assert response.data == []\n\n            # Search excluding `a`\n            request = factory.get('/', {'search': 'bc'})\n            response = view(request)\n            assert response.data == [\n                {'id': 1, 'title': 'z', 'text': 'abc'},\n                {'id': 2, 'title': 'zz', 'text': 'bcd'},\n            ]\n\n    def test_search_field_with_multiple_words(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('title', 'text')\n\n        search_query = 'foo bar,baz'\n        view = SearchListView()\n        request = factory.get('/', {'search': search_query})\n        request = view.initialize_request(request)\n\n        rendered_search_field = filters.SearchFilter().to_html(\n            request=request, queryset=view.queryset, view=view\n        )\n        assert search_query in rendered_search_field\n\n    def test_search_field_with_escapes(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('title', 'text',)\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': '\"\\\\\\\"text\"'})\n        response = view(request)\n        assert response.data == [\n            {'id': 12, 'title': 'The title', 'text': 'The \"text'},\n        ]\n\n    def test_search_field_with_quotes(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.all()\n            serializer_class = SearchFilterSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('title', 'text',)\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': '\"long text\"'})\n        response = view(request)\n        assert response.data == [\n            {'id': 11, 'title': 'A title', 'text': 'The long text'},\n        ]\n\n\nclass AttributeModel(models.Model):\n    label = models.CharField(max_length=32)\n\n\nclass SearchFilterModelFk(models.Model):\n    title = models.CharField(max_length=20)\n    attribute = models.ForeignKey(AttributeModel, on_delete=models.CASCADE)\n\n\nclass SearchFilterFkSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = SearchFilterModelFk\n        fields = '__all__'\n\n\nclass SearchFilterFkTests(TestCase):\n\n    def test_must_call_distinct(self):\n        filter_ = filters.SearchFilter()\n        prefixes = [''] + list(filter_.lookup_prefixes)\n        for prefix in prefixes:\n            assert not filter_.must_call_distinct(\n                SearchFilterModelFk._meta,\n                [\"%stitle\" % prefix]\n            )\n            assert not filter_.must_call_distinct(\n                SearchFilterModelFk._meta,\n                [\"%stitle\" % prefix, \"%sattribute__label\" % prefix]\n            )\n\n    def test_must_call_distinct_restores_meta_for_each_field(self):\n        # In this test case the attribute of the fk model comes first in the\n        # list of search fields.\n        filter_ = filters.SearchFilter()\n        prefixes = [''] + list(filter_.lookup_prefixes)\n        for prefix in prefixes:\n            assert not filter_.must_call_distinct(\n                SearchFilterModelFk._meta,\n                [\"%sattribute__label\" % prefix, \"%stitle\" % prefix]\n            )\n\n    def test_custom_lookup_to_related_model(self):\n        # In this test case the attribute of the fk model comes first in the\n        # list of search fields.\n        filter_ = filters.SearchFilter()\n        assert 'attribute__label__icontains' == filter_.construct_search('attribute__label', SearchFilterModelFk._meta)\n        assert 'attribute__label__iendswith' == filter_.construct_search('attribute__label__iendswith', SearchFilterModelFk._meta)\n\n\nclass SearchFilterModelM2M(models.Model):\n    title = models.CharField(max_length=20)\n    text = models.CharField(max_length=100)\n    attributes = models.ManyToManyField(AttributeModel)\n\n\nclass SearchFilterM2MSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = SearchFilterModelM2M\n        fields = '__all__'\n\n\nclass SearchFilterM2MTests(TestCase):\n    def setUp(self):\n        # Sequence of title/text/attributes is:\n        #\n        # z   abc [1, 2, 3]\n        # zz  bcd [1, 2, 3]\n        # zzz cde [1, 2, 3]\n        # ...\n        for idx in range(3):\n            label = 'w' * (idx + 1)\n            AttributeModel.objects.create(label=label)\n\n        for idx in range(10):\n            title = 'z' * (idx + 1)\n            text = (\n                chr(idx + ord('a')) +\n                chr(idx + ord('b')) +\n                chr(idx + ord('c'))\n            )\n            SearchFilterModelM2M(title=title, text=text).save()\n        SearchFilterModelM2M.objects.get(title='zz').attributes.add(1, 2, 3)\n\n    def test_m2m_search(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModelM2M.objects.all()\n            serializer_class = SearchFilterM2MSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('=title', 'text', 'attributes__label')\n\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': 'zz'})\n        response = view(request)\n        assert len(response.data) == 1\n\n    def test_must_call_distinct(self):\n        filter_ = filters.SearchFilter()\n        prefixes = [''] + list(filter_.lookup_prefixes)\n        for prefix in prefixes:\n            assert not filter_.must_call_distinct(\n                SearchFilterModelM2M._meta,\n                [\"%stitle\" % prefix]\n            )\n\n            assert filter_.must_call_distinct(\n                SearchFilterModelM2M._meta,\n                [\"%stitle\" % prefix, \"%sattributes__label\" % prefix]\n            )\n\n\nclass Blog(models.Model):\n    name = models.CharField(max_length=20)\n\n\nclass Entry(models.Model):\n    blog = models.ForeignKey(Blog, on_delete=models.CASCADE)\n    headline = models.CharField(max_length=120)\n    pub_date = models.DateField(null=True)\n\n\nclass BlogSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = Blog\n        fields = '__all__'\n\n\nclass SearchFilterToManyTests(TestCase):\n\n    @classmethod\n    def setUpTestData(cls):\n        b1 = Blog.objects.create(name='Blog 1')\n        b2 = Blog.objects.create(name='Blog 2')\n\n        # Multiple entries on Lennon published in 1979 - distinct should deduplicate\n        Entry.objects.create(blog=b1, headline='Something about Lennon', pub_date=datetime.date(1979, 1, 1))\n        Entry.objects.create(blog=b1, headline='Another thing about Lennon', pub_date=datetime.date(1979, 6, 1))\n\n        # Entry on Lennon *and* a separate entry in 1979 - should not match\n        Entry.objects.create(blog=b2, headline='Something unrelated', pub_date=datetime.date(1979, 1, 1))\n        Entry.objects.create(blog=b2, headline='Retrospective on Lennon', pub_date=datetime.date(1990, 6, 1))\n\n    def test_multiple_filter_conditions(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = Blog.objects.all()\n            serializer_class = BlogSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('=name', 'entry__headline', '=entry__pub_date__year')\n\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': 'Lennon,1979'})\n        response = view(request)\n        assert len(response.data) == 1\n\n\nclass SearchFilterAnnotatedSerializer(serializers.ModelSerializer):\n    title_text = serializers.CharField()\n\n    class Meta:\n        model = SearchFilterModel\n        fields = ('title', 'text', 'title_text')\n\n\nclass SearchFilterAnnotatedFieldTests(TestCase):\n    @classmethod\n    def setUpTestData(cls):\n        SearchFilterModel.objects.create(title='abc', text='def')\n        SearchFilterModel.objects.create(title='ghi', text='jkl')\n\n    def test_search_in_annotated_field(self):\n        class SearchListView(generics.ListAPIView):\n            queryset = SearchFilterModel.objects.annotate(\n                title_text=Upper(\n                    Concat(models.F('title'), models.F('text'))\n                )\n            ).all()\n            serializer_class = SearchFilterAnnotatedSerializer\n            filter_backends = (filters.SearchFilter,)\n            search_fields = ('title_text',)\n\n        view = SearchListView.as_view()\n        request = factory.get('/', {'search': 'ABCDEF'})\n        response = view(request)\n        assert len(response.data) == 1\n        assert response.data[0]['title_text'] == 'ABCDEF'\n\n    def test_must_call_distinct_subsequent_m2m_fields(self):\n        f = filters.SearchFilter()\n\n        queryset = SearchFilterModelM2M.objects.annotate(\n            title_text=Upper(\n                Concat(models.F('title'), models.F('text'))\n            )\n        ).all()\n\n        # Sanity check that m2m must call distinct\n        assert f.must_call_distinct(queryset, ['attributes'])\n\n        # Annotated field should not prevent m2m must call distinct\n        assert f.must_call_distinct(queryset, ['title_text', 'attributes'])\n\n\nclass OrderingFilterModel(models.Model):\n    title = models.CharField(max_length=20, verbose_name='verbose title')\n    text = models.CharField(max_length=100)\n\n    @property\n    def description(self):\n        return self.title + \": \" + self.text\n\n\nclass OrderingFilterRelatedModel(models.Model):\n    related_object = models.ForeignKey(OrderingFilterModel, related_name=\"related\", on_delete=models.CASCADE)\n    index = models.SmallIntegerField(help_text=\"A non-related field to test with\", default=0)\n\n\nclass OrderingFilterSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = OrderingFilterModel\n        fields = '__all__'\n\n\nclass OrderingFilterSerializerWithModelProperty(serializers.ModelSerializer):\n    class Meta:\n        model = OrderingFilterModel\n        fields = (\n            \"id\",\n            \"title\",\n            \"text\",\n            \"description\"\n        )\n\n\nclass OrderingDottedRelatedSerializer(serializers.ModelSerializer):\n    related_text = serializers.CharField(source='related_object.text')\n    related_title = serializers.CharField(source='related_object.title')\n\n    class Meta:\n        model = OrderingFilterRelatedModel\n        fields = (\n            'related_text',\n            'related_title',\n            'index',\n        )\n\n\nclass DjangoFilterOrderingModel(models.Model):\n    date = models.DateField()\n    text = models.CharField(max_length=10)\n\n    class Meta:\n        ordering = ['-date']\n\n\nclass DjangoFilterOrderingSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = DjangoFilterOrderingModel\n        fields = '__all__'\n\n\nclass OrderingFilterTests(TestCase):\n    def setUp(self):\n        # Sequence of title/text is:\n        #\n        # zyx abc\n        # yxw bcd\n        # xwv cde\n        for idx in range(3):\n            title = (\n                chr(ord('z') - idx) +\n                chr(ord('y') - idx) +\n                chr(ord('x') - idx)\n            )\n            text = (\n                chr(idx + ord('a')) +\n                chr(idx + ord('b')) +\n                chr(idx + ord('c'))\n            )\n            OrderingFilterModel(title=title, text=text).save()\n\n    def test_ordering(self):\n        class OrderingListView(generics.ListAPIView):\n            queryset = OrderingFilterModel.objects.all()\n            serializer_class = OrderingFilterSerializer\n            filter_backends = (filters.OrderingFilter,)\n            ordering = ('title',)\n            ordering_fields = ('text',)\n\n        view = OrderingListView.as_view()\n        request = factory.get('/', {'ordering': 'text'})\n        response = view(request)\n        assert response.data == [\n            {'id': 1, 'title': 'zyx', 'text': 'abc'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd'},\n            {'id': 3, 'title': 'xwv', 'text': 'cde'},\n        ]\n\n    def test_reverse_ordering(self):\n        class OrderingListView(generics.ListAPIView):\n            queryset = OrderingFilterModel.objects.all()\n            serializer_class = OrderingFilterSerializer\n            filter_backends = (filters.OrderingFilter,)\n            ordering = ('title',)\n            ordering_fields = ('text',)\n\n        view = OrderingListView.as_view()\n        request = factory.get('/', {'ordering': '-text'})\n        response = view(request)\n        assert response.data == [\n            {'id': 3, 'title': 'xwv', 'text': 'cde'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd'},\n            {'id': 1, 'title': 'zyx', 'text': 'abc'},\n        ]\n\n    def test_incorrecturl_extrahyphens_ordering(self):\n        class OrderingListView(generics.ListAPIView):\n            queryset = OrderingFilterModel.objects.all()\n            serializer_class = OrderingFilterSerializer\n            filter_backends = (filters.OrderingFilter,)\n            ordering = ('title',)\n            ordering_fields = ('text',)\n\n        view = OrderingListView.as_view()\n        request = factory.get('/', {'ordering': '--text'})\n        response = view(request)\n        assert response.data == [\n            {'id': 3, 'title': 'xwv', 'text': 'cde'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd'},\n            {'id': 1, 'title': 'zyx', 'text': 'abc'},\n        ]\n\n    def test_incorrectfield_ordering(self):\n        class OrderingListView(generics.ListAPIView):\n            queryset = OrderingFilterModel.objects.all()\n            serializer_class = OrderingFilterSerializer\n            filter_backends = (filters.OrderingFilter,)\n            ordering = ('title',)\n            ordering_fields = ('text',)\n\n        view = OrderingListView.as_view()\n        request = factory.get('/', {'ordering': 'foobar'})\n        response = view(request)\n        assert response.data == [\n            {'id': 3, 'title': 'xwv', 'text': 'cde'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd'},\n            {'id': 1, 'title': 'zyx', 'text': 'abc'},\n        ]\n\n    def test_ordering_without_ordering_fields(self):\n        class OrderingListView(generics.ListAPIView):\n            queryset = OrderingFilterModel.objects.all()\n            serializer_class = OrderingFilterSerializerWithModelProperty\n            filter_backends = (filters.OrderingFilter,)\n            ordering = ('title',)\n\n        view = OrderingListView.as_view()\n\n        # Model field ordering works fine.\n        request = factory.get('/', {'ordering': 'text'})\n        response = view(request)\n        assert response.data == [\n            {'id': 1, 'title': 'zyx', 'text': 'abc', 'description': 'zyx: abc'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd', 'description': 'yxw: bcd'},\n            {'id': 3, 'title': 'xwv', 'text': 'cde', 'description': 'xwv: cde'},\n        ]\n\n        # `incorrectfield` ordering works fine.\n        request = factory.get('/', {'ordering': 'foobar'})\n        response = view(request)\n        assert response.data == [\n            {'id': 3, 'title': 'xwv', 'text': 'cde', 'description': 'xwv: cde'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd', 'description': 'yxw: bcd'},\n            {'id': 1, 'title': 'zyx', 'text': 'abc', 'description': 'zyx: abc'},\n        ]\n\n        # `description` is a Model property, which should be ignored.\n        request = factory.get('/', {'ordering': 'description'})\n        response = view(request)\n        assert response.data == [\n            {'id': 3, 'title': 'xwv', 'text': 'cde', 'description': 'xwv: cde'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd', 'description': 'yxw: bcd'},\n            {'id': 1, 'title': 'zyx', 'text': 'abc', 'description': 'zyx: abc'},\n        ]\n\n    def test_default_ordering(self):\n        class OrderingListView(generics.ListAPIView):\n            queryset = OrderingFilterModel.objects.all()\n            serializer_class = OrderingFilterSerializer\n            filter_backends = (filters.OrderingFilter,)\n            ordering = ('title',)\n            ordering_fields = ('text',)\n\n        view = OrderingListView.as_view()\n        request = factory.get('')\n        response = view(request)\n        assert response.data == [\n            {'id': 3, 'title': 'xwv', 'text': 'cde'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd'},\n            {'id': 1, 'title': 'zyx', 'text': 'abc'},\n        ]\n\n    def test_default_ordering_using_string(self):\n        class OrderingListView(generics.ListAPIView):\n            queryset = OrderingFilterModel.objects.all()\n            serializer_class = OrderingFilterSerializer\n            filter_backends = (filters.OrderingFilter,)\n            ordering = 'title'\n            ordering_fields = ('text',)\n\n        view = OrderingListView.as_view()\n        request = factory.get('')\n        response = view(request)\n        assert response.data == [\n            {'id': 3, 'title': 'xwv', 'text': 'cde'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd'},\n            {'id': 1, 'title': 'zyx', 'text': 'abc'},\n        ]\n\n    def test_ordering_by_aggregate_field(self):\n        # create some related models to aggregate order by\n        num_objs = [2, 5, 3]\n        for obj, num_related in zip(OrderingFilterModel.objects.all(),\n                                    num_objs):\n            for _ in range(num_related):\n                new_related = OrderingFilterRelatedModel(\n                    related_object=obj\n                )\n                new_related.save()\n\n        class OrderingListView(generics.ListAPIView):\n            serializer_class = OrderingFilterSerializer\n            filter_backends = (filters.OrderingFilter,)\n            ordering = 'title'\n            ordering_fields = '__all__'\n            queryset = OrderingFilterModel.objects.all().annotate(\n                models.Count(\"related\"))\n\n        view = OrderingListView.as_view()\n        request = factory.get('/', {'ordering': 'related__count'})\n        response = view(request)\n        assert response.data == [\n            {'id': 1, 'title': 'zyx', 'text': 'abc'},\n            {'id': 3, 'title': 'xwv', 'text': 'cde'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd'},\n        ]\n\n    def test_ordering_by_dotted_source(self):\n\n        for index, obj in enumerate(OrderingFilterModel.objects.all()):\n            OrderingFilterRelatedModel.objects.create(\n                related_object=obj,\n                index=index\n            )\n\n        class OrderingListView(generics.ListAPIView):\n            serializer_class = OrderingDottedRelatedSerializer\n            filter_backends = (filters.OrderingFilter,)\n            queryset = OrderingFilterRelatedModel.objects.all()\n\n        view = OrderingListView.as_view()\n        request = factory.get('/', {'ordering': 'related_object__text'})\n        response = view(request)\n        assert response.data == [\n            {'related_title': 'zyx', 'related_text': 'abc', 'index': 0},\n            {'related_title': 'yxw', 'related_text': 'bcd', 'index': 1},\n            {'related_title': 'xwv', 'related_text': 'cde', 'index': 2},\n        ]\n\n        request = factory.get('/', {'ordering': '-index'})\n        response = view(request)\n        assert response.data == [\n            {'related_title': 'xwv', 'related_text': 'cde', 'index': 2},\n            {'related_title': 'yxw', 'related_text': 'bcd', 'index': 1},\n            {'related_title': 'zyx', 'related_text': 'abc', 'index': 0},\n        ]\n\n    def test_ordering_with_nonstandard_ordering_param(self):\n        with override_settings(REST_FRAMEWORK={'ORDERING_PARAM': 'order'}):\n            reload_module(filters)\n\n            class OrderingListView(generics.ListAPIView):\n                queryset = OrderingFilterModel.objects.all()\n                serializer_class = OrderingFilterSerializer\n                filter_backends = (filters.OrderingFilter,)\n                ordering = ('title',)\n                ordering_fields = ('text',)\n\n            view = OrderingListView.as_view()\n            request = factory.get('/', {'order': 'text'})\n            response = view(request)\n            assert response.data == [\n                {'id': 1, 'title': 'zyx', 'text': 'abc'},\n                {'id': 2, 'title': 'yxw', 'text': 'bcd'},\n                {'id': 3, 'title': 'xwv', 'text': 'cde'},\n            ]\n\n        reload_module(filters)\n\n    def test_get_template_context(self):\n        class OrderingListView(generics.ListAPIView):\n            ordering_fields = '__all__'\n            serializer_class = OrderingFilterSerializer\n            queryset = OrderingFilterModel.objects.all()\n            filter_backends = (filters.OrderingFilter,)\n\n        request = factory.get('/', {'ordering': 'title'}, HTTP_ACCEPT='text/html')\n        view = OrderingListView.as_view()\n        response = view(request)\n\n        self.assertContains(response, 'verbose title')\n\n    def test_ordering_with_overridden_get_serializer_class(self):\n        class OrderingListView(generics.ListAPIView):\n            queryset = OrderingFilterModel.objects.all()\n            filter_backends = (filters.OrderingFilter,)\n            ordering = ('title',)\n\n            # note: no ordering_fields and serializer_class specified\n\n            def get_serializer_class(self):\n                return OrderingFilterSerializer\n\n        view = OrderingListView.as_view()\n        request = factory.get('/', {'ordering': 'text'})\n        response = view(request)\n        assert response.data == [\n            {'id': 1, 'title': 'zyx', 'text': 'abc'},\n            {'id': 2, 'title': 'yxw', 'text': 'bcd'},\n            {'id': 3, 'title': 'xwv', 'text': 'cde'},\n        ]\n\n    def test_ordering_with_improper_configuration(self):\n        class OrderingListView(generics.ListAPIView):\n            queryset = OrderingFilterModel.objects.all()\n            filter_backends = (filters.OrderingFilter,)\n            ordering = ('title',)\n            # note: no ordering_fields and serializer_class\n            # or get_serializer_class specified\n\n        view = OrderingListView.as_view()\n        request = factory.get('/', {'ordering': 'text'})\n        with self.assertRaises(ImproperlyConfigured):\n            view(request)\n\n\nclass SensitiveOrderingFilterModel(models.Model):\n    username = models.CharField(max_length=20)\n    password = models.CharField(max_length=100)\n\n\n# Three different styles of serializer.\n# All should allow ordering by username, but not by password.\nclass SensitiveDataSerializer1(serializers.ModelSerializer):\n    username = serializers.CharField()\n\n    class Meta:\n        model = SensitiveOrderingFilterModel\n        fields = ('id', 'username')\n\n\nclass SensitiveDataSerializer2(serializers.ModelSerializer):\n    username = serializers.CharField()\n    password = serializers.CharField(write_only=True)\n\n    class Meta:\n        model = SensitiveOrderingFilterModel\n        fields = ('id', 'username', 'password')\n\n\nclass SensitiveDataSerializer3(serializers.ModelSerializer):\n    user = serializers.CharField(source='username')\n\n    class Meta:\n        model = SensitiveOrderingFilterModel\n        fields = ('id', 'user')\n\n\nclass SensitiveOrderingFilterTests(TestCase):\n    def setUp(self):\n        for idx in range(3):\n            username = {0: 'userA', 1: 'userB', 2: 'userC'}[idx]\n            password = {0: 'passA', 1: 'passC', 2: 'passB'}[idx]\n            SensitiveOrderingFilterModel(username=username, password=password).save()\n\n    def test_order_by_serializer_fields(self):\n        for serializer_cls in [\n            SensitiveDataSerializer1,\n            SensitiveDataSerializer2,\n            SensitiveDataSerializer3\n        ]:\n            class OrderingListView(generics.ListAPIView):\n                queryset = SensitiveOrderingFilterModel.objects.all().order_by('username')\n                filter_backends = (filters.OrderingFilter,)\n                serializer_class = serializer_cls\n\n            view = OrderingListView.as_view()\n            request = factory.get('/', {'ordering': '-username'})\n            response = view(request)\n\n            if serializer_cls == SensitiveDataSerializer3:\n                username_field = 'user'\n            else:\n                username_field = 'username'\n\n            # Note: Inverse username ordering correctly applied.\n            assert response.data == [\n                {'id': 3, username_field: 'userC'},\n                {'id': 2, username_field: 'userB'},\n                {'id': 1, username_field: 'userA'},\n            ]\n\n    def test_cannot_order_by_non_serializer_fields(self):\n        for serializer_cls in [\n            SensitiveDataSerializer1,\n            SensitiveDataSerializer2,\n            SensitiveDataSerializer3\n        ]:\n            class OrderingListView(generics.ListAPIView):\n                queryset = SensitiveOrderingFilterModel.objects.all().order_by('username')\n                filter_backends = (filters.OrderingFilter,)\n                serializer_class = serializer_cls\n\n            view = OrderingListView.as_view()\n            request = factory.get('/', {'ordering': 'password'})\n            response = view(request)\n\n            if serializer_cls == SensitiveDataSerializer3:\n                username_field = 'user'\n            else:\n                username_field = 'username'\n\n            # Note: The passwords are not in order.  Default ordering is used.\n            assert response.data == [\n                {'id': 1, username_field: 'userA'},  # PassB\n                {'id': 2, username_field: 'userB'},  # PassC\n                {'id': 3, username_field: 'userC'},  # PassA\n            ]\n"
  },
  {
    "path": "tests/test_generics.py",
    "content": "import pytest\nfrom django.db import models\nfrom django.http import Http404\nfrom django.shortcuts import get_object_or_404\nfrom django.test import TestCase\n\nfrom rest_framework import generics, renderers, serializers, status\nfrom rest_framework.exceptions import ErrorDetail\nfrom rest_framework.response import Response\nfrom rest_framework.test import APIRequestFactory\nfrom tests.models import (\n    BasicModel, ForeignKeySource, ForeignKeyTarget, RESTFrameworkModel,\n    UUIDForeignKeyTarget\n)\n\nfactory = APIRequestFactory()\n\n\n# Models\nclass SlugBasedModel(RESTFrameworkModel):\n    text = models.CharField(max_length=100)\n    slug = models.SlugField(max_length=32)\n\n\n# Model for regression test for #285\nclass Comment(RESTFrameworkModel):\n    email = models.EmailField()\n    content = models.CharField(max_length=200)\n    created = models.DateTimeField(auto_now_add=True)\n\n\n# Serializers\nclass BasicSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = BasicModel\n        fields = '__all__'\n\n\nclass ForeignKeySerializer(serializers.ModelSerializer):\n    class Meta:\n        model = ForeignKeySource\n        fields = '__all__'\n\n\nclass SlugSerializer(serializers.ModelSerializer):\n    slug = serializers.ReadOnlyField()\n\n    class Meta:\n        model = SlugBasedModel\n        fields = ('text', 'slug')\n\n\n# Views\nclass RootView(generics.ListCreateAPIView):\n    queryset = BasicModel.objects.all()\n    serializer_class = BasicSerializer\n\n\nclass InstanceView(generics.RetrieveUpdateDestroyAPIView):\n    queryset = BasicModel.objects.exclude(text='filtered out')\n    serializer_class = BasicSerializer\n\n\nclass FKInstanceView(generics.RetrieveUpdateDestroyAPIView):\n    queryset = ForeignKeySource.objects.all()\n    serializer_class = ForeignKeySerializer\n\n\nclass SlugBasedInstanceView(InstanceView):\n    \"\"\"\n    A model with a slug-field.\n    \"\"\"\n    queryset = SlugBasedModel.objects.all()\n    serializer_class = SlugSerializer\n    lookup_field = 'slug'\n\n\n# Tests\nclass TestRootView(TestCase):\n    def setUp(self):\n        \"\"\"\n        Create 3 BasicModel instances.\n        \"\"\"\n        items = ['foo', 'bar', 'baz']\n        for item in items:\n            BasicModel(text=item).save()\n        self.objects = BasicModel.objects\n        self.data = [\n            {'id': obj.id, 'text': obj.text}\n            for obj in self.objects.all()\n        ]\n        self.view = RootView.as_view()\n\n    def test_get_root_view(self):\n        \"\"\"\n        GET requests to ListCreateAPIView should return list of objects.\n        \"\"\"\n        request = factory.get('/')\n        with self.assertNumQueries(1):\n            response = self.view(request).render()\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == self.data\n\n    def test_head_root_view(self):\n        \"\"\"\n        HEAD requests to ListCreateAPIView should return 200.\n        \"\"\"\n        request = factory.head('/')\n        with self.assertNumQueries(1):\n            response = self.view(request).render()\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_post_root_view(self):\n        \"\"\"\n        POST requests to ListCreateAPIView should create a new object.\n        \"\"\"\n        data = {'text': 'foobar'}\n        request = factory.post('/', data, format='json')\n        with self.assertNumQueries(1):\n            response = self.view(request).render()\n        assert response.status_code == status.HTTP_201_CREATED\n        assert response.data == {'id': 4, 'text': 'foobar'}\n        created = self.objects.get(id=4)\n        assert created.text == 'foobar'\n\n    def test_put_root_view(self):\n        \"\"\"\n        PUT requests to ListCreateAPIView should not be allowed\n        \"\"\"\n        data = {'text': 'foobar'}\n        request = factory.put('/', data, format='json')\n        with self.assertNumQueries(0):\n            response = self.view(request).render()\n        assert response.status_code == status.HTTP_405_METHOD_NOT_ALLOWED\n        assert response.data == {\"detail\": 'Method \"PUT\" not allowed.'}\n\n    def test_delete_root_view(self):\n        \"\"\"\n        DELETE requests to ListCreateAPIView should not be allowed\n        \"\"\"\n        request = factory.delete('/')\n        with self.assertNumQueries(0):\n            response = self.view(request).render()\n        assert response.status_code == status.HTTP_405_METHOD_NOT_ALLOWED\n        assert response.data == {\"detail\": 'Method \"DELETE\" not allowed.'}\n\n    def test_post_cannot_set_id(self):\n        \"\"\"\n        POST requests to create a new object should not be able to set the id.\n        \"\"\"\n        data = {'id': 999, 'text': 'foobar'}\n        request = factory.post('/', data, format='json')\n        with self.assertNumQueries(1):\n            response = self.view(request).render()\n        assert response.status_code == status.HTTP_201_CREATED\n        assert response.data == {'id': 4, 'text': 'foobar'}\n        created = self.objects.get(id=4)\n        assert created.text == 'foobar'\n\n    def test_post_error_root_view(self):\n        \"\"\"\n        POST requests to ListCreateAPIView in HTML should include a form error.\n        \"\"\"\n        data = {'text': 'foobar' * 100}\n        request = factory.post('/', data, HTTP_ACCEPT='text/html')\n        response = self.view(request).render()\n        expected_error = '<span class=\"help-block\">Ensure this field has no more than 100 characters.</span>'\n        assert expected_error in response.rendered_content.decode()\n\n\nEXPECTED_QUERIES_FOR_PUT = 2\n\n\nclass TestInstanceView(TestCase):\n    def setUp(self):\n        \"\"\"\n        Create 3 BasicModel instances.\n        \"\"\"\n        items = ['foo', 'bar', 'baz', 'filtered out']\n        for item in items:\n            BasicModel(text=item).save()\n        self.objects = BasicModel.objects.exclude(text='filtered out')\n        self.data = [\n            {'id': obj.id, 'text': obj.text}\n            for obj in self.objects.all()\n        ]\n        self.view = InstanceView.as_view()\n        self.slug_based_view = SlugBasedInstanceView.as_view()\n\n    def test_get_instance_view(self):\n        \"\"\"\n        GET requests to RetrieveUpdateDestroyAPIView should return a single object.\n        \"\"\"\n        request = factory.get('/1')\n        with self.assertNumQueries(1):\n            response = self.view(request, pk=1).render()\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == self.data[0]\n\n    def test_post_instance_view(self):\n        \"\"\"\n        POST requests to RetrieveUpdateDestroyAPIView should not be allowed\n        \"\"\"\n        data = {'text': 'foobar'}\n        request = factory.post('/', data, format='json')\n        with self.assertNumQueries(0):\n            response = self.view(request).render()\n        assert response.status_code == status.HTTP_405_METHOD_NOT_ALLOWED\n        assert response.data == {\"detail\": 'Method \"POST\" not allowed.'}\n\n    def test_put_instance_view(self):\n        \"\"\"\n        PUT requests to RetrieveUpdateDestroyAPIView should update an object.\n        \"\"\"\n        data = {'text': 'foobar'}\n        request = factory.put('/1', data, format='json')\n        with self.assertNumQueries(EXPECTED_QUERIES_FOR_PUT):\n            response = self.view(request, pk='1').render()\n        assert response.status_code == status.HTTP_200_OK\n        assert dict(response.data) == {'id': 1, 'text': 'foobar'}\n        updated = self.objects.get(id=1)\n        assert updated.text == 'foobar'\n\n    def test_patch_instance_view(self):\n        \"\"\"\n        PATCH requests to RetrieveUpdateDestroyAPIView should update an object.\n        \"\"\"\n        data = {'text': 'foobar'}\n        request = factory.patch('/1', data, format='json')\n\n        with self.assertNumQueries(EXPECTED_QUERIES_FOR_PUT):\n            response = self.view(request, pk=1).render()\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {'id': 1, 'text': 'foobar'}\n        updated = self.objects.get(id=1)\n        assert updated.text == 'foobar'\n\n    def test_delete_instance_view(self):\n        \"\"\"\n        DELETE requests to RetrieveUpdateDestroyAPIView should delete an object.\n        \"\"\"\n        request = factory.delete('/1')\n        with self.assertNumQueries(2):\n            response = self.view(request, pk=1).render()\n        assert response.status_code == status.HTTP_204_NO_CONTENT\n        assert response.content == b''\n        ids = [obj.id for obj in self.objects.all()]\n        assert ids == [2, 3]\n\n    def test_get_instance_view_incorrect_arg(self):\n        \"\"\"\n        GET requests with an incorrect pk type, should raise 404, not 500.\n        Regression test for #890.\n        \"\"\"\n        request = factory.get('/a')\n        with self.assertNumQueries(0):\n            response = self.view(request, pk='a').render()\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n\n    def test_put_cannot_set_id(self):\n        \"\"\"\n        PUT requests to create a new object should not be able to set the id.\n        \"\"\"\n        data = {'id': 999, 'text': 'foobar'}\n        request = factory.put('/1', data, format='json')\n        with self.assertNumQueries(EXPECTED_QUERIES_FOR_PUT):\n            response = self.view(request, pk=1).render()\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {'id': 1, 'text': 'foobar'}\n        updated = self.objects.get(id=1)\n        assert updated.text == 'foobar'\n\n    def test_put_to_deleted_instance(self):\n        \"\"\"\n        PUT requests to RetrieveUpdateDestroyAPIView should return 404 if\n        an object does not currently exist.\n        \"\"\"\n        self.objects.get(id=1).delete()\n        data = {'text': 'foobar'}\n        request = factory.put('/1', data, format='json')\n        with self.assertNumQueries(1):\n            response = self.view(request, pk=1).render()\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n\n    def test_put_to_filtered_out_instance(self):\n        \"\"\"\n        PUT requests to an URL of instance which is filtered out should not be\n        able to create new objects.\n        \"\"\"\n        data = {'text': 'foo'}\n        filtered_out_pk = BasicModel.objects.filter(text='filtered out')[0].pk\n        request = factory.put(f'/{filtered_out_pk}', data, format='json')\n        response = self.view(request, pk=filtered_out_pk).render()\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n\n    def test_patch_cannot_create_an_object(self):\n        \"\"\"\n        PATCH requests should not be able to create objects.\n        \"\"\"\n        data = {'text': 'foobar'}\n        request = factory.patch('/999', data, format='json')\n        with self.assertNumQueries(1):\n            response = self.view(request, pk=999).render()\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n        assert not self.objects.filter(id=999).exists()\n\n    def test_put_error_instance_view(self):\n        \"\"\"\n        Incorrect PUT requests in HTML should include a form error.\n        \"\"\"\n        data = {'text': 'foobar' * 100}\n        request = factory.put('/', data, HTTP_ACCEPT='text/html')\n        response = self.view(request, pk=1).render()\n        expected_error = '<span class=\"help-block\">Ensure this field has no more than 100 characters.</span>'\n        assert expected_error in response.rendered_content.decode()\n\n\nclass TestFKInstanceView(TestCase):\n    def setUp(self):\n        \"\"\"\n        Create 3 BasicModel instances.\n        \"\"\"\n        items = ['foo', 'bar', 'baz']\n        for item in items:\n            t = ForeignKeyTarget(name=item)\n            t.save()\n            ForeignKeySource(name='source_' + item, target=t).save()\n\n        self.objects = ForeignKeySource.objects\n        self.data = [\n            {'id': obj.id, 'name': obj.name}\n            for obj in self.objects.all()\n        ]\n        self.view = FKInstanceView.as_view()\n\n\nclass TestOverriddenGetObject(TestCase):\n    \"\"\"\n    Test cases for a RetrieveUpdateDestroyAPIView that does NOT use the\n    queryset/model mechanism but instead overrides get_object()\n    \"\"\"\n\n    def setUp(self):\n        \"\"\"\n        Create 3 BasicModel instances.\n        \"\"\"\n        items = ['foo', 'bar', 'baz']\n        for item in items:\n            BasicModel(text=item).save()\n        self.objects = BasicModel.objects\n        self.data = [\n            {'id': obj.id, 'text': obj.text}\n            for obj in self.objects.all()\n        ]\n\n        class OverriddenGetObjectView(generics.RetrieveUpdateDestroyAPIView):\n            \"\"\"\n            Example detail view for override of get_object().\n            \"\"\"\n            serializer_class = BasicSerializer\n\n            def get_object(self):\n                pk = int(self.kwargs['pk'])\n                return get_object_or_404(BasicModel.objects.all(), id=pk)\n\n        self.view = OverriddenGetObjectView.as_view()\n\n    def test_overridden_get_object_view(self):\n        \"\"\"\n        GET requests to RetrieveUpdateDestroyAPIView should return a single object.\n        \"\"\"\n        request = factory.get('/1')\n        with self.assertNumQueries(1):\n            response = self.view(request, pk=1).render()\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == self.data[0]\n\n\n# Regression test for #285\n\nclass CommentSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = Comment\n        exclude = ('created',)\n\n\nclass CommentView(generics.ListCreateAPIView):\n    serializer_class = CommentSerializer\n    model = Comment\n\n\nclass TestCreateModelWithAutoNowAddField(TestCase):\n    def setUp(self):\n        self.objects = Comment.objects\n        self.view = CommentView.as_view()\n\n    def test_create_model_with_auto_now_add_field(self):\n        \"\"\"\n        Regression test for #285\n\n        https://github.com/encode/django-rest-framework/issues/285\n        \"\"\"\n        data = {'email': 'foobar@example.com', 'content': 'foobar'}\n        request = factory.post('/', data, format='json')\n        response = self.view(request).render()\n        assert response.status_code == status.HTTP_201_CREATED\n        created = self.objects.get(id=1)\n        assert created.content == 'foobar'\n\n\n# Test for particularly ugly regression with m2m in browsable API\nclass ClassB(models.Model):\n    name = models.CharField(max_length=255)\n\n\nclass ClassA(models.Model):\n    name = models.CharField(max_length=255)\n    children = models.ManyToManyField(ClassB, blank=True, null=True)\n\n\nclass ClassASerializer(serializers.ModelSerializer):\n    children = serializers.PrimaryKeyRelatedField(\n        many=True, queryset=ClassB.objects.all()\n    )\n\n    class Meta:\n        model = ClassA\n        fields = '__all__'\n\n\nclass ExampleView(generics.ListCreateAPIView):\n    serializer_class = ClassASerializer\n    queryset = ClassA.objects.all()\n\n\nclass TestM2MBrowsableAPI(TestCase):\n    def test_m2m_in_browsable_api(self):\n        \"\"\"\n        Test for particularly ugly regression with m2m in browsable API\n        \"\"\"\n        request = factory.get('/', HTTP_ACCEPT='text/html')\n        view = ExampleView().as_view()\n        response = view(request).render()\n        assert response.status_code == status.HTTP_200_OK\n\n\nclass InclusiveFilterBackend:\n    def filter_queryset(self, request, queryset, view):\n        return queryset.filter(text='foo')\n\n\nclass ExclusiveFilterBackend:\n    def filter_queryset(self, request, queryset, view):\n        return queryset.filter(text='other')\n\n\nclass TwoFieldModel(models.Model):\n    field_a = models.CharField(max_length=100)\n    field_b = models.CharField(max_length=100)\n\n\nclass DynamicSerializerView(generics.ListCreateAPIView):\n    queryset = TwoFieldModel.objects.all()\n    renderer_classes = (renderers.BrowsableAPIRenderer, renderers.JSONRenderer)\n\n    def get_serializer_class(self):\n        if self.request.method == 'POST':\n            class DynamicSerializer(serializers.ModelSerializer):\n                class Meta:\n                    model = TwoFieldModel\n                    fields = ('field_b',)\n        else:\n            class DynamicSerializer(serializers.ModelSerializer):\n                class Meta:\n                    model = TwoFieldModel\n                    fields = '__all__'\n        return DynamicSerializer\n\n\nclass TestFilterBackendAppliedToViews(TestCase):\n    def setUp(self):\n        \"\"\"\n        Create 3 BasicModel instances to filter on.\n        \"\"\"\n        items = ['foo', 'bar', 'baz']\n        for item in items:\n            BasicModel(text=item).save()\n        self.objects = BasicModel.objects\n        self.data = [\n            {'id': obj.id, 'text': obj.text}\n            for obj in self.objects.all()\n        ]\n\n    def test_get_root_view_filters_by_name_with_filter_backend(self):\n        \"\"\"\n        GET requests to ListCreateAPIView should return filtered list.\n        \"\"\"\n        root_view = RootView.as_view(filter_backends=(InclusiveFilterBackend,))\n        request = factory.get('/')\n        response = root_view(request).render()\n        assert response.status_code == status.HTTP_200_OK\n        assert len(response.data) == 1\n        assert response.data == [{'id': 1, 'text': 'foo'}]\n\n    def test_get_root_view_filters_out_all_models_with_exclusive_filter_backend(self):\n        \"\"\"\n        GET requests to ListCreateAPIView should return empty list when all models are filtered out.\n        \"\"\"\n        root_view = RootView.as_view(filter_backends=(ExclusiveFilterBackend,))\n        request = factory.get('/')\n        response = root_view(request).render()\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == []\n\n    def test_get_instance_view_filters_out_name_with_filter_backend(self):\n        \"\"\"\n        GET requests to RetrieveUpdateDestroyAPIView should raise 404 when model filtered out.\n        \"\"\"\n        instance_view = InstanceView.as_view(filter_backends=(ExclusiveFilterBackend,))\n        request = factory.get('/1')\n        response = instance_view(request, pk=1).render()\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n        assert response.data == {\n            'detail': ErrorDetail(\n                string='No BasicModel matches the given query.',\n                code='not_found'\n            )\n        }\n\n    def test_get_instance_view_will_return_single_object_when_filter_does_not_exclude_it(self):\n        \"\"\"\n        GET requests to RetrieveUpdateDestroyAPIView should return a single object when not excluded\n        \"\"\"\n        instance_view = InstanceView.as_view(filter_backends=(InclusiveFilterBackend,))\n        request = factory.get('/1')\n        response = instance_view(request, pk=1).render()\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {'id': 1, 'text': 'foo'}\n\n    def test_dynamic_serializer_form_in_browsable_api(self):\n        \"\"\"\n        GET requests to ListCreateAPIView should return filtered list.\n        \"\"\"\n        view = DynamicSerializerView.as_view()\n        request = factory.get('/')\n        response = view(request).render()\n        content = response.content.decode()\n        assert 'field_b' in content\n        assert 'field_a' not in content\n\n\nclass TestGuardedQueryset(TestCase):\n    def test_guarded_queryset(self):\n        class QuerysetAccessError(generics.ListAPIView):\n            queryset = BasicModel.objects.all()\n\n            def get(self, request):\n                return Response(list(self.queryset))\n\n        view = QuerysetAccessError.as_view()\n        request = factory.get('/')\n        with pytest.raises(RuntimeError):\n            view(request).render()\n\n\nclass ApiViewsTests(TestCase):\n\n    def test_create_api_view_post(self):\n        class MockCreateApiView(generics.CreateAPIView):\n            def create(self, request, *args, **kwargs):\n                self.called = True\n                self.call_args = (request, args, kwargs)\n        view = MockCreateApiView()\n        data = ('test request', ('test arg',), {'test_kwarg': 'test'})\n        view.post('test request', 'test arg', test_kwarg='test')\n        assert view.called is True\n        assert view.call_args == data\n\n    def test_destroy_api_view_delete(self):\n        class MockDestroyApiView(generics.DestroyAPIView):\n            def destroy(self, request, *args, **kwargs):\n                self.called = True\n                self.call_args = (request, args, kwargs)\n        view = MockDestroyApiView()\n        data = ('test request', ('test arg',), {'test_kwarg': 'test'})\n        view.delete('test request', 'test arg', test_kwarg='test')\n        assert view.called is True\n        assert view.call_args == data\n\n    def test_update_api_view_partial_update(self):\n        class MockUpdateApiView(generics.UpdateAPIView):\n            def partial_update(self, request, *args, **kwargs):\n                self.called = True\n                self.call_args = (request, args, kwargs)\n        view = MockUpdateApiView()\n        data = ('test request', ('test arg',), {'test_kwarg': 'test'})\n        view.patch('test request', 'test arg', test_kwarg='test')\n        assert view.called is True\n        assert view.call_args == data\n\n    def test_retrieve_update_api_view_get(self):\n        class MockRetrieveUpdateApiView(generics.RetrieveUpdateAPIView):\n            def retrieve(self, request, *args, **kwargs):\n                self.called = True\n                self.call_args = (request, args, kwargs)\n        view = MockRetrieveUpdateApiView()\n        data = ('test request', ('test arg',), {'test_kwarg': 'test'})\n        view.get('test request', 'test arg', test_kwarg='test')\n        assert view.called is True\n        assert view.call_args == data\n\n    def test_retrieve_update_api_view_put(self):\n        class MockRetrieveUpdateApiView(generics.RetrieveUpdateAPIView):\n            def update(self, request, *args, **kwargs):\n                self.called = True\n                self.call_args = (request, args, kwargs)\n        view = MockRetrieveUpdateApiView()\n        data = ('test request', ('test arg',), {'test_kwarg': 'test'})\n        view.put('test request', 'test arg', test_kwarg='test')\n        assert view.called is True\n        assert view.call_args == data\n\n    def test_retrieve_update_api_view_patch(self):\n        class MockRetrieveUpdateApiView(generics.RetrieveUpdateAPIView):\n            def partial_update(self, request, *args, **kwargs):\n                self.called = True\n                self.call_args = (request, args, kwargs)\n        view = MockRetrieveUpdateApiView()\n        data = ('test request', ('test arg',), {'test_kwarg': 'test'})\n        view.patch('test request', 'test arg', test_kwarg='test')\n        assert view.called is True\n        assert view.call_args == data\n\n    def test_retrieve_destroy_api_view_get(self):\n        class MockRetrieveDestroyUApiView(generics.RetrieveDestroyAPIView):\n            def retrieve(self, request, *args, **kwargs):\n                self.called = True\n                self.call_args = (request, args, kwargs)\n        view = MockRetrieveDestroyUApiView()\n        data = ('test request', ('test arg',), {'test_kwarg': 'test'})\n        view.get('test request', 'test arg', test_kwarg='test')\n        assert view.called is True\n        assert view.call_args == data\n\n    def test_retrieve_destroy_api_view_delete(self):\n        class MockRetrieveDestroyUApiView(generics.RetrieveDestroyAPIView):\n            def destroy(self, request, *args, **kwargs):\n                self.called = True\n                self.call_args = (request, args, kwargs)\n        view = MockRetrieveDestroyUApiView()\n        data = ('test request', ('test arg',), {'test_kwarg': 'test'})\n        view.delete('test request', 'test arg', test_kwarg='test')\n        assert view.called is True\n        assert view.call_args == data\n\n\nclass GetObjectOr404Tests(TestCase):\n    def setUp(self):\n        super().setUp()\n        self.uuid_object = UUIDForeignKeyTarget.objects.create(name='bar')\n\n    def test_get_object_or_404_with_valid_uuid(self):\n        obj = generics.get_object_or_404(\n            UUIDForeignKeyTarget, pk=self.uuid_object.pk\n        )\n        assert obj == self.uuid_object\n\n    def test_get_object_or_404_with_invalid_string_for_uuid(self):\n        with pytest.raises(Http404):\n            generics.get_object_or_404(UUIDForeignKeyTarget, pk='not-a-uuid')\n\n\nclass TestSerializer(TestCase):\n\n    def test_serializer_class_not_provided(self):\n        class NoSerializerClass(generics.GenericAPIView):\n            pass\n\n        with pytest.raises(AssertionError) as excinfo:\n            NoSerializerClass().get_serializer_class()\n\n        assert str(excinfo.value) == (\n            \"'NoSerializerClass' should either include a `serializer_class` \"\n            \"attribute, or override the `get_serializer_class()` method.\")\n\n    def test_given_context_not_overridden(self):\n        context = object()\n\n        class View(generics.ListAPIView):\n            serializer_class = serializers.Serializer\n\n            def list(self, request):\n                response = Response()\n                response.serializer = self.get_serializer(context=context)\n                return response\n\n        response = View.as_view()(factory.get('/'))\n        serializer = response.serializer\n\n        assert serializer.context is context\n\n\nclass TestTyping(TestCase):\n    def test_genericview_is_subscriptable(self):\n        assert generics.GenericAPIView is generics.GenericAPIView[\"foo\"]\n\n    def test_listview_is_subscriptable(self):\n        assert generics.ListAPIView is generics.ListAPIView[\"foo\"]\n\n    def test_instanceview_is_subscriptable(self):\n        assert generics.RetrieveAPIView is generics.RetrieveAPIView[\"foo\"]\n"
  },
  {
    "path": "tests/test_htmlrenderer.py",
    "content": "import django.template.loader\nimport pytest\nfrom django.core.exceptions import ImproperlyConfigured, PermissionDenied\nfrom django.http import Http404\nfrom django.template import TemplateDoesNotExist, engines\nfrom django.test import TestCase, override_settings\nfrom django.urls import path\n\nfrom rest_framework import status\nfrom rest_framework.decorators import api_view, renderer_classes\nfrom rest_framework.exceptions import ValidationError\nfrom rest_framework.renderers import TemplateHTMLRenderer\nfrom rest_framework.response import Response\n\n\n@api_view(('GET',))\n@renderer_classes((TemplateHTMLRenderer,))\ndef example(request):\n    \"\"\"\n    A view that can returns an HTML representation.\n    \"\"\"\n    data = {'object': 'foobar'}\n    return Response(data, template_name='example.html')\n\n\n@api_view(('GET',))\n@renderer_classes((TemplateHTMLRenderer,))\ndef permission_denied(request):\n    raise PermissionDenied()\n\n\n@api_view(('GET',))\n@renderer_classes((TemplateHTMLRenderer,))\ndef not_found(request):\n    raise Http404()\n\n\n@api_view(('GET',))\n@renderer_classes((TemplateHTMLRenderer,))\ndef validation_error(request):\n    raise ValidationError('error')\n\n\nurlpatterns = [\n    path('', example),\n    path('permission_denied', permission_denied),\n    path('not_found', not_found),\n    path('validation_error', validation_error),\n]\n\n\n@override_settings(ROOT_URLCONF='tests.test_htmlrenderer')\nclass TemplateHTMLRendererTests(TestCase):\n    def setUp(self):\n        class MockResponse:\n            template_name = None\n        self.mock_response = MockResponse()\n        self._monkey_patch_get_template()\n\n    def _monkey_patch_get_template(self):\n        \"\"\"\n        Monkeypatch get_template\n        \"\"\"\n        self.get_template = django.template.loader.get_template\n\n        def get_template(template_name, dirs=None):\n            if template_name == 'example.html':\n                return engines['django'].from_string(\"example: {{ object }}\")\n            raise TemplateDoesNotExist(template_name)\n\n        def select_template(template_name_list, dirs=None, using=None):\n            if template_name_list == ['example.html']:\n                return engines['django'].from_string(\"example: {{ object }}\")\n            raise TemplateDoesNotExist(template_name_list[0])\n\n        django.template.loader.get_template = get_template\n        django.template.loader.select_template = select_template\n\n    def tearDown(self):\n        \"\"\"\n        Revert monkeypatching\n        \"\"\"\n        django.template.loader.get_template = self.get_template\n\n    def test_simple_html_view(self):\n        response = self.client.get('/')\n        self.assertContains(response, \"example: foobar\")\n        self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')\n\n    def test_not_found_html_view(self):\n        response = self.client.get('/not_found')\n        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)\n        self.assertEqual(response.content, b\"404 Not Found\")\n        self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')\n\n    def test_permission_denied_html_view(self):\n        response = self.client.get('/permission_denied')\n        self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)\n        self.assertEqual(response.content, b\"403 Forbidden\")\n        self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')\n\n    def test_validation_error_html_view(self):\n        response = self.client.get('/validation_error')\n        self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n        self.assertEqual(response.content, b\"400 Bad Request\")\n        self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')\n\n    # 2 tests below are based on order of if statements in corresponding method\n    # of TemplateHTMLRenderer\n    def test_get_template_names_returns_own_template_name(self):\n        renderer = TemplateHTMLRenderer()\n        renderer.template_name = 'test_template'\n        template_name = renderer.get_template_names(self.mock_response, view={})\n        assert template_name == ['test_template']\n\n    def test_get_template_names_returns_view_template_name(self):\n        renderer = TemplateHTMLRenderer()\n\n        class MockResponse:\n            template_name = None\n\n        class MockView:\n            def get_template_names(self):\n                return ['template from get_template_names method']\n\n        class MockView2:\n            template_name = 'template from template_name attribute'\n\n        template_name = renderer.get_template_names(self.mock_response,\n                                                    MockView())\n        assert template_name == ['template from get_template_names method']\n\n        template_name = renderer.get_template_names(self.mock_response,\n                                                    MockView2())\n        assert template_name == ['template from template_name attribute']\n\n    def test_get_template_names_raises_error_if_no_template_found(self):\n        renderer = TemplateHTMLRenderer()\n        with pytest.raises(ImproperlyConfigured):\n            renderer.get_template_names(self.mock_response, view=object())\n\n\n@override_settings(ROOT_URLCONF='tests.test_htmlrenderer')\nclass TemplateHTMLRendererExceptionTests(TestCase):\n    def setUp(self):\n        \"\"\"\n        Monkeypatch get_template\n        \"\"\"\n        self.get_template = django.template.loader.get_template\n\n        def get_template(template_name):\n            if template_name == '404.html':\n                return engines['django'].from_string(\"404: {{ detail }}\")\n            if template_name == '403.html':\n                return engines['django'].from_string(\"403: {{ detail }}\")\n            raise TemplateDoesNotExist(template_name)\n\n        django.template.loader.get_template = get_template\n\n    def tearDown(self):\n        \"\"\"\n        Revert monkeypatching\n        \"\"\"\n        django.template.loader.get_template = self.get_template\n\n    def test_not_found_html_view_with_template(self):\n        response = self.client.get('/not_found')\n        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)\n        self.assertTrue(response.content in (\n            b\"404: Not found\", b\"404 Not Found\"))\n        self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')\n\n    def test_permission_denied_html_view_with_template(self):\n        response = self.client.get('/permission_denied')\n        self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)\n        self.assertTrue(response.content in (b\"403: Permission denied\", b\"403 Forbidden\"))\n        self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')\n"
  },
  {
    "path": "tests/test_lazy_hyperlinks.py",
    "content": "from django.db import models\nfrom django.test import TestCase, override_settings\nfrom django.urls import path\n\nfrom rest_framework import serializers\nfrom rest_framework.renderers import JSONRenderer\nfrom rest_framework.templatetags.rest_framework import format_value\n\nstr_called = False\n\n\nclass Example(models.Model):\n    text = models.CharField(max_length=100)\n\n    def __str__(self):\n        global str_called\n        str_called = True\n        return 'An example'\n\n\nclass ExampleSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = Example\n        fields = ('url', 'id', 'text')\n\n\ndef dummy_view(request):\n    pass\n\n\nurlpatterns = [\n    path('example/<int:pk>/', dummy_view, name='example-detail'),\n]\n\n\n@override_settings(ROOT_URLCONF='tests.test_lazy_hyperlinks')\nclass TestLazyHyperlinkNames(TestCase):\n    def setUp(self):\n        self.example = Example.objects.create(text='foo')\n\n    def test_lazy_hyperlink_names(self):\n        global str_called  # noqa: F824\n        context = {'request': None}\n        serializer = ExampleSerializer(self.example, context=context)\n        JSONRenderer().render(serializer.data)\n        assert not str_called\n        hyperlink_string = format_value(serializer.data['url'])\n        assert hyperlink_string == '<a href=/example/1/>An example</a>'\n        assert str_called\n"
  },
  {
    "path": "tests/test_metadata.py",
    "content": "import pytest\nfrom django.core.validators import MaxValueValidator, MinValueValidator\nfrom django.db import models\nfrom django.test import TestCase\n\nfrom rest_framework import (\n    exceptions, metadata, serializers, status, versioning, views\n)\nfrom rest_framework.renderers import BrowsableAPIRenderer\nfrom rest_framework.test import APIRequestFactory\n\nfrom .models import BasicModel\n\nrequest = APIRequestFactory().options('/')\n\n\nclass TestMetadata:\n\n    def test_determine_metadata_abstract_method_raises_proper_error(self):\n        with pytest.raises(NotImplementedError):\n            metadata.BaseMetadata().determine_metadata(None, None)\n\n    def test_metadata(self):\n        \"\"\"\n        OPTIONS requests to views should return a valid 200 response.\n        \"\"\"\n        class ExampleView(views.APIView):\n            \"\"\"Example view.\"\"\"\n            pass\n\n        view = ExampleView.as_view()\n        response = view(request=request)\n        expected = {\n            'name': 'Example',\n            'description': 'Example view.',\n            'renders': [\n                'application/json',\n                'text/html'\n            ],\n            'parses': [\n                'application/json',\n                'application/x-www-form-urlencoded',\n                'multipart/form-data'\n            ]\n        }\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == expected\n\n    def test_none_metadata(self):\n        \"\"\"\n        OPTIONS requests to views where `metadata_class = None` should raise\n        a MethodNotAllowed exception, which will result in an HTTP 405 response.\n        \"\"\"\n        class ExampleView(views.APIView):\n            metadata_class = None\n\n        view = ExampleView.as_view()\n        response = view(request=request)\n        assert response.status_code == status.HTTP_405_METHOD_NOT_ALLOWED\n        assert response.data == {'detail': 'Method \"OPTIONS\" not allowed.'}\n\n    def test_actions(self):\n        \"\"\"\n        On generic views OPTIONS should return an 'actions' key with metadata\n        on the fields that may be supplied to PUT and POST requests.\n        \"\"\"\n        class NestedField(serializers.Serializer):\n            a = serializers.IntegerField()\n            b = serializers.IntegerField()\n\n        class ExampleSerializer(serializers.Serializer):\n            choice_field = serializers.ChoiceField(['red', 'green', 'blue'])\n            integer_field = serializers.IntegerField(\n                min_value=1, max_value=1000\n            )\n            char_field = serializers.CharField(\n                required=False, min_length=3, max_length=40\n            )\n            list_field = serializers.ListField(\n                child=serializers.ListField(\n                    child=serializers.IntegerField()\n                )\n            )\n            nested_field = NestedField()\n            uuid_field = serializers.UUIDField(label=\"UUID field\")\n\n        class ExampleView(views.APIView):\n            \"\"\"Example view.\"\"\"\n            def post(self, request):\n                pass\n\n            def get_serializer(self):\n                return ExampleSerializer()\n\n        view = ExampleView.as_view()\n        response = view(request=request)\n        expected = {\n            'name': 'Example',\n            'description': 'Example view.',\n            'renders': [\n                'application/json',\n                'text/html'\n            ],\n            'parses': [\n                'application/json',\n                'application/x-www-form-urlencoded',\n                'multipart/form-data'\n            ],\n            'actions': {\n                'POST': {\n                    'choice_field': {\n                        'type': 'choice',\n                        'required': True,\n                        'read_only': False,\n                        'label': 'Choice field',\n                        'choices': [\n                            {'display_name': 'red', 'value': 'red'},\n                            {'display_name': 'green', 'value': 'green'},\n                            {'display_name': 'blue', 'value': 'blue'}\n                        ]\n                    },\n                    'integer_field': {\n                        'type': 'integer',\n                        'required': True,\n                        'read_only': False,\n                        'label': 'Integer field',\n                        'min_value': 1,\n                        'max_value': 1000,\n\n                    },\n                    'char_field': {\n                        'type': 'string',\n                        'required': False,\n                        'read_only': False,\n                        'label': 'Char field',\n                        'min_length': 3,\n                        'max_length': 40\n                    },\n                    'list_field': {\n                        'type': 'list',\n                        'required': True,\n                        'read_only': False,\n                        'label': 'List field',\n                        'child': {\n                            'type': 'list',\n                            'required': True,\n                            'read_only': False,\n                            'child': {\n                                'type': 'integer',\n                                'required': True,\n                                'read_only': False\n                            }\n                        }\n                    },\n                    'nested_field': {\n                        'type': 'nested object',\n                        'required': True,\n                        'read_only': False,\n                        'label': 'Nested field',\n                        'children': {\n                            'a': {\n                                'type': 'integer',\n                                'required': True,\n                                'read_only': False,\n                                'label': 'A'\n                            },\n                            'b': {\n                                'type': 'integer',\n                                'required': True,\n                                'read_only': False,\n                                'label': 'B'\n                            }\n                        }\n                    },\n                    'uuid_field': {\n                        \"type\": \"string\",\n                        \"required\": True,\n                        \"read_only\": False,\n                        \"label\": \"UUID field\",\n                    },\n                }\n            }\n        }\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == expected\n\n    def test_global_permissions(self):\n        \"\"\"\n        If a user does not have global permissions on an action, then any\n        metadata associated with it should not be included in OPTION responses.\n        \"\"\"\n        class ExampleSerializer(serializers.Serializer):\n            choice_field = serializers.ChoiceField(['red', 'green', 'blue'])\n            integer_field = serializers.IntegerField(max_value=10)\n            char_field = serializers.CharField(required=False)\n\n        class ExampleView(views.APIView):\n            \"\"\"Example view.\"\"\"\n            def post(self, request):\n                pass\n\n            def put(self, request):\n                pass\n\n            def get_serializer(self):\n                return ExampleSerializer()\n\n            def check_permissions(self, request):\n                if request.method == 'POST':\n                    raise exceptions.PermissionDenied()\n\n        view = ExampleView.as_view()\n        response = view(request=request)\n        assert response.status_code == status.HTTP_200_OK\n        assert list(response.data['actions']) == ['PUT']\n\n    def test_object_permissions(self):\n        \"\"\"\n        If a user does not have object permissions on an action, then any\n        metadata associated with it should not be included in OPTION responses.\n        \"\"\"\n        class ExampleSerializer(serializers.Serializer):\n            choice_field = serializers.ChoiceField(['red', 'green', 'blue'])\n            integer_field = serializers.IntegerField(max_value=10)\n            char_field = serializers.CharField(required=False)\n\n        class ExampleView(views.APIView):\n            \"\"\"Example view.\"\"\"\n            def post(self, request):\n                pass\n\n            def put(self, request):\n                pass\n\n            def get_serializer(self):\n                return ExampleSerializer()\n\n            def get_object(self):\n                if self.request.method == 'PUT':\n                    raise exceptions.PermissionDenied()\n\n        view = ExampleView.as_view()\n        response = view(request=request)\n        assert response.status_code == status.HTTP_200_OK\n        assert list(response.data['actions'].keys()) == ['POST']\n\n    def test_bug_2455_clone_request(self):\n        class ExampleView(views.APIView):\n            renderer_classes = (BrowsableAPIRenderer,)\n\n            def post(self, request):\n                pass\n\n            def get_serializer(self):\n                assert hasattr(self.request, 'version')\n                return serializers.Serializer()\n\n        view = ExampleView.as_view()\n        view(request=request)\n\n    def test_bug_2477_clone_request(self):\n        class ExampleView(views.APIView):\n            renderer_classes = (BrowsableAPIRenderer,)\n\n            def post(self, request):\n                pass\n\n            def get_serializer(self):\n                assert hasattr(self.request, 'versioning_scheme')\n                return serializers.Serializer()\n\n        scheme = versioning.QueryParameterVersioning\n        view = ExampleView.as_view(versioning_class=scheme)\n        view(request=request)\n\n    def test_dont_show_hidden_fields(self):\n        \"\"\"\n        HiddenField shouldn't show up in SimpleMetadata at all.\n        \"\"\"\n        class ExampleSerializer(serializers.Serializer):\n            integer_field = serializers.IntegerField(max_value=10)\n            hidden_field = serializers.HiddenField(default=1)\n\n        class ExampleView(views.APIView):\n            \"\"\"Example view.\"\"\"\n            def post(self, request):\n                pass\n\n            def get_serializer(self):\n                return ExampleSerializer()\n\n        view = ExampleView.as_view()\n        response = view(request=request)\n        assert response.status_code == status.HTTP_200_OK\n        assert set(response.data['actions']['POST'].keys()) == {'integer_field'}\n\n    def test_list_serializer_metadata_returns_info_about_fields_of_child_serializer(self):\n        class ExampleSerializer(serializers.Serializer):\n            integer_field = serializers.IntegerField(max_value=10)\n            char_field = serializers.CharField(required=False)\n\n        class ExampleListSerializer(serializers.ListSerializer):\n            pass\n\n        options = metadata.SimpleMetadata()\n        child_serializer = ExampleSerializer()\n        list_serializer = ExampleListSerializer(child=child_serializer)\n        assert options.get_serializer_info(list_serializer) == options.get_serializer_info(child_serializer)\n\n\nclass TestSimpleMetadataFieldInfo(TestCase):\n    def test_null_boolean_field_info_type(self):\n        options = metadata.SimpleMetadata()\n        field_info = options.get_field_info(serializers.BooleanField(\n            allow_null=True))\n        assert field_info['type'] == 'boolean'\n\n    def test_related_field_choices(self):\n        options = metadata.SimpleMetadata()\n        BasicModel.objects.create()\n        with self.assertNumQueries(0):\n            field_info = options.get_field_info(\n                serializers.RelatedField(queryset=BasicModel.objects.all())\n            )\n        assert 'choices' not in field_info\n\n    def test_decimal_field_info_type(self):\n        options = metadata.SimpleMetadata()\n        field_info = options.get_field_info(serializers.DecimalField(max_digits=18, decimal_places=4))\n        assert field_info['type'] == 'decimal'\n        assert field_info['max_digits'] == 18\n        assert field_info['decimal_places'] == 4\n\n\nclass TestModelSerializerMetadata(TestCase):\n    def test_read_only_primary_key_related_field(self):\n        \"\"\"\n        On generic views OPTIONS should return an 'actions' key with metadata\n        on the fields that may be supplied to PUT and POST requests. It should\n        not fail when a read_only PrimaryKeyRelatedField is present\n        \"\"\"\n        class Parent(models.Model):\n            integer_field = models.IntegerField(validators=[MinValueValidator(1), MaxValueValidator(1000)])\n            children = models.ManyToManyField('Child')\n            name = models.CharField(max_length=100, blank=True, null=True)\n\n        class Child(models.Model):\n            name = models.CharField(max_length=100)\n\n        class ExampleSerializer(serializers.ModelSerializer):\n            children = serializers.PrimaryKeyRelatedField(read_only=True, many=True)\n\n            class Meta:\n                model = Parent\n                fields = '__all__'\n\n        class ExampleView(views.APIView):\n            \"\"\"Example view.\"\"\"\n            def post(self, request):\n                pass\n\n            def get_serializer(self):\n                return ExampleSerializer()\n\n        view = ExampleView.as_view()\n        response = view(request=request)\n        expected = {\n            'name': 'Example',\n            'description': 'Example view.',\n            'renders': [\n                'application/json',\n                'text/html'\n            ],\n            'parses': [\n                'application/json',\n                'application/x-www-form-urlencoded',\n                'multipart/form-data'\n            ],\n            'actions': {\n                'POST': {\n                    'id': {\n                        'type': 'integer',\n                        'required': False,\n                        'read_only': True,\n                        'label': 'ID'\n                    },\n                    'children': {\n                        'type': 'field',\n                        'required': False,\n                        'read_only': True,\n                        'label': 'Children'\n                    },\n                    'integer_field': {\n                        'type': 'integer',\n                        'required': True,\n                        'read_only': False,\n                        'label': 'Integer field',\n                        'min_value': 1,\n                        'max_value': 1000\n                    },\n                    'name': {\n                        'type': 'string',\n                        'required': False,\n                        'read_only': False,\n                        'label': 'Name',\n                        'max_length': 100\n                    }\n                }\n            }\n        }\n\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == expected\n"
  },
  {
    "path": "tests/test_middleware.py",
    "content": "import unittest\n\nimport django\nfrom django.contrib.auth.models import User\nfrom django.http import HttpRequest\nfrom django.test import override_settings\nfrom django.urls import include, path\n\nfrom rest_framework import status\nfrom rest_framework.authentication import TokenAuthentication\nfrom rest_framework.authtoken.models import Token\nfrom rest_framework.decorators import action, api_view\nfrom rest_framework.request import is_form_media_type\nfrom rest_framework.response import Response\nfrom rest_framework.routers import SimpleRouter\nfrom rest_framework.test import APITestCase\nfrom rest_framework.views import APIView\nfrom rest_framework.viewsets import GenericViewSet\n\n\nclass PostView(APIView):\n    def post(self, request):\n        return Response(data=request.data, status=200)\n\n\nclass GetAPIView(APIView):\n    def get(self, request):\n        return Response(data=\"OK\", status=200)\n\n\n@api_view(['GET'])\ndef get_func_view(request):\n    return Response(data=\"OK\", status=200)\n\n\nclass ListViewSet(GenericViewSet):\n\n    def list(self, request, *args, **kwargs):\n        response = Response()\n        response.view = self\n        return response\n\n    @action(detail=False, url_path='list-action')\n    def list_action(self, request, *args, **kwargs):\n        response = Response()\n        response.view = self\n        return response\n\n\nrouter = SimpleRouter()\nrouter.register(r'view-set', ListViewSet, basename='view_set')\n\nurlpatterns = [\n    path('auth', APIView.as_view(authentication_classes=(TokenAuthentication,))),\n    path('post', PostView.as_view()),\n    path('get', GetAPIView.as_view()),\n    path('get-func', get_func_view),\n    path('api/', include(router.urls)),\n]\n\n\nclass RequestUserMiddleware:\n    def __init__(self, get_response):\n        self.get_response = get_response\n\n    def __call__(self, request):\n        response = self.get_response(request)\n        assert hasattr(request, 'user'), '`user` is not set on request'\n        assert request.user.is_authenticated, '`user` is not authenticated'\n\n        return response\n\n\nclass RequestPOSTMiddleware:\n    def __init__(self, get_response):\n        self.get_response = get_response\n\n    def __call__(self, request):\n        assert isinstance(request, HttpRequest)\n\n        # Parse body with underlying Django request\n        request.body\n\n        # Process request with DRF view\n        response = self.get_response(request)\n\n        # Ensure request.POST is set as appropriate\n        if is_form_media_type(request.content_type):\n            assert request.POST == {'foo': ['bar']}\n        else:\n            assert request.POST == {}\n\n        return response\n\n\n@override_settings(ROOT_URLCONF='tests.test_middleware')\nclass TestMiddleware(APITestCase):\n\n    @override_settings(MIDDLEWARE=('tests.test_middleware.RequestUserMiddleware',))\n    def test_middleware_can_access_user_when_processing_response(self):\n        user = User.objects.create_user('john', 'john@example.com', 'password')\n        key = 'abcd1234'\n        Token.objects.create(key=key, user=user)\n\n        self.client.get('/auth', HTTP_AUTHORIZATION='Token %s' % key)\n\n    @override_settings(MIDDLEWARE=('tests.test_middleware.RequestPOSTMiddleware',))\n    def test_middleware_can_access_request_post_when_processing_response(self):\n        response = self.client.post('/post', {'foo': 'bar'})\n        assert response.status_code == 200\n\n        response = self.client.post('/post', {'foo': 'bar'}, format='json')\n        assert response.status_code == 200\n\n\n@unittest.skipUnless(django.VERSION >= (5, 1), 'Only for Django 5.1+')\n@override_settings(\n    ROOT_URLCONF='tests.test_middleware',\n    MIDDLEWARE=(\n        # Needed for AuthenticationMiddleware\n        'django.contrib.sessions.middleware.SessionMiddleware',\n        # Needed for LoginRequiredMiddleware\n        'django.contrib.auth.middleware.AuthenticationMiddleware',\n        'django.contrib.auth.middleware.LoginRequiredMiddleware',\n    ),\n)\nclass TestLoginRequiredMiddlewareCompat(APITestCase):\n    \"\"\"\n    Django's 5.1+ LoginRequiredMiddleware should NOT apply to DRF views.\n\n    Instead, users should put IsAuthenticated in their\n    DEFAULT_PERMISSION_CLASSES setting.\n    \"\"\"\n    def test_class_based_view(self):\n        response = self.client.get('/get')\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_function_based_view(self):\n        response = self.client.get('/get-func')\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_viewset_list(self):\n        response = self.client.get('/api/view-set/')\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_viewset_list_action(self):\n        response = self.client.get('/api/view-set/list-action/')\n        assert response.status_code == status.HTTP_200_OK\n"
  },
  {
    "path": "tests/test_model_serializer.py",
    "content": "\"\"\"\nThe `ModelSerializer` and `HyperlinkedModelSerializer` classes are essentially\nshortcuts for automatically creating serializers based on a given model class.\n\nThese tests deal with ensuring that we correctly map the model fields onto\nan appropriate set of serializer fields for each case.\n\"\"\"\nimport datetime\nimport decimal\nimport json  # noqa\nimport re\nimport sys\nimport tempfile\n\nimport pytest\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.serializers.json import DjangoJSONEncoder\nfrom django.core.validators import (\n    MaxValueValidator, MinLengthValidator, MinValueValidator\n)\nfrom django.db import models\nfrom django.db.models.signals import m2m_changed\nfrom django.dispatch import receiver\nfrom django.test import TestCase\n\nfrom rest_framework import serializers\nfrom rest_framework.compat import postgres_fields\n\nfrom .models import NestedForeignKeySource\n\n\ndef dedent(blocktext):\n    return '\\n'.join([line[12:] for line in blocktext.splitlines()[1:-1]])\n\n\n# Tests for regular field mappings.\n# ---------------------------------\n\nclass CustomField(models.Field):\n    \"\"\"\n    A custom model field simply for testing purposes.\n    \"\"\"\n    pass\n\n\nclass OneFieldModel(models.Model):\n    char_field = models.CharField(max_length=100)\n\n\nclass RegularFieldsModel(models.Model):\n    \"\"\"\n    A model class for testing regular flat fields.\n    \"\"\"\n    auto_field = models.AutoField(primary_key=True)\n    big_integer_field = models.BigIntegerField()\n    boolean_field = models.BooleanField(default=False)\n    char_field = models.CharField(max_length=100)\n    comma_separated_integer_field = models.CommaSeparatedIntegerField(max_length=100)\n    date_field = models.DateField()\n    datetime_field = models.DateTimeField()\n    decimal_field = models.DecimalField(max_digits=3, decimal_places=1)\n    email_field = models.EmailField(max_length=100)\n    float_field = models.FloatField()\n    integer_field = models.IntegerField()\n    null_boolean_field = models.BooleanField(null=True, default=False)\n    positive_integer_field = models.PositiveIntegerField()\n    positive_small_integer_field = models.PositiveSmallIntegerField()\n    slug_field = models.SlugField(max_length=100)\n    small_integer_field = models.SmallIntegerField()\n    text_field = models.TextField(max_length=100)\n    file_field = models.FileField(max_length=100)\n    time_field = models.TimeField()\n    url_field = models.URLField(max_length=100)\n    custom_field = CustomField()\n    file_path_field = models.FilePathField(path=tempfile.gettempdir())\n\n    def method(self):\n        return 'method'\n\n\nCOLOR_CHOICES = (('red', 'Red'), ('blue', 'Blue'), ('green', 'Green'))\nDECIMAL_CHOICES = (('low', decimal.Decimal('0.1')), ('medium', decimal.Decimal('0.5')), ('high', decimal.Decimal('0.9')))\n\n\nclass FieldOptionsModel(models.Model):\n    value_limit_field = models.IntegerField(validators=[MinValueValidator(1), MaxValueValidator(10)])\n    length_limit_field = models.CharField(validators=[MinLengthValidator(3)], max_length=12)\n    blank_field = models.CharField(blank=True, max_length=10)\n    null_field = models.IntegerField(null=True)\n    default_field = models.IntegerField(default=0)\n    descriptive_field = models.IntegerField(help_text='Some help text', verbose_name='A label')\n    choices_field = models.CharField(max_length=100, choices=COLOR_CHOICES)\n    text_choices_field = models.TextField(choices=COLOR_CHOICES)\n\n\nclass ChoicesModel(models.Model):\n    choices_field_with_nonstandard_args = models.DecimalField(max_digits=3, decimal_places=1, choices=DECIMAL_CHOICES, verbose_name='A label')\n\n\nclass Issue3674ParentModel(models.Model):\n    title = models.CharField(max_length=64)\n\n\nclass Issue3674ChildModel(models.Model):\n    parent = models.ForeignKey(Issue3674ParentModel, related_name='children', on_delete=models.CASCADE)\n    value = models.CharField(primary_key=True, max_length=64)\n\n\nclass UniqueChoiceModel(models.Model):\n    CHOICES = (\n        ('choice1', 'choice 1'),\n        ('choice2', 'choice 1'),\n    )\n\n    name = models.CharField(max_length=254, unique=True, choices=CHOICES)\n\n\nclass TestModelSerializer(TestCase):\n    def test_create_method(self):\n        class TestSerializer(serializers.ModelSerializer):\n            non_model_field = serializers.CharField()\n\n            class Meta:\n                model = OneFieldModel\n                fields = ('char_field', 'non_model_field')\n\n        serializer = TestSerializer(data={\n            'char_field': 'foo',\n            'non_model_field': 'bar',\n        })\n        serializer.is_valid()\n\n        msginitial = 'Got a `TypeError` when calling `OneFieldModel.objects.create()`.'\n        with self.assertRaisesMessage(TypeError, msginitial):\n            serializer.save()\n\n    def test_abstract_model(self):\n        \"\"\"\n        Test that trying to use ModelSerializer with Abstract Models\n        throws a ValueError exception.\n        \"\"\"\n        class AbstractModel(models.Model):\n            afield = models.CharField(max_length=255)\n\n            class Meta:\n                abstract = True\n\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = AbstractModel\n                fields = ('afield',)\n\n        serializer = TestSerializer(data={\n            'afield': 'foo',\n        })\n\n        msginitial = 'Cannot use ModelSerializer with Abstract Models.'\n        with self.assertRaisesMessage(ValueError, msginitial):\n            serializer.is_valid()\n\n\nclass TestRegularFieldMappings(TestCase):\n    @pytest.mark.skipif(sys.platform.startswith(\"win\"), reason=\"Test not supported on Windows\")\n    def test_regular_fields(self):\n        \"\"\"\n        Model fields should map to their equivalent serializer fields.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RegularFieldsModel\n                fields = '__all__'\n\n        expected = dedent(r\"\"\"\n            TestSerializer\\(\\):\n                auto_field = IntegerField\\(read_only=True\\)\n                big_integer_field = BigIntegerField\\(.*\\)\n                boolean_field = BooleanField\\(required=False\\)\n                char_field = CharField\\(max_length=100\\)\n                comma_separated_integer_field = CharField\\(max_length=100, validators=\\[<django.core.validators.RegexValidator object>\\]\\)\n                date_field = DateField\\(\\)\n                datetime_field = DateTimeField\\(\\)\n                decimal_field = DecimalField\\(decimal_places=1, max_digits=3\\)\n                email_field = EmailField\\(max_length=100\\)\n                float_field = FloatField\\(\\)\n                integer_field = IntegerField\\(.*\\)\n                null_boolean_field = BooleanField\\(allow_null=True, required=False\\)\n                positive_integer_field = IntegerField\\(.*\\)\n                positive_small_integer_field = IntegerField\\(.*\\)\n                slug_field = SlugField\\(allow_unicode=False, max_length=100\\)\n                small_integer_field = IntegerField\\(.*\\)\n                text_field = CharField\\(max_length=100, style={'base_template': 'textarea.html'}\\)\n                file_field = FileField\\(max_length=100\\)\n                time_field = TimeField\\(\\)\n                url_field = URLField\\(max_length=100\\)\n                custom_field = ModelField\\(model_field=<tests.test_model_serializer.CustomField: custom_field>\\)\n                file_path_field = FilePathField\\(path=%r\\)\n        \"\"\" % tempfile.gettempdir())\n        assert re.search(expected, repr(TestSerializer())) is not None\n\n    def test_field_options(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = FieldOptionsModel\n                fields = '__all__'\n\n        expected = dedent(r\"\"\"\n            TestSerializer\\(\\):\n                id = IntegerField\\(label='ID', read_only=True\\)\n                value_limit_field = IntegerField\\(max_value=10, min_value=1\\)\n                length_limit_field = CharField\\(max_length=12, min_length=3\\)\n                blank_field = CharField\\(allow_blank=True, max_length=10, required=False\\)\n                null_field = IntegerField\\(allow_null=True,.*required=False\\)\n                default_field = IntegerField\\(.*required=False\\)\n                descriptive_field = IntegerField\\(help_text='Some help text', label='A label'.*\\)\n                choices_field = ChoiceField\\(choices=(?:\\[|\\()\\('red', 'Red'\\), \\('blue', 'Blue'\\), \\('green', 'Green'\\)(?:\\]|\\))\\)\n                text_choices_field = ChoiceField\\(choices=(?:\\[|\\()\\('red', 'Red'\\), \\('blue', 'Blue'\\), \\('green', 'Green'\\)(?:\\]|\\))\\)\n        \"\"\")\n        assert re.search(expected, repr(TestSerializer())) is not None\n\n    def test_nullable_boolean_field_choices(self):\n        class NullableBooleanChoicesModel(models.Model):\n            CHECKLIST_OPTIONS = (\n                (None, 'Unknown'),\n                (True, 'Yes'),\n                (False, 'No'),\n            )\n\n            field = models.BooleanField(null=True, choices=CHECKLIST_OPTIONS)\n\n        class NullableBooleanChoicesSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = NullableBooleanChoicesModel\n                fields = ['field']\n\n        serializer = NullableBooleanChoicesSerializer(data=dict(\n            field=None,\n        ))\n        self.assertTrue(serializer.is_valid())\n        self.assertEqual(serializer.errors, {})\n\n    def test_method_field(self):\n        \"\"\"\n        Properties and methods on the model should be allowed as `Meta.fields`\n        values, and should map to `ReadOnlyField`.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RegularFieldsModel\n                fields = ('auto_field', 'method')\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                auto_field = IntegerField(read_only=True)\n                method = ReadOnlyField()\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_pk_fields(self):\n        \"\"\"\n        Both `pk` and the actual primary key name are valid in `Meta.fields`.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RegularFieldsModel\n                fields = ('pk', 'auto_field')\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                pk = IntegerField(label='Auto field', read_only=True)\n                auto_field = IntegerField(read_only=True)\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_extra_field_kwargs(self):\n        \"\"\"\n        Ensure `extra_kwargs` are passed to generated fields.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RegularFieldsModel\n                fields = ('auto_field', 'char_field')\n                extra_kwargs = {'char_field': {'default': 'extra'}}\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                auto_field = IntegerField(read_only=True)\n                char_field = CharField(default='extra', max_length=100)\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_extra_field_kwargs_required(self):\n        \"\"\"\n        Ensure `extra_kwargs` are passed to generated fields.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RegularFieldsModel\n                fields = ('auto_field', 'char_field')\n                extra_kwargs = {'auto_field': {'required': False, 'read_only': False}}\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                auto_field = IntegerField(read_only=False, required=False)\n                char_field = CharField(max_length=100)\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_invalid_field(self):\n        \"\"\"\n        Field names that do not map to a model field or relationship should\n        raise a configuration error.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RegularFieldsModel\n                fields = ('auto_field', 'invalid')\n\n        expected = 'Field name `invalid` is not valid for model `RegularFieldsModel` ' \\\n                   'in `tests.test_model_serializer.TestSerializer`.'\n        with self.assertRaisesMessage(ImproperlyConfigured, expected):\n            TestSerializer().fields\n\n    def test_missing_field(self):\n        \"\"\"\n        Fields that have been declared on the serializer class must be included\n        in the `Meta.fields` if it exists.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            missing = serializers.ReadOnlyField()\n\n            class Meta:\n                model = RegularFieldsModel\n                fields = ('auto_field',)\n\n        expected = (\n            \"The field 'missing' was declared on serializer TestSerializer, \"\n            \"but has not been included in the 'fields' option.\"\n        )\n        with self.assertRaisesMessage(AssertionError, expected):\n            TestSerializer().fields\n\n    def test_missing_superclass_field(self):\n        \"\"\"\n        Fields that have been declared on a parent of the serializer class may\n        be excluded from the `Meta.fields` option.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            missing = serializers.ReadOnlyField()\n\n        class ChildSerializer(TestSerializer):\n            class Meta:\n                model = RegularFieldsModel\n                fields = ('auto_field',)\n\n        ChildSerializer().fields\n\n    def test_choices_with_nonstandard_args(self):\n        class ExampleSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = ChoicesModel\n                fields = '__all__'\n\n        ExampleSerializer()\n\n\nclass TestDurationFieldMapping(TestCase):\n    def test_duration_field(self):\n        class DurationFieldModel(models.Model):\n            \"\"\"\n            A model that defines DurationField.\n            \"\"\"\n            duration_field = models.DurationField()\n\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = DurationFieldModel\n                fields = '__all__'\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                duration_field = DurationField()\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_duration_field_with_validators(self):\n        class ValidatedDurationFieldModel(models.Model):\n            \"\"\"\n            A model that defines DurationField with validators.\n            \"\"\"\n            duration_field = models.DurationField(\n                validators=[MinValueValidator(datetime.timedelta(days=1)), MaxValueValidator(datetime.timedelta(days=3))]\n            )\n\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = ValidatedDurationFieldModel\n                fields = '__all__'\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                duration_field = DurationField(max_value=datetime.timedelta(days=3), min_value=datetime.timedelta(days=1))\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n\nclass TestGenericIPAddressFieldValidation(TestCase):\n    def test_ip_address_validation(self):\n        class IPAddressFieldModel(models.Model):\n            address = models.GenericIPAddressField()\n\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = IPAddressFieldModel\n                fields = '__all__'\n\n        s = TestSerializer(data={'address': 'not an ip address'})\n        self.assertFalse(s.is_valid())\n        self.assertEqual(1, len(s.errors['address']),\n                         'Unexpected number of validation errors: '\n                         '{}'.format(s.errors))\n\n\n@pytest.mark.skipif('not postgres_fields')\nclass TestPosgresFieldsMapping(TestCase):\n    def test_hstore_field(self):\n        class HStoreFieldModel(models.Model):\n            hstore_field = postgres_fields.HStoreField()\n\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = HStoreFieldModel\n                fields = ['hstore_field']\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                hstore_field = HStoreField()\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_array_field(self):\n        class ArrayFieldModel(models.Model):\n            array_field = postgres_fields.ArrayField(base_field=models.CharField())\n            array_field_with_blank = postgres_fields.ArrayField(blank=True, base_field=models.CharField())\n\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = ArrayFieldModel\n                fields = ['array_field', 'array_field_with_blank']\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                array_field = ListField(allow_empty=False, child=CharField(label='Array field'))\n                array_field_with_blank = ListField(child=CharField(label='Array field with blank'), required=False)\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    @pytest.mark.skipif(hasattr(models, 'JSONField'), reason='has models.JSONField')\n    def test_json_field(self):\n        class JSONFieldModel(models.Model):\n            json_field = postgres_fields.JSONField()\n            json_field_with_encoder = postgres_fields.JSONField(encoder=DjangoJSONEncoder)\n\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = JSONFieldModel\n                fields = ['json_field', 'json_field_with_encoder']\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                json_field = JSONField(encoder=None, style={'base_template': 'textarea.html'})\n                json_field_with_encoder = JSONField(encoder=<class 'django.core.serializers.json.DjangoJSONEncoder'>, style={'base_template': 'textarea.html'})\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n\nclass CustomJSONDecoder(json.JSONDecoder):\n    pass\n\n\n@pytest.mark.skipif(not hasattr(models, 'JSONField'), reason='no models.JSONField')\nclass TestDjangoJSONFieldMapping(TestCase):\n    def test_json_field(self):\n        class JSONFieldModel(models.Model):\n            json_field = models.JSONField()\n            json_field_with_encoder = models.JSONField(encoder=DjangoJSONEncoder, decoder=CustomJSONDecoder)\n\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = JSONFieldModel\n                fields = ['json_field', 'json_field_with_encoder']\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                json_field = JSONField(decoder=None, encoder=None, style={'base_template': 'textarea.html'})\n                json_field_with_encoder = JSONField(decoder=<class 'tests.test_model_serializer.CustomJSONDecoder'>, encoder=<class 'django.core.serializers.json.DjangoJSONEncoder'>, style={'base_template': 'textarea.html'})\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n\n# Tests for relational field mappings.\n# ------------------------------------\n\nclass ForeignKeyTargetModel(models.Model):\n    name = models.CharField(max_length=100)\n\n\nclass ManyToManyTargetModel(models.Model):\n    name = models.CharField(max_length=100)\n\n\nclass OneToOneTargetModel(models.Model):\n    name = models.CharField(max_length=100)\n\n\nclass ThroughTargetModel(models.Model):\n    name = models.CharField(max_length=100)\n\n\nclass Supplementary(models.Model):\n    extra = models.IntegerField()\n    forwards = models.ForeignKey('ThroughTargetModel', on_delete=models.CASCADE)\n    backwards = models.ForeignKey('RelationalModel', on_delete=models.CASCADE)\n\n\nclass RelationalModel(models.Model):\n    foreign_key = models.ForeignKey(ForeignKeyTargetModel, related_name='reverse_foreign_key', on_delete=models.CASCADE)\n    many_to_many = models.ManyToManyField(ManyToManyTargetModel, related_name='reverse_many_to_many')\n    one_to_one = models.OneToOneField(OneToOneTargetModel, related_name='reverse_one_to_one', on_delete=models.CASCADE)\n    through = models.ManyToManyField(ThroughTargetModel, through=Supplementary, related_name='reverse_through')\n\n\nclass UniqueTogetherModel(models.Model):\n    foreign_key = models.ForeignKey(ForeignKeyTargetModel, related_name='unique_foreign_key', on_delete=models.CASCADE)\n    one_to_one = models.OneToOneField(OneToOneTargetModel, related_name='unique_one_to_one', on_delete=models.CASCADE)\n\n    class Meta:\n        unique_together = (\"foreign_key\", \"one_to_one\")\n\n\nclass TestRelationalFieldMappings(TestCase):\n    def test_pk_relations(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RelationalModel\n                fields = '__all__'\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                foreign_key = PrimaryKeyRelatedField(queryset=ForeignKeyTargetModel.objects.all())\n                one_to_one = PrimaryKeyRelatedField(queryset=OneToOneTargetModel.objects.all(), validators=[<UniqueValidator(queryset=RelationalModel.objects.all())>])\n                many_to_many = PrimaryKeyRelatedField(allow_empty=False, many=True, queryset=ManyToManyTargetModel.objects.all())\n                through = PrimaryKeyRelatedField(many=True, read_only=True)\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_nested_relations(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RelationalModel\n                depth = 1\n                fields = '__all__'\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                foreign_key = NestedSerializer(read_only=True):\n                    id = IntegerField(label='ID', read_only=True)\n                    name = CharField(max_length=100)\n                one_to_one = NestedSerializer(read_only=True):\n                    id = IntegerField(label='ID', read_only=True)\n                    name = CharField(max_length=100)\n                many_to_many = NestedSerializer(many=True, read_only=True):\n                    id = IntegerField(label='ID', read_only=True)\n                    name = CharField(max_length=100)\n                through = NestedSerializer(many=True, read_only=True):\n                    id = IntegerField(label='ID', read_only=True)\n                    name = CharField(max_length=100)\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_hyperlinked_relations(self):\n        class TestSerializer(serializers.HyperlinkedModelSerializer):\n            class Meta:\n                model = RelationalModel\n                fields = '__all__'\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                url = HyperlinkedIdentityField(view_name='relationalmodel-detail')\n                foreign_key = HyperlinkedRelatedField(queryset=ForeignKeyTargetModel.objects.all(), view_name='foreignkeytargetmodel-detail')\n                one_to_one = HyperlinkedRelatedField(queryset=OneToOneTargetModel.objects.all(), validators=[<UniqueValidator(queryset=RelationalModel.objects.all())>], view_name='onetoonetargetmodel-detail')\n                many_to_many = HyperlinkedRelatedField(allow_empty=False, many=True, queryset=ManyToManyTargetModel.objects.all(), view_name='manytomanytargetmodel-detail')\n                through = HyperlinkedRelatedField(many=True, read_only=True, view_name='throughtargetmodel-detail')\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_nested_hyperlinked_relations(self):\n        class TestSerializer(serializers.HyperlinkedModelSerializer):\n            class Meta:\n                model = RelationalModel\n                depth = 1\n                fields = '__all__'\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                url = HyperlinkedIdentityField(view_name='relationalmodel-detail')\n                foreign_key = NestedSerializer(read_only=True):\n                    url = HyperlinkedIdentityField(view_name='foreignkeytargetmodel-detail')\n                    name = CharField(max_length=100)\n                one_to_one = NestedSerializer(read_only=True):\n                    url = HyperlinkedIdentityField(view_name='onetoonetargetmodel-detail')\n                    name = CharField(max_length=100)\n                many_to_many = NestedSerializer(many=True, read_only=True):\n                    url = HyperlinkedIdentityField(view_name='manytomanytargetmodel-detail')\n                    name = CharField(max_length=100)\n                through = NestedSerializer(many=True, read_only=True):\n                    url = HyperlinkedIdentityField(view_name='throughtargetmodel-detail')\n                    name = CharField(max_length=100)\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_nested_hyperlinked_relations_starred_source(self):\n        class TestSerializer(serializers.HyperlinkedModelSerializer):\n            class Meta:\n                model = RelationalModel\n                depth = 1\n                fields = '__all__'\n\n                extra_kwargs = {\n                    'url': {\n                        'source': '*',\n                    }}\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                url = HyperlinkedIdentityField(source='*', view_name='relationalmodel-detail')\n                foreign_key = NestedSerializer(read_only=True):\n                    url = HyperlinkedIdentityField(view_name='foreignkeytargetmodel-detail')\n                    name = CharField(max_length=100)\n                one_to_one = NestedSerializer(read_only=True):\n                    url = HyperlinkedIdentityField(view_name='onetoonetargetmodel-detail')\n                    name = CharField(max_length=100)\n                many_to_many = NestedSerializer(many=True, read_only=True):\n                    url = HyperlinkedIdentityField(view_name='manytomanytargetmodel-detail')\n                    name = CharField(max_length=100)\n                through = NestedSerializer(many=True, read_only=True):\n                    url = HyperlinkedIdentityField(view_name='throughtargetmodel-detail')\n                    name = CharField(max_length=100)\n        \"\"\")\n        self.maxDiff = None\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_nested_unique_together_relations(self):\n        class TestSerializer(serializers.HyperlinkedModelSerializer):\n            class Meta:\n                model = UniqueTogetherModel\n                depth = 1\n                fields = '__all__'\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                url = HyperlinkedIdentityField(view_name='uniquetogethermodel-detail')\n                foreign_key = NestedSerializer(read_only=True):\n                    url = HyperlinkedIdentityField(view_name='foreignkeytargetmodel-detail')\n                    name = CharField(max_length=100)\n                one_to_one = NestedSerializer(read_only=True):\n                    url = HyperlinkedIdentityField(view_name='onetoonetargetmodel-detail')\n                    name = CharField(max_length=100)\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_pk_reverse_foreign_key(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = ForeignKeyTargetModel\n                fields = ('id', 'name', 'reverse_foreign_key')\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                name = CharField(max_length=100)\n                reverse_foreign_key = PrimaryKeyRelatedField(many=True, queryset=RelationalModel.objects.all())\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_pk_reverse_one_to_one(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = OneToOneTargetModel\n                fields = ('id', 'name', 'reverse_one_to_one')\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                name = CharField(max_length=100)\n                reverse_one_to_one = PrimaryKeyRelatedField(queryset=RelationalModel.objects.all())\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_pk_reverse_many_to_many(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = ManyToManyTargetModel\n                fields = ('id', 'name', 'reverse_many_to_many')\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                name = CharField(max_length=100)\n                reverse_many_to_many = PrimaryKeyRelatedField(many=True, queryset=RelationalModel.objects.all())\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n    def test_pk_reverse_through(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = ThroughTargetModel\n                fields = ('id', 'name', 'reverse_through')\n\n        expected = dedent(\"\"\"\n            TestSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                name = CharField(max_length=100)\n                reverse_through = PrimaryKeyRelatedField(many=True, read_only=True)\n        \"\"\")\n        self.assertEqual(repr(TestSerializer()), expected)\n\n\nclass DisplayValueTargetModel(models.Model):\n    name = models.CharField(max_length=100)\n\n    def __str__(self):\n        return '%s Color' % (self.name)\n\n\nclass DisplayValueModel(models.Model):\n    color = models.ForeignKey(DisplayValueTargetModel, on_delete=models.CASCADE)\n\n\nclass TestRelationalFieldDisplayValue(TestCase):\n    def setUp(self):\n        DisplayValueTargetModel.objects.bulk_create([\n            DisplayValueTargetModel(name='Red'),\n            DisplayValueTargetModel(name='Yellow'),\n            DisplayValueTargetModel(name='Green'),\n        ])\n\n    def test_default_display_value(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = DisplayValueModel\n                fields = '__all__'\n\n        serializer = TestSerializer()\n        expected = {1: 'Red Color', 2: 'Yellow Color', 3: 'Green Color'}\n        self.assertEqual(serializer.fields['color'].choices, expected)\n\n    def test_custom_display_value(self):\n        class TestField(serializers.PrimaryKeyRelatedField):\n            def display_value(self, instance):\n                return 'My %s Color' % (instance.name)\n\n        class TestSerializer(serializers.ModelSerializer):\n            color = TestField(queryset=DisplayValueTargetModel.objects.all())\n\n            class Meta:\n                model = DisplayValueModel\n                fields = '__all__'\n\n        serializer = TestSerializer()\n        expected = {1: 'My Red Color', 2: 'My Yellow Color', 3: 'My Green Color'}\n        self.assertEqual(serializer.fields['color'].choices, expected)\n\n\nclass TestIntegration(TestCase):\n    def setUp(self):\n        self.foreign_key_target = ForeignKeyTargetModel.objects.create(\n            name='foreign_key'\n        )\n        self.one_to_one_target = OneToOneTargetModel.objects.create(\n            name='one_to_one'\n        )\n        self.many_to_many_targets = [\n            ManyToManyTargetModel.objects.create(\n                name='many_to_many (%d)' % idx\n            ) for idx in range(3)\n        ]\n        self.instance = RelationalModel.objects.create(\n            foreign_key=self.foreign_key_target,\n            one_to_one=self.one_to_one_target,\n        )\n        self.instance.many_to_many.set(self.many_to_many_targets)\n\n    def test_pk_retrieval(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RelationalModel\n                fields = '__all__'\n\n        serializer = TestSerializer(self.instance)\n        expected = {\n            'id': self.instance.pk,\n            'foreign_key': self.foreign_key_target.pk,\n            'one_to_one': self.one_to_one_target.pk,\n            'many_to_many': [item.pk for item in self.many_to_many_targets],\n            'through': []\n        }\n        self.assertEqual(serializer.data, expected)\n\n    def test_pk_create(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RelationalModel\n                fields = '__all__'\n\n        new_foreign_key = ForeignKeyTargetModel.objects.create(\n            name='foreign_key'\n        )\n        new_one_to_one = OneToOneTargetModel.objects.create(\n            name='one_to_one'\n        )\n        new_many_to_many = [\n            ManyToManyTargetModel.objects.create(\n                name='new many_to_many (%d)' % idx\n            ) for idx in range(3)\n        ]\n        data = {\n            'foreign_key': new_foreign_key.pk,\n            'one_to_one': new_one_to_one.pk,\n            'many_to_many': [item.pk for item in new_many_to_many],\n        }\n\n        # Serializer should validate okay.\n        serializer = TestSerializer(data=data)\n        assert serializer.is_valid()\n\n        # Creating the instance, relationship attributes should be set.\n        instance = serializer.save()\n        assert instance.foreign_key.pk == new_foreign_key.pk\n        assert instance.one_to_one.pk == new_one_to_one.pk\n        assert [\n            item.pk for item in instance.many_to_many.all()\n        ] == [\n            item.pk for item in new_many_to_many\n        ]\n        assert list(instance.through.all()) == []\n\n        # Representation should be correct.\n        expected = {\n            'id': instance.pk,\n            'foreign_key': new_foreign_key.pk,\n            'one_to_one': new_one_to_one.pk,\n            'many_to_many': [item.pk for item in new_many_to_many],\n            'through': []\n        }\n        self.assertEqual(serializer.data, expected)\n\n    def test_pk_update(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = RelationalModel\n                fields = '__all__'\n\n        new_foreign_key = ForeignKeyTargetModel.objects.create(\n            name='foreign_key'\n        )\n        new_one_to_one = OneToOneTargetModel.objects.create(\n            name='one_to_one'\n        )\n        new_many_to_many = [\n            ManyToManyTargetModel.objects.create(\n                name='new many_to_many (%d)' % idx\n            ) for idx in range(3)\n        ]\n        data = {\n            'foreign_key': new_foreign_key.pk,\n            'one_to_one': new_one_to_one.pk,\n            'many_to_many': [item.pk for item in new_many_to_many],\n        }\n\n        # Serializer should validate okay.\n        serializer = TestSerializer(self.instance, data=data)\n        assert serializer.is_valid()\n\n        # Creating the instance, relationship attributes should be set.\n        instance = serializer.save()\n        assert instance.foreign_key.pk == new_foreign_key.pk\n        assert instance.one_to_one.pk == new_one_to_one.pk\n        assert [\n            item.pk for item in instance.many_to_many.all()\n        ] == [\n            item.pk for item in new_many_to_many\n        ]\n        assert list(instance.through.all()) == []\n\n        # Representation should be correct.\n        expected = {\n            'id': self.instance.pk,\n            'foreign_key': new_foreign_key.pk,\n            'one_to_one': new_one_to_one.pk,\n            'many_to_many': [item.pk for item in new_many_to_many],\n            'through': []\n        }\n        self.assertEqual(serializer.data, expected)\n\n\n# Tests for bulk create using `ListSerializer`.\n\nclass BulkCreateModel(models.Model):\n    name = models.CharField(max_length=10)\n\n\nclass TestBulkCreate(TestCase):\n    def test_bulk_create(self):\n        class BasicModelSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = BulkCreateModel\n                fields = ('name',)\n\n        class BulkCreateSerializer(serializers.ListSerializer):\n            child = BasicModelSerializer()\n\n        data = [{'name': 'a'}, {'name': 'b'}, {'name': 'c'}]\n        serializer = BulkCreateSerializer(data=data)\n        assert serializer.is_valid()\n\n        # Objects are returned by save().\n        instances = serializer.save()\n        assert len(instances) == 3\n        assert [item.name for item in instances] == ['a', 'b', 'c']\n\n        # Objects have been created in the database.\n        assert BulkCreateModel.objects.count() == 3\n        assert list(BulkCreateModel.objects.values_list('name', flat=True)) == ['a', 'b', 'c']\n\n        # Serializer returns correct data.\n        assert serializer.data == data\n\n\nclass MetaClassTestModel(models.Model):\n    text = models.CharField(max_length=100)\n\n\nclass TestSerializerMetaClass(TestCase):\n    def test_meta_class_fields_option(self):\n        class ExampleSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = MetaClassTestModel\n                fields = 'text'\n\n        msginitial = \"The `fields` option must be a list or tuple\"\n        with self.assertRaisesMessage(TypeError, msginitial):\n            ExampleSerializer().fields\n\n    def test_meta_class_exclude_option(self):\n        class ExampleSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = MetaClassTestModel\n                exclude = 'text'\n\n        msginitial = \"The `exclude` option must be a list or tuple\"\n        with self.assertRaisesMessage(TypeError, msginitial):\n            ExampleSerializer().fields\n\n    def test_meta_class_fields_and_exclude_options(self):\n        class ExampleSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = MetaClassTestModel\n                fields = ('text',)\n                exclude = ('text',)\n\n        msginitial = \"Cannot set both 'fields' and 'exclude' options on serializer ExampleSerializer.\"\n        with self.assertRaisesMessage(AssertionError, msginitial):\n            ExampleSerializer().fields\n\n    def test_declared_fields_with_exclude_option(self):\n        class ExampleSerializer(serializers.ModelSerializer):\n            text = serializers.CharField()\n\n            class Meta:\n                model = MetaClassTestModel\n                exclude = ('text',)\n\n        expected = (\n            \"Cannot both declare the field 'text' and include it in the \"\n            \"ExampleSerializer 'exclude' option. Remove the field or, if \"\n            \"inherited from a parent serializer, disable with `text = None`.\"\n        )\n        with self.assertRaisesMessage(AssertionError, expected):\n            ExampleSerializer().fields\n\n\nclass Issue2704TestCase(TestCase):\n    def test_queryset_all(self):\n        class TestSerializer(serializers.ModelSerializer):\n            additional_attr = serializers.CharField()\n\n            class Meta:\n                model = OneFieldModel\n                fields = ('char_field', 'additional_attr')\n\n        OneFieldModel.objects.create(char_field='abc')\n        qs = OneFieldModel.objects.all()\n\n        for o in qs:\n            o.additional_attr = '123'\n\n        serializer = TestSerializer(instance=qs, many=True)\n\n        expected = [{\n            'char_field': 'abc',\n            'additional_attr': '123',\n        }]\n\n        assert serializer.data == expected\n\n\nclass Issue7550FooModel(models.Model):\n    text = models.CharField(max_length=100)\n    bar = models.ForeignKey(\n        'Issue7550BarModel', null=True, blank=True, on_delete=models.SET_NULL,\n        related_name='foos', related_query_name='foo')\n\n\nclass Issue7550BarModel(models.Model):\n    pass\n\n\nclass Issue7550TestCase(TestCase):\n\n    def test_dotted_source(self):\n\n        class _FooSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = Issue7550FooModel\n                fields = ('id', 'text')\n\n        class FooSerializer(serializers.ModelSerializer):\n            other_foos = _FooSerializer(source='bar.foos', many=True)\n\n            class Meta:\n                model = Issue7550BarModel\n                fields = ('id', 'other_foos')\n\n        bar = Issue7550BarModel.objects.create()\n        foo_a = Issue7550FooModel.objects.create(bar=bar, text='abc')\n        foo_b = Issue7550FooModel.objects.create(bar=bar, text='123')\n\n        assert FooSerializer(foo_a).data == {\n            'id': foo_a.id,\n            'other_foos': [\n                {\n                    'id': foo_a.id,\n                    'text': foo_a.text,\n                },\n                {\n                    'id': foo_b.id,\n                    'text': foo_b.text,\n                },\n            ],\n        }\n\n    def test_dotted_source_with_default(self):\n\n        class _FooSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = Issue7550FooModel\n                fields = ('id', 'text')\n\n        class FooSerializer(serializers.ModelSerializer):\n            other_foos = _FooSerializer(source='bar.foos', default=[], many=True)\n\n            class Meta:\n                model = Issue7550FooModel\n                fields = ('id', 'other_foos')\n\n        foo = Issue7550FooModel.objects.create(bar=None, text='abc')\n\n        assert FooSerializer(foo).data == {\n            'id': foo.id,\n            'other_foos': [],\n        }\n\n\nclass DecimalFieldModel(models.Model):\n    decimal_field = models.DecimalField(\n        max_digits=3,\n        decimal_places=1,\n        validators=[MinValueValidator(1), MaxValueValidator(3)]\n    )\n\n\nclass TestDecimalFieldMappings(TestCase):\n    def test_decimal_field_has_decimal_validator(self):\n        \"\"\"\n        Test that a `DecimalField` has no `DecimalValidator`.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = DecimalFieldModel\n                fields = '__all__'\n\n        serializer = TestSerializer()\n\n        assert len(serializer.fields['decimal_field'].validators) == 2\n\n    def test_min_value_is_passed(self):\n        \"\"\"\n        Test that the `MinValueValidator` is converted to the `min_value`\n        argument for the field.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = DecimalFieldModel\n                fields = '__all__'\n\n        serializer = TestSerializer()\n\n        assert serializer.fields['decimal_field'].min_value == 1\n\n    def test_max_value_is_passed(self):\n        \"\"\"\n        Test that the `MaxValueValidator` is converted to the `max_value`\n        argument for the field.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = DecimalFieldModel\n                fields = '__all__'\n\n        serializer = TestSerializer()\n\n        assert serializer.fields['decimal_field'].max_value == 3\n\n\nclass TestMetaInheritance(TestCase):\n    def test_extra_kwargs_not_altered(self):\n        class TestSerializer(serializers.ModelSerializer):\n            non_model_field = serializers.CharField()\n\n            class Meta:\n                model = OneFieldModel\n                read_only_fields = ('char_field', 'non_model_field')\n                fields = read_only_fields\n                extra_kwargs = {}\n\n        class ChildSerializer(TestSerializer):\n            class Meta(TestSerializer.Meta):\n                read_only_fields = ()\n\n        test_expected = dedent(\"\"\"\n            TestSerializer():\n                char_field = CharField(read_only=True)\n                non_model_field = CharField()\n        \"\"\")\n\n        child_expected = dedent(\"\"\"\n            ChildSerializer():\n                char_field = CharField(max_length=100)\n                non_model_field = CharField()\n        \"\"\")\n        self.assertEqual(repr(ChildSerializer()), child_expected)\n        self.assertEqual(repr(TestSerializer()), test_expected)\n        self.assertEqual(repr(ChildSerializer()), child_expected)\n\n\nclass OneToOneTargetTestModel(models.Model):\n    text = models.CharField(max_length=100)\n\n\nclass OneToOneSourceTestModel(models.Model):\n    target = models.OneToOneField(OneToOneTargetTestModel, primary_key=True, on_delete=models.CASCADE)\n\n\nclass TestModelFieldValues(TestCase):\n    def test_model_field(self):\n        class ExampleSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = OneToOneSourceTestModel\n                fields = ('target',)\n\n        target = OneToOneTargetTestModel(id=1, text='abc')\n        source = OneToOneSourceTestModel(target=target)\n        serializer = ExampleSerializer(source)\n        self.assertEqual(serializer.data, {'target': 1})\n\n\nclass TestUniquenessOverride(TestCase):\n    def test_required_not_overwritten(self):\n        class TestModel(models.Model):\n            field_1 = models.IntegerField(null=True)\n            field_2 = models.IntegerField()\n\n            class Meta:\n                unique_together = (('field_1', 'field_2'),)\n\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = TestModel\n                fields = '__all__'\n                extra_kwargs = {'field_1': {'required': False}}\n\n        fields = TestSerializer().fields\n        self.assertFalse(fields['field_1'].required)\n        self.assertTrue(fields['field_2'].required)\n\n\nclass Issue3674Test(TestCase):\n    def test_nonPK_foreignkey_model_serializer(self):\n        class TestParentModel(models.Model):\n            title = models.CharField(max_length=64)\n\n        class TestChildModel(models.Model):\n            parent = models.ForeignKey(TestParentModel, related_name='children', on_delete=models.CASCADE)\n            value = models.CharField(primary_key=True, max_length=64)\n\n        class TestChildModelSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = TestChildModel\n                fields = ('value', 'parent')\n\n        class TestParentModelSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = TestParentModel\n                fields = ('id', 'title', 'children')\n\n        parent_expected = dedent(\"\"\"\n            TestParentModelSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                title = CharField(max_length=64)\n                children = PrimaryKeyRelatedField(many=True, queryset=TestChildModel.objects.all())\n        \"\"\")\n        self.assertEqual(repr(TestParentModelSerializer()), parent_expected)\n\n        child_expected = dedent(\"\"\"\n            TestChildModelSerializer():\n                value = CharField(max_length=64, validators=[<UniqueValidator(queryset=TestChildModel.objects.all())>])\n                parent = PrimaryKeyRelatedField(queryset=TestParentModel.objects.all())\n        \"\"\")\n        self.assertEqual(repr(TestChildModelSerializer()), child_expected)\n\n    def test_nonID_PK_foreignkey_model_serializer(self):\n\n        class TestChildModelSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = Issue3674ChildModel\n                fields = ('value', 'parent')\n\n        class TestParentModelSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = Issue3674ParentModel\n                fields = ('id', 'title', 'children')\n\n        parent = Issue3674ParentModel.objects.create(title='abc')\n        child = Issue3674ChildModel.objects.create(value='def', parent=parent)\n\n        parent_serializer = TestParentModelSerializer(parent)\n        child_serializer = TestChildModelSerializer(child)\n\n        parent_expected = {'children': ['def'], 'id': 1, 'title': 'abc'}\n        self.assertEqual(parent_serializer.data, parent_expected)\n\n        child_expected = {'parent': 1, 'value': 'def'}\n        self.assertEqual(child_serializer.data, child_expected)\n\n\nclass Issue4897TestCase(TestCase):\n    def test_should_assert_if_writing_readonly_fields(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = OneFieldModel\n                fields = ('char_field',)\n                readonly_fields = fields\n\n        obj = OneFieldModel.objects.create(char_field='abc')\n\n        with pytest.raises(AssertionError) as cm:\n            TestSerializer(obj).fields\n        cm.match(r'readonly_fields')\n\n\nclass Test5004UniqueChoiceField(TestCase):\n    def test_unique_choice_field(self):\n        class TestUniqueChoiceSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = UniqueChoiceModel\n                fields = '__all__'\n\n        UniqueChoiceModel.objects.create(name='choice1')\n        serializer = TestUniqueChoiceSerializer(data={'name': 'choice1'})\n        assert not serializer.is_valid()\n        assert serializer.errors == {'name': ['unique choice model with this name already exists.']}\n\n\nclass TestFieldSource(TestCase):\n    def test_traverse_nullable_fk(self):\n        \"\"\"\n        A dotted source with nullable elements uses default when any item in the chain is None. #5849.\n\n        Similar to model example from test_serializer.py `test_default_for_multiple_dotted_source` method,\n        but using RelatedField, rather than CharField.\n        \"\"\"\n        class TestSerializer(serializers.ModelSerializer):\n            target = serializers.PrimaryKeyRelatedField(\n                source='target.target', read_only=True, allow_null=True, default=None\n            )\n\n            class Meta:\n                model = NestedForeignKeySource\n                fields = ('target', )\n\n        model = NestedForeignKeySource.objects.create()\n        assert TestSerializer(model).data['target'] is None\n\n    def test_named_field_source(self):\n        class TestSerializer(serializers.ModelSerializer):\n\n            class Meta:\n                model = RegularFieldsModel\n                fields = ('number_field',)\n                extra_kwargs = {\n                    'number_field': {\n                        'source': 'integer_field'\n                    }\n                }\n\n        expected = dedent(r\"\"\"\n            TestSerializer\\(\\):\n                number_field = IntegerField\\(.*source='integer_field'\\)\n        \"\"\")\n        self.maxDiff = None\n        assert re.search(expected, repr(TestSerializer())) is not None\n\n\nclass Issue6110TestModel(models.Model):\n    \"\"\"Model without .objects manager.\"\"\"\n\n    name = models.CharField(max_length=64)\n    all_objects = models.Manager()\n\n\nclass Issue6110ModelSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = Issue6110TestModel\n        fields = ('name',)\n\n\nclass Issue6110Test(TestCase):\n    def test_model_serializer_custom_manager(self):\n        instance = Issue6110ModelSerializer().create({'name': 'test_name'})\n        self.assertEqual(instance.name, 'test_name')\n\n    def test_model_serializer_custom_manager_error_message(self):\n        msginitial = ('Got a `TypeError` when calling `Issue6110TestModel.all_objects.create()`.')\n        with self.assertRaisesMessage(TypeError, msginitial):\n            Issue6110ModelSerializer().create({'wrong_param': 'wrong_param'})\n\n\nclass Issue6751Model(models.Model):\n    many_to_many = models.ManyToManyField(ManyToManyTargetModel, related_name='+')\n    char_field = models.CharField(max_length=100)\n    char_field2 = models.CharField(max_length=100)\n\n\n@receiver(m2m_changed, sender=Issue6751Model.many_to_many.through)\ndef process_issue6751model_m2m_changed(action, instance, **_):\n    if action == 'post_add':\n        instance.char_field = 'value changed by signal'\n        instance.save()\n\n\nclass Issue6751Test(TestCase):\n    def test_model_serializer_save_m2m_after_instance(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = Issue6751Model\n                fields = (\n                    'many_to_many',\n                    'char_field',\n                )\n\n        instance = Issue6751Model.objects.create(char_field='initial value')\n        m2m_target = ManyToManyTargetModel.objects.create(name='target')\n\n        serializer = TestSerializer(\n            instance=instance,\n            data={\n                'many_to_many': (m2m_target.id,),\n                'char_field': 'will be changed by signal',\n            }\n        )\n\n        serializer.is_valid()\n        serializer.save()\n\n        self.assertEqual(instance.char_field, 'value changed by signal')\n"
  },
  {
    "path": "tests/test_multitable_inheritance.py",
    "content": "from django.db import models\nfrom django.test import TestCase\n\nfrom rest_framework import serializers\nfrom tests.models import RESTFrameworkModel\n\n\n# Models\nclass ParentModel(RESTFrameworkModel):\n    name1 = models.CharField(max_length=100)\n\n\nclass ChildModel(ParentModel):\n    name2 = models.CharField(max_length=100)\n\n\nclass AssociatedModel(RESTFrameworkModel):\n    ref = models.OneToOneField(ParentModel, primary_key=True, on_delete=models.CASCADE)\n    name = models.CharField(max_length=100)\n\n\n# Serializers\nclass DerivedModelSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = ChildModel\n        fields = '__all__'\n\n\nclass AssociatedModelSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = AssociatedModel\n        fields = '__all__'\n\n\n# Tests\nclass InheritedModelSerializationTests(TestCase):\n\n    def test_multitable_inherited_model_fields_as_expected(self):\n        \"\"\"\n        Assert that the parent pointer field is not included in the fields\n        serialized fields\n        \"\"\"\n        child = ChildModel(name1='parent name', name2='child name')\n        serializer = DerivedModelSerializer(child)\n        assert set(serializer.data) == {'name1', 'name2', 'id'}\n\n    def test_onetoone_primary_key_model_fields_as_expected(self):\n        \"\"\"\n        Assert that a model with a onetoone field that is the primary key is\n        not treated like a derived model\n        \"\"\"\n        parent = ParentModel.objects.create(name1='parent name')\n        associate = AssociatedModel.objects.create(name='hello', ref=parent)\n        serializer = AssociatedModelSerializer(associate)\n        assert set(serializer.data) == {'name', 'ref'}\n\n    def test_data_is_valid_without_parent_ptr(self):\n        \"\"\"\n        Assert that the pointer to the parent table is not a required field\n        for input data\n        \"\"\"\n        data = {\n            'name1': 'parent name',\n            'name2': 'child name',\n        }\n        serializer = DerivedModelSerializer(data=data)\n        assert serializer.is_valid() is True\n"
  },
  {
    "path": "tests/test_negotiation.py",
    "content": "import pytest\nfrom django.http import Http404\nfrom django.test import TestCase\n\nfrom rest_framework.negotiation import (\n    BaseContentNegotiation, DefaultContentNegotiation\n)\nfrom rest_framework.renderers import BaseRenderer\nfrom rest_framework.request import Request\nfrom rest_framework.test import APIRequestFactory\nfrom rest_framework.utils.mediatypes import _MediaType\n\nfactory = APIRequestFactory()\n\n\nclass MockOpenAPIRenderer(BaseRenderer):\n    media_type = 'application/openapi+json;version=2.0'\n    format = 'swagger'\n\n\nclass MockJSONRenderer(BaseRenderer):\n    media_type = 'application/json'\n\n\nclass MockHTMLRenderer(BaseRenderer):\n    media_type = 'text/html'\n\n\nclass NoCharsetSpecifiedRenderer(BaseRenderer):\n    media_type = 'my/media'\n\n\nclass TestAcceptedMediaType(TestCase):\n    def setUp(self):\n        self.renderers = [MockJSONRenderer(), MockHTMLRenderer(), MockOpenAPIRenderer()]\n        self.negotiator = DefaultContentNegotiation()\n\n    def select_renderer(self, request):\n        return self.negotiator.select_renderer(request, self.renderers)\n\n    def test_client_without_accept_use_renderer(self):\n        request = Request(factory.get('/'))\n        accepted_renderer, accepted_media_type = self.select_renderer(request)\n        assert accepted_media_type == 'application/json'\n\n    def test_client_underspecifies_accept_use_renderer(self):\n        request = Request(factory.get('/', HTTP_ACCEPT='*/*'))\n        accepted_renderer, accepted_media_type = self.select_renderer(request)\n        assert accepted_media_type == 'application/json'\n\n    def test_client_overspecifies_accept_use_client(self):\n        request = Request(factory.get('/', HTTP_ACCEPT='application/json; indent=8'))\n        accepted_renderer, accepted_media_type = self.select_renderer(request)\n        assert accepted_media_type == 'application/json; indent=8'\n\n    def test_client_specifies_parameter(self):\n        request = Request(factory.get('/', HTTP_ACCEPT='application/openapi+json;version=2.0'))\n        accepted_renderer, accepted_media_type = self.select_renderer(request)\n        assert accepted_media_type == 'application/openapi+json;version=2.0'\n        assert accepted_renderer.format == 'swagger'\n\n    def test_match_is_false_if_main_types_not_match(self):\n        mediatype = _MediaType('test_1')\n        another_mediatype = _MediaType('test_2')\n        assert mediatype.match(another_mediatype) is False\n\n    def test_mediatype_match_is_false_if_keys_not_match(self):\n        mediatype = _MediaType(';test_param=foo')\n        another_mediatype = _MediaType(';test_param=bar')\n        assert mediatype.match(another_mediatype) is False\n\n    def test_mediatype_precedence_with_wildcard_subtype(self):\n        mediatype = _MediaType('test/*')\n        assert mediatype.precedence == 1\n\n    def test_mediatype_string_representation(self):\n        mediatype = _MediaType('test/*; foo=bar')\n        assert str(mediatype) == 'test/*; foo=bar'\n\n    def test_raise_error_if_no_suitable_renderers_found(self):\n        class MockRenderer:\n            format = 'xml'\n        renderers = [MockRenderer()]\n        with pytest.raises(Http404):\n            self.negotiator.filter_renderers(renderers, format='json')\n\n\nclass BaseContentNegotiationTests(TestCase):\n\n    def setUp(self):\n        self.negotiator = BaseContentNegotiation()\n\n    def test_raise_error_for_abstract_select_parser_method(self):\n        with pytest.raises(NotImplementedError):\n            self.negotiator.select_parser(None, None)\n\n    def test_raise_error_for_abstract_select_renderer_method(self):\n        with pytest.raises(NotImplementedError):\n            self.negotiator.select_renderer(None, None)\n"
  },
  {
    "path": "tests/test_one_to_one_with_inheritance.py",
    "content": "from django.db import models\nfrom django.test import TestCase\n\nfrom rest_framework import serializers\nfrom tests.models import RESTFrameworkModel\n# Models\nfrom tests.test_multitable_inheritance import ChildModel\n\n\n# Regression test for #4290\nclass ChildAssociatedModel(RESTFrameworkModel):\n    child_model = models.OneToOneField(ChildModel, on_delete=models.CASCADE)\n    child_name = models.CharField(max_length=100)\n\n\n# Serializers\nclass DerivedModelSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = ChildModel\n        fields = ['id', 'name1', 'name2', 'childassociatedmodel']\n\n\nclass ChildAssociatedModelSerializer(serializers.ModelSerializer):\n\n    class Meta:\n        model = ChildAssociatedModel\n        fields = ['id', 'child_name']\n\n\n# Tests\nclass InheritedModelSerializationTests(TestCase):\n\n    def test_multitable_inherited_model_fields_as_expected(self):\n        \"\"\"\n        Assert that the parent pointer field is not included in the fields\n        serialized fields\n        \"\"\"\n        child = ChildModel(name1='parent name', name2='child name')\n        serializer = DerivedModelSerializer(child)\n        self.assertEqual(set(serializer.data),\n                         {'name1', 'name2', 'id', 'childassociatedmodel'})\n"
  },
  {
    "path": "tests/test_pagination.py",
    "content": "import pytest\nfrom django.core.paginator import Paginator as DjangoPaginator\nfrom django.db import models\nfrom django.test import TestCase\n\nfrom rest_framework import (\n    exceptions, filters, generics, pagination, serializers, status\n)\nfrom rest_framework.pagination import PAGE_BREAK, PageLink\nfrom rest_framework.request import Request\nfrom rest_framework.test import APIRequestFactory\n\nfactory = APIRequestFactory()\n\n\nclass TestPaginationIntegration:\n    \"\"\"\n    Integration tests.\n    \"\"\"\n\n    def setup_method(self):\n        class PassThroughSerializer(serializers.BaseSerializer):\n            def to_representation(self, item):\n                return item\n\n        class EvenItemsOnly(filters.BaseFilterBackend):\n            def filter_queryset(self, request, queryset, view):\n                return [item for item in queryset if item % 2 == 0]\n\n        class BasicPagination(pagination.PageNumberPagination):\n            page_size = 5\n            page_size_query_param = 'page_size'\n            max_page_size = 20\n\n        self.view = generics.ListAPIView.as_view(\n            serializer_class=PassThroughSerializer,\n            queryset=range(1, 101),\n            filter_backends=[EvenItemsOnly],\n            pagination_class=BasicPagination\n        )\n\n    def test_filtered_items_are_paginated(self):\n        request = factory.get('/', {'page': 2})\n        response = self.view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {\n            'results': [12, 14, 16, 18, 20],\n            'previous': 'http://testserver/',\n            'next': 'http://testserver/?page=3',\n            'count': 50\n        }\n\n    def test_setting_page_size(self):\n        \"\"\"\n        When 'paginate_by_param' is set, the client may choose a page size.\n        \"\"\"\n        request = factory.get('/', {'page_size': 10})\n        response = self.view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {\n            'results': [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],\n            'previous': None,\n            'next': 'http://testserver/?page=2&page_size=10',\n            'count': 50\n        }\n\n    def test_setting_page_size_over_maximum(self):\n        \"\"\"\n        When page_size parameter exceeds maximum allowable,\n        then it should be capped to the maximum.\n        \"\"\"\n        request = factory.get('/', {'page_size': 1000})\n        response = self.view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {\n            'results': [\n                2, 4, 6, 8, 10, 12, 14, 16, 18, 20,\n                22, 24, 26, 28, 30, 32, 34, 36, 38, 40\n            ],\n            'previous': None,\n            'next': 'http://testserver/?page=2&page_size=1000',\n            'count': 50\n        }\n\n    def test_setting_page_size_to_zero(self):\n        \"\"\"\n        When page_size parameter is invalid it should return to the default.\n        \"\"\"\n        request = factory.get('/', {'page_size': 0})\n        response = self.view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {\n            'results': [2, 4, 6, 8, 10],\n            'previous': None,\n            'next': 'http://testserver/?page=2&page_size=0',\n            'count': 50\n        }\n\n    def test_additional_query_params_are_preserved(self):\n        request = factory.get('/', {'page': 2, 'filter': 'even'})\n        response = self.view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {\n            'results': [12, 14, 16, 18, 20],\n            'previous': 'http://testserver/?filter=even',\n            'next': 'http://testserver/?filter=even&page=3',\n            'count': 50\n        }\n\n    def test_empty_query_params_are_preserved(self):\n        request = factory.get('/', {'page': 2, 'filter': ''})\n        response = self.view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {\n            'results': [12, 14, 16, 18, 20],\n            'previous': 'http://testserver/?filter=',\n            'next': 'http://testserver/?filter=&page=3',\n            'count': 50\n        }\n\n    def test_404_not_found_for_zero_page(self):\n        request = factory.get('/', {'page': '0'})\n        response = self.view(request)\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n        assert response.data == {\n            'detail': 'Invalid page.'\n        }\n\n    def test_404_not_found_for_invalid_page(self):\n        request = factory.get('/', {'page': 'invalid'})\n        response = self.view(request)\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n        assert response.data == {\n            'detail': 'Invalid page.'\n        }\n\n\nclass TestPaginationDisabledIntegration:\n    \"\"\"\n    Integration tests for disabled pagination.\n    \"\"\"\n\n    def setup_method(self):\n        class PassThroughSerializer(serializers.BaseSerializer):\n            def to_representation(self, item):\n                return item\n\n        self.view = generics.ListAPIView.as_view(\n            serializer_class=PassThroughSerializer,\n            queryset=range(1, 101),\n            pagination_class=None\n        )\n\n    def test_unpaginated_list(self):\n        request = factory.get('/', {'page': 2})\n        response = self.view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == list(range(1, 101))\n\n\nclass TestPageNumberPagination:\n    \"\"\"\n    Unit tests for `pagination.PageNumberPagination`.\n    \"\"\"\n\n    def setup_method(self):\n        class ExamplePagination(pagination.PageNumberPagination):\n            page_size = 5\n\n        self.pagination = ExamplePagination()\n        self.queryset = range(1, 101)\n\n    def paginate_queryset(self, request):\n        return list(self.pagination.paginate_queryset(self.queryset, request))\n\n    def get_paginated_content(self, queryset):\n        response = self.pagination.get_paginated_response(queryset)\n        return response.data\n\n    def get_html_context(self):\n        return self.pagination.get_html_context()\n\n    @pytest.mark.parametrize('url', ['/', '/?page='])\n    def test_no_page_number(self, url):\n        request = Request(factory.get(url))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        context = self.get_html_context()\n        assert queryset == [1, 2, 3, 4, 5]\n        assert content == {\n            'results': [1, 2, 3, 4, 5],\n            'previous': None,\n            'next': 'http://testserver/?page=2',\n            'count': 100\n        }\n        assert context == {\n            'previous_url': None,\n            'next_url': 'http://testserver/?page=2',\n            'page_links': [\n                PageLink('http://testserver/', 1, True, False),\n                PageLink('http://testserver/?page=2', 2, False, False),\n                PageLink('http://testserver/?page=3', 3, False, False),\n                PAGE_BREAK,\n                PageLink('http://testserver/?page=20', 20, False, False),\n            ]\n        }\n        assert self.pagination.display_page_controls\n        assert isinstance(self.pagination.to_html(), str)\n\n    def test_second_page(self):\n        request = Request(factory.get('/', {'page': 2}))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        context = self.get_html_context()\n        assert queryset == [6, 7, 8, 9, 10]\n        assert content == {\n            'results': [6, 7, 8, 9, 10],\n            'previous': 'http://testserver/',\n            'next': 'http://testserver/?page=3',\n            'count': 100\n        }\n        assert context == {\n            'previous_url': 'http://testserver/',\n            'next_url': 'http://testserver/?page=3',\n            'page_links': [\n                PageLink('http://testserver/', 1, False, False),\n                PageLink('http://testserver/?page=2', 2, True, False),\n                PageLink('http://testserver/?page=3', 3, False, False),\n                PAGE_BREAK,\n                PageLink('http://testserver/?page=20', 20, False, False),\n            ]\n        }\n\n    def test_last_page(self):\n        request = Request(factory.get('/', {'page': 'last'}))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        context = self.get_html_context()\n        assert queryset == [96, 97, 98, 99, 100]\n        assert content == {\n            'results': [96, 97, 98, 99, 100],\n            'previous': 'http://testserver/?page=19',\n            'next': None,\n            'count': 100\n        }\n        assert context == {\n            'previous_url': 'http://testserver/?page=19',\n            'next_url': None,\n            'page_links': [\n                PageLink('http://testserver/', 1, False, False),\n                PAGE_BREAK,\n                PageLink('http://testserver/?page=18', 18, False, False),\n                PageLink('http://testserver/?page=19', 19, False, False),\n                PageLink('http://testserver/?page=20', 20, True, False),\n            ]\n        }\n\n    def test_invalid_page(self):\n        request = Request(factory.get('/', {'page': 'invalid'}))\n        with pytest.raises(exceptions.NotFound):\n            self.paginate_queryset(request)\n\n    def test_get_paginated_response_schema(self):\n        unpaginated_schema = {\n            'type': 'object',\n            'item': {\n                'properties': {\n                    'test-property': {\n                        'type': 'integer',\n                    },\n                },\n            },\n        }\n\n        assert self.pagination.get_paginated_response_schema(unpaginated_schema) == {\n            'type': 'object',\n            'required': ['count', 'results'],\n            'properties': {\n                'count': {\n                    'type': 'integer',\n                    'example': 123,\n                },\n                'next': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?page=4',\n                },\n                'previous': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?page=2',\n                },\n                'results': unpaginated_schema,\n            },\n        }\n\n\nclass TestPageNumberPaginationOverride:\n    \"\"\"\n    Unit tests for `pagination.PageNumberPagination`.\n\n    the Django Paginator Class is overridden.\n    \"\"\"\n\n    def setup_method(self):\n        class OverriddenDjangoPaginator(DjangoPaginator):\n            # override the count in our overridden Django Paginator\n            # we will only return one page, with one item\n            count = 1\n\n        class ExamplePagination(pagination.PageNumberPagination):\n            django_paginator_class = OverriddenDjangoPaginator\n            page_size = 5\n\n        self.pagination = ExamplePagination()\n        self.queryset = range(1, 101)\n\n    def paginate_queryset(self, request):\n        return list(self.pagination.paginate_queryset(self.queryset, request))\n\n    def get_paginated_content(self, queryset):\n        response = self.pagination.get_paginated_response(queryset)\n        return response.data\n\n    def get_html_context(self):\n        return self.pagination.get_html_context()\n\n    def test_no_page_number(self):\n        request = Request(factory.get('/'))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        context = self.get_html_context()\n        assert queryset == [1]\n        assert content == {\n            'results': [1, ],\n            'previous': None,\n            'next': None,\n            'count': 1\n        }\n        assert context == {\n            'previous_url': None,\n            'next_url': None,\n            'page_links': [\n                PageLink('http://testserver/', 1, True, False),\n            ]\n        }\n        assert not self.pagination.display_page_controls\n        assert isinstance(self.pagination.to_html(), str)\n\n    def test_invalid_page(self):\n        request = Request(factory.get('/', {'page': 'invalid'}))\n        with pytest.raises(exceptions.NotFound):\n            self.paginate_queryset(request)\n\n\nclass TestLimitOffset:\n    \"\"\"\n    Unit tests for `pagination.LimitOffsetPagination`.\n    \"\"\"\n\n    def setup_method(self):\n        class ExamplePagination(pagination.LimitOffsetPagination):\n            default_limit = 10\n            max_limit = 15\n\n        self.pagination = ExamplePagination()\n        self.queryset = range(1, 101)\n\n    def paginate_queryset(self, request):\n        return list(self.pagination.paginate_queryset(self.queryset, request))\n\n    def get_paginated_content(self, queryset):\n        response = self.pagination.get_paginated_response(queryset)\n        return response.data\n\n    def get_html_context(self):\n        return self.pagination.get_html_context()\n\n    def test_no_offset(self):\n        request = Request(factory.get('/', {'limit': 5}))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        context = self.get_html_context()\n        assert queryset == [1, 2, 3, 4, 5]\n        assert content == {\n            'results': [1, 2, 3, 4, 5],\n            'previous': None,\n            'next': 'http://testserver/?limit=5&offset=5',\n            'count': 100\n        }\n        assert context == {\n            'previous_url': None,\n            'next_url': 'http://testserver/?limit=5&offset=5',\n            'page_links': [\n                PageLink('http://testserver/?limit=5', 1, True, False),\n                PageLink('http://testserver/?limit=5&offset=5', 2, False, False),\n                PageLink('http://testserver/?limit=5&offset=10', 3, False, False),\n                PAGE_BREAK,\n                PageLink('http://testserver/?limit=5&offset=95', 20, False, False),\n            ]\n        }\n        assert self.pagination.display_page_controls\n        assert isinstance(self.pagination.to_html(), str)\n\n    def test_pagination_not_applied_if_limit_or_default_limit_not_set(self):\n        class MockPagination(pagination.LimitOffsetPagination):\n            default_limit = None\n        request = Request(factory.get('/'))\n        queryset = MockPagination().paginate_queryset(self.queryset, request)\n        assert queryset is None\n\n    def test_single_offset(self):\n        \"\"\"\n        When the offset is not a multiple of the limit we get some edge cases:\n        * The first page should still be offset zero.\n        * We may end up displaying an extra page in the pagination control.\n        \"\"\"\n        request = Request(factory.get('/', {'limit': 5, 'offset': 1}))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        context = self.get_html_context()\n        assert queryset == [2, 3, 4, 5, 6]\n        assert content == {\n            'results': [2, 3, 4, 5, 6],\n            'previous': 'http://testserver/?limit=5',\n            'next': 'http://testserver/?limit=5&offset=6',\n            'count': 100\n        }\n        assert context == {\n            'previous_url': 'http://testserver/?limit=5',\n            'next_url': 'http://testserver/?limit=5&offset=6',\n            'page_links': [\n                PageLink('http://testserver/?limit=5', 1, False, False),\n                PageLink('http://testserver/?limit=5&offset=1', 2, True, False),\n                PageLink('http://testserver/?limit=5&offset=6', 3, False, False),\n                PAGE_BREAK,\n                PageLink('http://testserver/?limit=5&offset=96', 21, False, False),\n            ]\n        }\n\n    def test_first_offset(self):\n        request = Request(factory.get('/', {'limit': 5, 'offset': 5}))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        context = self.get_html_context()\n        assert queryset == [6, 7, 8, 9, 10]\n        assert content == {\n            'results': [6, 7, 8, 9, 10],\n            'previous': 'http://testserver/?limit=5',\n            'next': 'http://testserver/?limit=5&offset=10',\n            'count': 100\n        }\n        assert context == {\n            'previous_url': 'http://testserver/?limit=5',\n            'next_url': 'http://testserver/?limit=5&offset=10',\n            'page_links': [\n                PageLink('http://testserver/?limit=5', 1, False, False),\n                PageLink('http://testserver/?limit=5&offset=5', 2, True, False),\n                PageLink('http://testserver/?limit=5&offset=10', 3, False, False),\n                PAGE_BREAK,\n                PageLink('http://testserver/?limit=5&offset=95', 20, False, False),\n            ]\n        }\n\n    def test_middle_offset(self):\n        request = Request(factory.get('/', {'limit': 5, 'offset': 10}))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        context = self.get_html_context()\n        assert queryset == [11, 12, 13, 14, 15]\n        assert content == {\n            'results': [11, 12, 13, 14, 15],\n            'previous': 'http://testserver/?limit=5&offset=5',\n            'next': 'http://testserver/?limit=5&offset=15',\n            'count': 100\n        }\n        assert context == {\n            'previous_url': 'http://testserver/?limit=5&offset=5',\n            'next_url': 'http://testserver/?limit=5&offset=15',\n            'page_links': [\n                PageLink('http://testserver/?limit=5', 1, False, False),\n                PageLink('http://testserver/?limit=5&offset=5', 2, False, False),\n                PageLink('http://testserver/?limit=5&offset=10', 3, True, False),\n                PageLink('http://testserver/?limit=5&offset=15', 4, False, False),\n                PAGE_BREAK,\n                PageLink('http://testserver/?limit=5&offset=95', 20, False, False),\n            ]\n        }\n\n    def test_ending_offset(self):\n        request = Request(factory.get('/', {'limit': 5, 'offset': 95}))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        context = self.get_html_context()\n        assert queryset == [96, 97, 98, 99, 100]\n        assert content == {\n            'results': [96, 97, 98, 99, 100],\n            'previous': 'http://testserver/?limit=5&offset=90',\n            'next': None,\n            'count': 100\n        }\n        assert context == {\n            'previous_url': 'http://testserver/?limit=5&offset=90',\n            'next_url': None,\n            'page_links': [\n                PageLink('http://testserver/?limit=5', 1, False, False),\n                PAGE_BREAK,\n                PageLink('http://testserver/?limit=5&offset=85', 18, False, False),\n                PageLink('http://testserver/?limit=5&offset=90', 19, False, False),\n                PageLink('http://testserver/?limit=5&offset=95', 20, True, False),\n            ]\n        }\n\n    def test_erroneous_offset(self):\n        request = Request(factory.get('/', {'limit': 5, 'offset': 1000}))\n        queryset = self.paginate_queryset(request)\n        self.get_paginated_content(queryset)\n        self.get_html_context()\n\n    def test_invalid_offset(self):\n        \"\"\"\n        An invalid offset query param should be treated as 0.\n        \"\"\"\n        request = Request(factory.get('/', {'limit': 5, 'offset': 'invalid'}))\n        queryset = self.paginate_queryset(request)\n        assert queryset == [1, 2, 3, 4, 5]\n\n    def test_invalid_limit(self):\n        \"\"\"\n        An invalid limit query param should be ignored in favor of the default.\n        \"\"\"\n        request = Request(factory.get('/', {'limit': 'invalid', 'offset': 0}))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        next_limit = self.pagination.default_limit\n        next_offset = self.pagination.default_limit\n        next_url = f'http://testserver/?limit={next_limit}&offset={next_offset}'\n        assert queryset == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n        assert content.get('next') == next_url\n\n    def test_zero_limit(self):\n        \"\"\"\n        An zero limit query param should be ignored in favor of the default.\n        \"\"\"\n        request = Request(factory.get('/', {'limit': 0, 'offset': 0}))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        next_limit = self.pagination.default_limit\n        next_offset = self.pagination.default_limit\n        next_url = f'http://testserver/?limit={next_limit}&offset={next_offset}'\n        assert queryset == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n        assert content.get('next') == next_url\n\n    def test_max_limit(self):\n        \"\"\"\n        The limit defaults to the max_limit when there is a max_limit and the\n        requested limit is greater than the max_limit\n        \"\"\"\n        offset = 50\n        request = Request(factory.get('/', {'limit': '11235', 'offset': offset}))\n        queryset = self.paginate_queryset(request)\n        content = self.get_paginated_content(queryset)\n        max_limit = self.pagination.max_limit\n        next_offset = offset + max_limit\n        prev_offset = offset - max_limit\n        base_url = f'http://testserver/?limit={max_limit}'\n        next_url = base_url + f'&offset={next_offset}'\n        prev_url = base_url + f'&offset={prev_offset}'\n        assert queryset == list(range(51, 66))\n        assert content.get('next') == next_url\n        assert content.get('previous') == prev_url\n\n    def test_get_paginated_response_schema(self):\n        unpaginated_schema = {\n            'type': 'object',\n            'item': {\n                'properties': {\n                    'test-property': {\n                        'type': 'integer',\n                    },\n                },\n            },\n        }\n\n        assert self.pagination.get_paginated_response_schema(unpaginated_schema) == {\n            'type': 'object',\n            'required': ['count', 'results'],\n            'properties': {\n                'count': {\n                    'type': 'integer',\n                    'example': 123,\n                },\n                'next': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?offset=400&limit=100',\n                },\n                'previous': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?offset=200&limit=100',\n                },\n                'results': unpaginated_schema,\n            },\n        }\n\n\nclass CursorPaginationTestsMixin:\n\n    def test_invalid_cursor(self):\n        request = Request(factory.get('/', {'cursor': '123'}))\n        with pytest.raises(exceptions.NotFound):\n            self.pagination.paginate_queryset(self.queryset, request)\n\n    def test_use_with_ordering_filter(self):\n        class MockView:\n            filter_backends = (filters.OrderingFilter,)\n            ordering_fields = ['username', 'created']\n            ordering = 'created'\n\n        request = Request(factory.get('/', {'ordering': 'username'}))\n        ordering = self.pagination.get_ordering(request, [], MockView())\n        assert ordering == ('username',)\n\n        request = Request(factory.get('/', {'ordering': '-username'}))\n        ordering = self.pagination.get_ordering(request, [], MockView())\n        assert ordering == ('-username',)\n\n        request = Request(factory.get('/', {'ordering': 'invalid'}))\n        ordering = self.pagination.get_ordering(request, [], MockView())\n        assert ordering == ('created',)\n\n    def test_use_with_ordering_filter_without_ordering_default_value(self):\n        class MockView:\n            filter_backends = (filters.OrderingFilter,)\n            ordering_fields = ['username', 'created']\n\n        request = Request(factory.get('/'))\n        ordering = self.pagination.get_ordering(request, [], MockView())\n        # it gets the value of `ordering` provided by CursorPagination\n        assert ordering == ('created',)\n\n        request = Request(factory.get('/', {'ordering': 'username'}))\n        ordering = self.pagination.get_ordering(request, [], MockView())\n        assert ordering == ('username',)\n\n        request = Request(factory.get('/', {'ordering': 'invalid'}))\n        ordering = self.pagination.get_ordering(request, [], MockView())\n        assert ordering == ('created',)\n\n    def test_cursor_pagination(self):\n        (previous, current, next, previous_url, next_url) = self.get_pages('/')\n\n        assert previous is None\n        assert current == [1, 1, 1, 1, 1]\n        assert next == [1, 2, 3, 4, 4]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [1, 1, 1, 1, 1]\n        assert current == [1, 2, 3, 4, 4]\n        assert next == [4, 4, 5, 6, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [1, 2, 3, 4, 4]\n        assert current == [4, 4, 5, 6, 7]\n        assert next == [7, 7, 7, 7, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [4, 4, 4, 5, 6]  # Paging artifact\n        assert current == [7, 7, 7, 7, 7]\n        assert next == [7, 7, 7, 8, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [7, 7, 7, 7, 7]\n        assert current == [7, 7, 7, 8, 9]\n        assert next == [9, 9, 9, 9, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [7, 7, 7, 8, 9]\n        assert current == [9, 9, 9, 9, 9]\n        assert next is None\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [7, 7, 7, 7, 7]\n        assert current == [7, 7, 7, 8, 9]\n        assert next == [9, 9, 9, 9, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [4, 4, 5, 6, 7]\n        assert current == [7, 7, 7, 7, 7]\n        assert next == [8, 9, 9, 9, 9]  # Paging artifact\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [1, 2, 3, 4, 4]\n        assert current == [4, 4, 5, 6, 7]\n        assert next == [7, 7, 7, 7, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [1, 1, 1, 1, 1]\n        assert current == [1, 2, 3, 4, 4]\n        assert next == [4, 4, 5, 6, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous is None\n        assert current == [1, 1, 1, 1, 1]\n        assert next == [1, 2, 3, 4, 4]\n\n        assert isinstance(self.pagination.to_html(), str)\n\n    def test_cursor_pagination_current_page_empty_forward(self):\n        # Regression test for #6504\n        self.pagination.base_url = \"/\"\n\n        # We have a cursor on the element at position 100, but this element doesn't exist\n        # anymore.\n        cursor = pagination.Cursor(reverse=False, offset=0, position=100)\n        url = self.pagination.encode_cursor(cursor)\n        self.pagination.base_url = \"/\"\n\n        # Loading the page with this cursor doesn't crash\n        (previous, current, next, previous_url, next_url) = self.get_pages(url)\n\n        # The previous url doesn't crash either\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        # And point to things that are not completely off.\n        assert previous == [7, 7, 7, 8, 9]\n        assert current == [9, 9, 9, 9, 9]\n        assert next == []\n        assert previous_url is not None\n        assert next_url is not None\n\n    def test_cursor_pagination_current_page_empty_reverse(self):\n        # Regression test for #6504\n        self.pagination.base_url = \"/\"\n\n        # We have a cursor on the element at position 100, but this element doesn't exist\n        # anymore.\n        cursor = pagination.Cursor(reverse=True, offset=0, position=100)\n        url = self.pagination.encode_cursor(cursor)\n        self.pagination.base_url = \"/\"\n\n        # Loading the page with this cursor doesn't crash\n        (previous, current, next, previous_url, next_url) = self.get_pages(url)\n\n        # The previous url doesn't crash either\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        # And point to things that are not completely off.\n        assert previous == [7, 7, 7, 7, 8]\n        assert current == []\n        assert next is None\n        assert previous_url is not None\n        assert next_url is None\n\n    def test_cursor_pagination_with_page_size(self):\n        (previous, current, next, previous_url, next_url) = self.get_pages('/?page_size=20')\n\n        assert previous is None\n        assert current == [1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 5, 6, 7, 7, 7, 7, 7, 7]\n        assert next == [7, 7, 7, 8, 9, 9, 9, 9, 9, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n        assert previous == [1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 5, 6, 7, 7, 7, 7, 7, 7]\n        assert current == [7, 7, 7, 8, 9, 9, 9, 9, 9, 9]\n        assert next is None\n\n    def test_cursor_pagination_with_page_size_over_limit(self):\n        (previous, current, next, previous_url, next_url) = self.get_pages('/?page_size=30')\n\n        assert previous is None\n        assert current == [1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 5, 6, 7, 7, 7, 7, 7, 7]\n        assert next == [7, 7, 7, 8, 9, 9, 9, 9, 9, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n        assert previous == [1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 5, 6, 7, 7, 7, 7, 7, 7]\n        assert current == [7, 7, 7, 8, 9, 9, 9, 9, 9, 9]\n        assert next is None\n\n    def test_cursor_pagination_with_page_size_zero(self):\n        (previous, current, next, previous_url, next_url) = self.get_pages('/?page_size=0')\n\n        assert previous is None\n        assert current == [1, 1, 1, 1, 1]\n        assert next == [1, 2, 3, 4, 4]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [1, 1, 1, 1, 1]\n        assert current == [1, 2, 3, 4, 4]\n        assert next == [4, 4, 5, 6, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [1, 2, 3, 4, 4]\n        assert current == [4, 4, 5, 6, 7]\n        assert next == [7, 7, 7, 7, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [4, 4, 4, 5, 6]  # Paging artifact\n        assert current == [7, 7, 7, 7, 7]\n        assert next == [7, 7, 7, 8, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [7, 7, 7, 7, 7]\n        assert current == [7, 7, 7, 8, 9]\n        assert next == [9, 9, 9, 9, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [7, 7, 7, 8, 9]\n        assert current == [9, 9, 9, 9, 9]\n        assert next is None\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [7, 7, 7, 7, 7]\n        assert current == [7, 7, 7, 8, 9]\n        assert next == [9, 9, 9, 9, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [4, 4, 5, 6, 7]\n        assert current == [7, 7, 7, 7, 7]\n        assert next == [8, 9, 9, 9, 9]  # Paging artifact\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [1, 2, 3, 4, 4]\n        assert current == [4, 4, 5, 6, 7]\n        assert next == [7, 7, 7, 7, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [1, 1, 1, 1, 1]\n        assert current == [1, 2, 3, 4, 4]\n        assert next == [4, 4, 5, 6, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous is None\n        assert current == [1, 1, 1, 1, 1]\n        assert next == [1, 2, 3, 4, 4]\n\n    def test_cursor_pagination_with_page_size_negative(self):\n        (previous, current, next, previous_url, next_url) = self.get_pages('/?page_size=-5')\n\n        assert previous is None\n        assert current == [1, 1, 1, 1, 1]\n        assert next == [1, 2, 3, 4, 4]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [1, 1, 1, 1, 1]\n        assert current == [1, 2, 3, 4, 4]\n        assert next == [4, 4, 5, 6, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [1, 2, 3, 4, 4]\n        assert current == [4, 4, 5, 6, 7]\n        assert next == [7, 7, 7, 7, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [4, 4, 4, 5, 6]  # Paging artifact\n        assert current == [7, 7, 7, 7, 7]\n        assert next == [7, 7, 7, 8, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [7, 7, 7, 7, 7]\n        assert current == [7, 7, 7, 8, 9]\n        assert next == [9, 9, 9, 9, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(next_url)\n\n        assert previous == [7, 7, 7, 8, 9]\n        assert current == [9, 9, 9, 9, 9]\n        assert next is None\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [7, 7, 7, 7, 7]\n        assert current == [7, 7, 7, 8, 9]\n        assert next == [9, 9, 9, 9, 9]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [4, 4, 5, 6, 7]\n        assert current == [7, 7, 7, 7, 7]\n        assert next == [8, 9, 9, 9, 9]  # Paging artifact\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [1, 2, 3, 4, 4]\n        assert current == [4, 4, 5, 6, 7]\n        assert next == [7, 7, 7, 7, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous == [1, 1, 1, 1, 1]\n        assert current == [1, 2, 3, 4, 4]\n        assert next == [4, 4, 5, 6, 7]\n\n        (previous, current, next, previous_url, next_url) = self.get_pages(previous_url)\n\n        assert previous is None\n        assert current == [1, 1, 1, 1, 1]\n        assert next == [1, 2, 3, 4, 4]\n\n    def test_get_paginated_response_schema(self):\n        unpaginated_schema = {\n            'type': 'object',\n            'item': {\n                'properties': {\n                    'test-property': {\n                        'type': 'integer',\n                    },\n                },\n            },\n        }\n\n        assert self.pagination.get_paginated_response_schema(unpaginated_schema) == {\n            'type': 'object',\n            'required': ['results'],\n            'properties': {\n                'next': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?cursor=cD00ODY%3D\"'\n                },\n                'previous': {\n                    'type': 'string',\n                    'nullable': True,\n                    'format': 'uri',\n                    'example': 'http://api.example.org/accounts/?cursor=cj0xJnA9NDg3'\n                },\n                'results': unpaginated_schema,\n            },\n        }\n\n\nclass TestCursorPagination(CursorPaginationTestsMixin):\n    \"\"\"\n    Unit tests for `pagination.CursorPagination`.\n    \"\"\"\n\n    def setup_method(self):\n        class MockObject:\n            def __init__(self, idx):\n                self.created = idx\n\n        class MockQuerySet:\n            def __init__(self, items):\n                self.items = items\n\n            def filter(self, created__gt=None, created__lt=None):\n                if created__gt is not None:\n                    return MockQuerySet([\n                        item for item in self.items\n                        if item.created > int(created__gt)\n                    ])\n\n                assert created__lt is not None\n                return MockQuerySet([\n                    item for item in self.items\n                    if item.created < int(created__lt)\n                ])\n\n            def order_by(self, *ordering):\n                if ordering[0].startswith('-'):\n                    return MockQuerySet(list(reversed(self.items)))\n                return self\n\n            def __getitem__(self, sliced):\n                return self.items[sliced]\n\n        class ExamplePagination(pagination.CursorPagination):\n            page_size = 5\n            page_size_query_param = 'page_size'\n            max_page_size = 20\n            ordering = 'created'\n\n        self.pagination = ExamplePagination()\n        self.queryset = MockQuerySet([\n            MockObject(idx) for idx in [\n                1, 1, 1, 1, 1,\n                1, 2, 3, 4, 4,\n                4, 4, 5, 6, 7,\n                7, 7, 7, 7, 7,\n                7, 7, 7, 8, 9,\n                9, 9, 9, 9, 9\n            ]\n        ])\n\n    def get_pages(self, url):\n        \"\"\"\n        Given a URL return a tuple of:\n\n        (previous page, current page, next page, previous url, next url)\n        \"\"\"\n        request = Request(factory.get(url))\n        queryset = self.pagination.paginate_queryset(self.queryset, request)\n        current = [item.created for item in queryset]\n\n        next_url = self.pagination.get_next_link()\n        previous_url = self.pagination.get_previous_link()\n\n        if next_url is not None:\n            request = Request(factory.get(next_url))\n            queryset = self.pagination.paginate_queryset(self.queryset, request)\n            next = [item.created for item in queryset]\n        else:\n            next = None\n\n        if previous_url is not None:\n            request = Request(factory.get(previous_url))\n            queryset = self.pagination.paginate_queryset(self.queryset, request)\n            previous = [item.created for item in queryset]\n        else:\n            previous = None\n\n        return (previous, current, next, previous_url, next_url)\n\n\nclass CursorPaginationModel(models.Model):\n    created = models.IntegerField()\n\n\nclass TestCursorPaginationWithValueQueryset(CursorPaginationTestsMixin, TestCase):\n    \"\"\"\n    Unit tests for `pagination.CursorPagination` for value querysets.\n    \"\"\"\n\n    def setUp(self):\n        class ExamplePagination(pagination.CursorPagination):\n            page_size = 5\n            page_size_query_param = 'page_size'\n            max_page_size = 20\n            ordering = 'created'\n\n        self.pagination = ExamplePagination()\n        data = [\n            1, 1, 1, 1, 1,\n            1, 2, 3, 4, 4,\n            4, 4, 5, 6, 7,\n            7, 7, 7, 7, 7,\n            7, 7, 7, 8, 9,\n            9, 9, 9, 9, 9\n        ]\n        for idx in data:\n            CursorPaginationModel.objects.create(created=idx)\n\n        self.queryset = CursorPaginationModel.objects.values()\n\n    def get_pages(self, url):\n        \"\"\"\n        Given a URL return a tuple of:\n\n        (previous page, current page, next page, previous url, next url)\n        \"\"\"\n        request = Request(factory.get(url))\n        queryset = self.pagination.paginate_queryset(self.queryset, request)\n        current = [item['created'] for item in queryset]\n\n        next_url = self.pagination.get_next_link()\n        previous_url = self.pagination.get_previous_link()\n\n        if next_url is not None:\n            request = Request(factory.get(next_url))\n            queryset = self.pagination.paginate_queryset(self.queryset, request)\n            next = [item['created'] for item in queryset]\n        else:\n            next = None\n\n        if previous_url is not None:\n            request = Request(factory.get(previous_url))\n            queryset = self.pagination.paginate_queryset(self.queryset, request)\n            previous = [item['created'] for item in queryset]\n        else:\n            previous = None\n\n        return (previous, current, next, previous_url, next_url)\n\n\ndef test_get_displayed_page_numbers():\n    \"\"\"\n    Test our contextual page display function.\n\n    This determines which pages to display in a pagination control,\n    given the current page and the last page.\n    \"\"\"\n    displayed_page_numbers = pagination._get_displayed_page_numbers\n\n    # At five pages or less, all pages are displayed, always.\n    assert displayed_page_numbers(1, 5) == [1, 2, 3, 4, 5]\n    assert displayed_page_numbers(2, 5) == [1, 2, 3, 4, 5]\n    assert displayed_page_numbers(3, 5) == [1, 2, 3, 4, 5]\n    assert displayed_page_numbers(4, 5) == [1, 2, 3, 4, 5]\n    assert displayed_page_numbers(5, 5) == [1, 2, 3, 4, 5]\n\n    # Between six and either pages we may have a single page break.\n    assert displayed_page_numbers(1, 6) == [1, 2, 3, None, 6]\n    assert displayed_page_numbers(2, 6) == [1, 2, 3, None, 6]\n    assert displayed_page_numbers(3, 6) == [1, 2, 3, 4, 5, 6]\n    assert displayed_page_numbers(4, 6) == [1, 2, 3, 4, 5, 6]\n    assert displayed_page_numbers(5, 6) == [1, None, 4, 5, 6]\n    assert displayed_page_numbers(6, 6) == [1, None, 4, 5, 6]\n\n    assert displayed_page_numbers(1, 7) == [1, 2, 3, None, 7]\n    assert displayed_page_numbers(2, 7) == [1, 2, 3, None, 7]\n    assert displayed_page_numbers(3, 7) == [1, 2, 3, 4, None, 7]\n    assert displayed_page_numbers(4, 7) == [1, 2, 3, 4, 5, 6, 7]\n    assert displayed_page_numbers(5, 7) == [1, None, 4, 5, 6, 7]\n    assert displayed_page_numbers(6, 7) == [1, None, 5, 6, 7]\n    assert displayed_page_numbers(7, 7) == [1, None, 5, 6, 7]\n\n    assert displayed_page_numbers(1, 8) == [1, 2, 3, None, 8]\n    assert displayed_page_numbers(2, 8) == [1, 2, 3, None, 8]\n    assert displayed_page_numbers(3, 8) == [1, 2, 3, 4, None, 8]\n    assert displayed_page_numbers(4, 8) == [1, 2, 3, 4, 5, None, 8]\n    assert displayed_page_numbers(5, 8) == [1, None, 4, 5, 6, 7, 8]\n    assert displayed_page_numbers(6, 8) == [1, None, 5, 6, 7, 8]\n    assert displayed_page_numbers(7, 8) == [1, None, 6, 7, 8]\n    assert displayed_page_numbers(8, 8) == [1, None, 6, 7, 8]\n\n    # At nine or more pages we may have two page breaks, one on each side.\n    assert displayed_page_numbers(1, 9) == [1, 2, 3, None, 9]\n    assert displayed_page_numbers(2, 9) == [1, 2, 3, None, 9]\n    assert displayed_page_numbers(3, 9) == [1, 2, 3, 4, None, 9]\n    assert displayed_page_numbers(4, 9) == [1, 2, 3, 4, 5, None, 9]\n    assert displayed_page_numbers(5, 9) == [1, None, 4, 5, 6, None, 9]\n    assert displayed_page_numbers(6, 9) == [1, None, 5, 6, 7, 8, 9]\n    assert displayed_page_numbers(7, 9) == [1, None, 6, 7, 8, 9]\n    assert displayed_page_numbers(8, 9) == [1, None, 7, 8, 9]\n    assert displayed_page_numbers(9, 9) == [1, None, 7, 8, 9]\n"
  },
  {
    "path": "tests/test_parsers.py",
    "content": "import io\nimport math\n\nimport pytest\nfrom django import forms\nfrom django.core.files.uploadhandler import (\n    MemoryFileUploadHandler, TemporaryFileUploadHandler\n)\nfrom django.http.request import RawPostDataException\nfrom django.test import TestCase\n\nfrom rest_framework.exceptions import ParseError\nfrom rest_framework.parsers import (\n    FileUploadParser, FormParser, JSONParser, MultiPartParser\n)\nfrom rest_framework.request import Request\nfrom rest_framework.test import APIRequestFactory\n\n\nclass Form(forms.Form):\n    field1 = forms.CharField(max_length=3)\n    field2 = forms.CharField()\n\n\nclass TestFormParser(TestCase):\n    def setUp(self):\n        self.string = \"field1=abc&field2=defghijk\"\n\n    def test_parse(self):\n        \"\"\" Make sure the `QueryDict` works OK \"\"\"\n        parser = FormParser()\n\n        stream = io.StringIO(self.string)\n        data = parser.parse(stream)\n\n        assert Form(data).is_valid() is True\n\n\nclass TestFileUploadParser(TestCase):\n    def setUp(self):\n        class MockRequest:\n            pass\n        self.stream = io.BytesIO(b\"Test text file\")\n        request = MockRequest()\n        request.upload_handlers = (MemoryFileUploadHandler(),)\n        request.META = {\n            'HTTP_CONTENT_DISPOSITION': 'Content-Disposition: inline; filename=file.txt',\n            'HTTP_CONTENT_LENGTH': 14,\n        }\n        self.parser_context = {'request': request, 'kwargs': {}}\n\n    def test_parse(self):\n        \"\"\"\n        Parse raw file upload.\n        \"\"\"\n        parser = FileUploadParser()\n        self.stream.seek(0)\n        data_and_files = parser.parse(self.stream, None, self.parser_context)\n        file_obj = data_and_files.files['file']\n        assert file_obj.size == 14\n\n    def test_parse_missing_filename(self):\n        \"\"\"\n        Parse raw file upload when filename is missing.\n        \"\"\"\n        parser = FileUploadParser()\n        self.stream.seek(0)\n        self.parser_context['request'].META['HTTP_CONTENT_DISPOSITION'] = ''\n        with pytest.raises(ParseError) as excinfo:\n            parser.parse(self.stream, None, self.parser_context)\n        assert str(excinfo.value) == 'Missing filename. Request should include a Content-Disposition header with a filename parameter.'\n\n    def test_parse_missing_filename_multiple_upload_handlers(self):\n        \"\"\"\n        Parse raw file upload with multiple handlers when filename is missing.\n        Regression test for #2109.\n        \"\"\"\n        parser = FileUploadParser()\n        self.stream.seek(0)\n        self.parser_context['request'].upload_handlers = (\n            MemoryFileUploadHandler(),\n            MemoryFileUploadHandler()\n        )\n        self.parser_context['request'].META['HTTP_CONTENT_DISPOSITION'] = ''\n        with pytest.raises(ParseError) as excinfo:\n            parser.parse(self.stream, None, self.parser_context)\n        assert str(excinfo.value) == 'Missing filename. Request should include a Content-Disposition header with a filename parameter.'\n\n    def test_parse_missing_filename_large_file(self):\n        \"\"\"\n        Parse raw file upload when filename is missing with TemporaryFileUploadHandler.\n        \"\"\"\n        parser = FileUploadParser()\n        self.stream.seek(0)\n        self.parser_context['request'].upload_handlers = (\n            TemporaryFileUploadHandler(),\n        )\n        self.parser_context['request'].META['HTTP_CONTENT_DISPOSITION'] = ''\n        with pytest.raises(ParseError) as excinfo:\n            parser.parse(self.stream, None, self.parser_context)\n        assert str(excinfo.value) == 'Missing filename. Request should include a Content-Disposition header with a filename parameter.'\n\n    def test_get_filename(self):\n        parser = FileUploadParser()\n        filename = parser.get_filename(self.stream, None, self.parser_context)\n        assert filename == 'file.txt'\n\n    def test_get_encoded_filename(self):\n        parser = FileUploadParser()\n\n        self.__replace_content_disposition('inline; filename*=utf-8\\'\\'ÀĥƦ.txt')\n        filename = parser.get_filename(self.stream, None, self.parser_context)\n        assert filename == 'ÀĥƦ.txt'\n\n        self.__replace_content_disposition('inline; filename=fallback.txt; filename*=utf-8\\'\\'ÀĥƦ.txt')\n        filename = parser.get_filename(self.stream, None, self.parser_context)\n        assert filename == 'ÀĥƦ.txt'\n\n        self.__replace_content_disposition('inline; filename=fallback.txt; filename*=utf-8\\'en-us\\'ÀĥƦ.txt')\n        filename = parser.get_filename(self.stream, None, self.parser_context)\n        assert filename == 'ÀĥƦ.txt'\n\n    def __replace_content_disposition(self, disposition):\n        self.parser_context['request'].META['HTTP_CONTENT_DISPOSITION'] = disposition\n\n\nclass TestJSONParser(TestCase):\n    def bytes(self, value):\n        return io.BytesIO(value.encode())\n\n    def test_float_strictness(self):\n        parser = JSONParser()\n\n        # Default to strict\n        for value in ['Infinity', '-Infinity', 'NaN']:\n            with pytest.raises(ParseError):\n                parser.parse(self.bytes(value))\n\n        parser.strict = False\n        assert parser.parse(self.bytes('Infinity')) == float('inf')\n        assert parser.parse(self.bytes('-Infinity')) == float('-inf')\n        assert math.isnan(parser.parse(self.bytes('NaN')))\n\n\nclass TestPOSTAccessed(TestCase):\n    def setUp(self):\n        self.factory = APIRequestFactory()\n\n    def test_post_accessed_in_post_method(self):\n        django_request = self.factory.post('/', {'foo': 'bar'})\n        request = Request(django_request, parsers=[FormParser(), MultiPartParser()])\n        django_request.POST\n        assert request.POST == {'foo': ['bar']}\n        assert request.data == {'foo': ['bar']}\n\n    def test_post_accessed_in_post_method_with_json_parser(self):\n        django_request = self.factory.post('/', {'foo': 'bar'})\n        request = Request(django_request, parsers=[JSONParser()])\n        django_request.POST\n        assert request.POST == {}\n        assert request.data == {}\n\n    def test_post_accessed_in_put_method(self):\n        django_request = self.factory.put('/', {'foo': 'bar'})\n        request = Request(django_request, parsers=[FormParser(), MultiPartParser()])\n        django_request.POST\n        assert request.POST == {'foo': ['bar']}\n        assert request.data == {'foo': ['bar']}\n\n    def test_request_read_before_parsing(self):\n        django_request = self.factory.put('/', {'foo': 'bar'})\n        request = Request(django_request, parsers=[FormParser(), MultiPartParser()])\n        django_request.read()\n        with pytest.raises(RawPostDataException):\n            request.POST\n        with pytest.raises(RawPostDataException):\n            request.POST\n            request.data\n"
  },
  {
    "path": "tests/test_permissions.py",
    "content": "import base64\nimport unittest\nfrom unittest import mock\n\nfrom django.conf import settings\nfrom django.contrib.auth.models import AnonymousUser, Group, Permission, User\nfrom django.db import models\nfrom django.test import TestCase\nfrom django.urls import ResolverMatch\n\nfrom rest_framework import (\n    HTTP_HEADER_ENCODING, authentication, generics, permissions, serializers,\n    status, views\n)\nfrom rest_framework.routers import DefaultRouter\nfrom rest_framework.test import APIRequestFactory\nfrom tests.models import BasicModel\n\nfactory = APIRequestFactory()\n\n\nclass BasicSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = BasicModel\n        fields = '__all__'\n\n\nclass RootView(generics.ListCreateAPIView):\n    queryset = BasicModel.objects.all()\n    serializer_class = BasicSerializer\n    authentication_classes = [authentication.BasicAuthentication]\n    permission_classes = [permissions.DjangoModelPermissions]\n\n\nclass InstanceView(generics.RetrieveUpdateDestroyAPIView):\n    queryset = BasicModel.objects.all()\n    serializer_class = BasicSerializer\n    authentication_classes = [authentication.BasicAuthentication]\n    permission_classes = [permissions.DjangoModelPermissions]\n\n\nclass GetQuerySetListView(generics.ListCreateAPIView):\n    serializer_class = BasicSerializer\n    authentication_classes = [authentication.BasicAuthentication]\n    permission_classes = [permissions.DjangoModelPermissions]\n\n    def get_queryset(self):\n        return BasicModel.objects.all()\n\n\nclass EmptyListView(generics.ListCreateAPIView):\n    queryset = BasicModel.objects.none()\n    serializer_class = BasicSerializer\n    authentication_classes = [authentication.BasicAuthentication]\n    permission_classes = [permissions.DjangoModelPermissions]\n\n\nclass IgnoredGetQuerySetListView(GetQuerySetListView):\n    _ignore_model_permissions = True\n\n\nroot_view = RootView.as_view()\napi_root_view = DefaultRouter().get_api_root_view()\ninstance_view = InstanceView.as_view()\nget_queryset_list_view = GetQuerySetListView.as_view()\nempty_list_view = EmptyListView.as_view()\nignored_get_queryset_list_view = IgnoredGetQuerySetListView.as_view()\n\n\ndef basic_auth_header(username, password):\n    credentials = ('%s:%s' % (username, password))\n    base64_credentials = base64.b64encode(credentials.encode(HTTP_HEADER_ENCODING)).decode(HTTP_HEADER_ENCODING)\n    return 'Basic %s' % base64_credentials\n\n\nclass ModelPermissionsIntegrationTests(TestCase):\n    def setUp(self):\n        User.objects.create_user('disallowed', 'disallowed@example.com', 'password')\n        user = User.objects.create_user('permitted', 'permitted@example.com', 'password')\n        user.user_permissions.set([\n            Permission.objects.get(codename='add_basicmodel'),\n            Permission.objects.get(codename='change_basicmodel'),\n            Permission.objects.get(codename='delete_basicmodel')\n        ])\n\n        user = User.objects.create_user('updateonly', 'updateonly@example.com', 'password')\n        user.user_permissions.set([\n            Permission.objects.get(codename='change_basicmodel'),\n        ])\n\n        self.permitted_credentials = basic_auth_header('permitted', 'password')\n        self.disallowed_credentials = basic_auth_header('disallowed', 'password')\n        self.updateonly_credentials = basic_auth_header('updateonly', 'password')\n\n        BasicModel(text='foo').save()\n\n    def test_has_create_permissions(self):\n        request = factory.post('/', {'text': 'foobar'}, format='json',\n                               HTTP_AUTHORIZATION=self.permitted_credentials)\n        response = root_view(request, pk=1)\n        self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n\n    def test_api_root_view_discard_default_django_model_permission(self):\n        \"\"\"\n        We check that DEFAULT_PERMISSION_CLASSES can\n        apply to APIRoot view. More specifically we check expected behavior of\n        ``_ignore_model_permissions`` attribute support.\n        \"\"\"\n        request = factory.get('/', format='json',\n                              HTTP_AUTHORIZATION=self.permitted_credentials)\n        request.resolver_match = ResolverMatch('get', (), {})\n        response = api_root_view(request)\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n\n    def test_ignore_model_permissions_with_unauthenticated_user(self):\n        \"\"\"\n        We check that the ``_ignore_model_permissions`` attribute\n        doesn't ignore the authentication.\n        \"\"\"\n        request = factory.get('/', format='json')\n        request.resolver_match = ResolverMatch('get', (), {})\n        response = ignored_get_queryset_list_view(request)\n        self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)\n\n    def test_ignore_model_permissions_with_authenticated_user(self):\n        \"\"\"\n        We check that the ``_ignore_model_permissions`` attribute\n        with an authenticated user.\n        \"\"\"\n        request = factory.get('/', format='json',\n                              HTTP_AUTHORIZATION=self.permitted_credentials)\n        request.resolver_match = ResolverMatch('get', (), {})\n        response = ignored_get_queryset_list_view(request)\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n\n    def test_get_queryset_has_create_permissions(self):\n        request = factory.post('/', {'text': 'foobar'}, format='json',\n                               HTTP_AUTHORIZATION=self.permitted_credentials)\n        response = get_queryset_list_view(request, pk=1)\n        self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n\n    def test_has_put_permissions(self):\n        request = factory.put('/1', {'text': 'foobar'}, format='json',\n                              HTTP_AUTHORIZATION=self.permitted_credentials)\n        response = instance_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n\n    def test_has_delete_permissions(self):\n        request = factory.delete('/1', HTTP_AUTHORIZATION=self.permitted_credentials)\n        response = instance_view(request, pk=1)\n        self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)\n\n    def test_does_not_have_create_permissions(self):\n        request = factory.post('/', {'text': 'foobar'}, format='json',\n                               HTTP_AUTHORIZATION=self.disallowed_credentials)\n        response = root_view(request, pk=1)\n        self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)\n\n    def test_does_not_have_put_permissions(self):\n        request = factory.put('/1', {'text': 'foobar'}, format='json',\n                              HTTP_AUTHORIZATION=self.disallowed_credentials)\n        response = instance_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)\n\n    def test_does_not_have_delete_permissions(self):\n        request = factory.delete('/1', HTTP_AUTHORIZATION=self.disallowed_credentials)\n        response = instance_view(request, pk=1)\n        self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)\n\n    def test_options_permitted(self):\n        request = factory.options(\n            '/',\n            HTTP_AUTHORIZATION=self.permitted_credentials\n        )\n        response = root_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n        self.assertIn('actions', response.data)\n        self.assertEqual(list(response.data['actions']), ['POST'])\n\n        request = factory.options(\n            '/1',\n            HTTP_AUTHORIZATION=self.permitted_credentials\n        )\n        response = instance_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n        self.assertIn('actions', response.data)\n        self.assertEqual(list(response.data['actions']), ['PUT'])\n\n    def test_options_disallowed(self):\n        request = factory.options(\n            '/',\n            HTTP_AUTHORIZATION=self.disallowed_credentials\n        )\n        response = root_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n        self.assertNotIn('actions', response.data)\n\n        request = factory.options(\n            '/1',\n            HTTP_AUTHORIZATION=self.disallowed_credentials\n        )\n        response = instance_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n        self.assertNotIn('actions', response.data)\n\n    def test_options_updateonly(self):\n        request = factory.options(\n            '/',\n            HTTP_AUTHORIZATION=self.updateonly_credentials\n        )\n        response = root_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n        self.assertNotIn('actions', response.data)\n\n        request = factory.options(\n            '/1',\n            HTTP_AUTHORIZATION=self.updateonly_credentials\n        )\n        response = instance_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n        self.assertIn('actions', response.data)\n        self.assertEqual(list(response.data['actions']), ['PUT'])\n\n    def test_empty_view_does_not_assert(self):\n        request = factory.get('/1', HTTP_AUTHORIZATION=self.permitted_credentials)\n        response = empty_list_view(request, pk=1)\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n\n    def test_calling_method_not_allowed(self):\n        request = factory.generic('METHOD_NOT_ALLOWED', '/', HTTP_AUTHORIZATION=self.permitted_credentials)\n        response = root_view(request)\n        self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)\n\n        request = factory.generic('METHOD_NOT_ALLOWED', '/1', HTTP_AUTHORIZATION=self.permitted_credentials)\n        response = instance_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)\n\n    def test_check_auth_before_queryset_call(self):\n        class View(RootView):\n            def get_queryset(_):\n                self.fail('should not reach due to auth check')\n        view = View.as_view()\n\n        request = factory.get('/', HTTP_AUTHORIZATION='')\n        response = view(request)\n        self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)\n\n    def test_queryset_assertions(self):\n        class View(views.APIView):\n            authentication_classes = [authentication.BasicAuthentication]\n            permission_classes = [permissions.DjangoModelPermissions]\n        view = View.as_view()\n\n        request = factory.get('/', HTTP_AUTHORIZATION=self.permitted_credentials)\n        msg = 'Cannot apply DjangoModelPermissions on a view that does not set `.queryset` or have a `.get_queryset()` method.'\n        with self.assertRaisesMessage(AssertionError, msg):\n            view(request)\n\n        # Faulty `get_queryset()` methods should trigger the above \"view does not have a queryset\" assertion.\n        class View(RootView):\n            def get_queryset(self):\n                return None\n        view = View.as_view()\n\n        request = factory.get('/', HTTP_AUTHORIZATION=self.permitted_credentials)\n        with self.assertRaisesMessage(AssertionError, 'View.get_queryset() returned None'):\n            view(request)\n\n\nclass BasicPermModel(models.Model):\n    text = models.CharField(max_length=100)\n\n    class Meta:\n        app_label = 'tests'\n\n\nclass BasicPermSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = BasicPermModel\n        fields = '__all__'\n\n\n# Custom object-level permission, that includes 'view' permissions\nclass ViewObjectPermissions(permissions.DjangoObjectPermissions):\n    perms_map = {\n        'GET': ['%(app_label)s.view_%(model_name)s'],\n        'OPTIONS': ['%(app_label)s.view_%(model_name)s'],\n        'HEAD': ['%(app_label)s.view_%(model_name)s'],\n        'POST': ['%(app_label)s.add_%(model_name)s'],\n        'PUT': ['%(app_label)s.change_%(model_name)s'],\n        'PATCH': ['%(app_label)s.change_%(model_name)s'],\n        'DELETE': ['%(app_label)s.delete_%(model_name)s'],\n    }\n\n\nclass ObjectPermissionInstanceView(generics.RetrieveUpdateDestroyAPIView):\n    queryset = BasicPermModel.objects.all()\n    serializer_class = BasicPermSerializer\n    authentication_classes = [authentication.BasicAuthentication]\n    permission_classes = [ViewObjectPermissions]\n\n\nobject_permissions_view = ObjectPermissionInstanceView.as_view()\n\n\nclass ObjectPermissionListView(generics.ListAPIView):\n    queryset = BasicPermModel.objects.all()\n    serializer_class = BasicPermSerializer\n    authentication_classes = [authentication.BasicAuthentication]\n    permission_classes = [ViewObjectPermissions]\n\n\nobject_permissions_list_view = ObjectPermissionListView.as_view()\n\n\nclass GetQuerysetObjectPermissionInstanceView(generics.RetrieveUpdateDestroyAPIView):\n    serializer_class = BasicPermSerializer\n    authentication_classes = [authentication.BasicAuthentication]\n    permission_classes = [ViewObjectPermissions]\n\n    def get_queryset(self):\n        return BasicPermModel.objects.all()\n\n\nget_queryset_object_permissions_view = GetQuerysetObjectPermissionInstanceView.as_view()\n\n\n@unittest.skipUnless('guardian' in settings.INSTALLED_APPS, 'django-guardian not installed')\nclass ObjectPermissionsIntegrationTests(TestCase):\n    \"\"\"\n    Integration tests for the object level permissions API.\n    \"\"\"\n    def setUp(self):\n        from guardian.shortcuts import assign_perm\n\n        # create users\n        create = User.objects.create_user\n        users = {\n            'fullaccess': create('fullaccess', 'fullaccess@example.com', 'password'),\n            'readonly': create('readonly', 'readonly@example.com', 'password'),\n            'writeonly': create('writeonly', 'writeonly@example.com', 'password'),\n            'deleteonly': create('deleteonly', 'deleteonly@example.com', 'password'),\n        }\n\n        # give everyone model level permissions, as we are not testing those\n        everyone = Group.objects.create(name='everyone')\n        model_name = BasicPermModel._meta.model_name\n        app_label = BasicPermModel._meta.app_label\n        f = '{}_{}'.format\n        perms = {\n            'view': f('view', model_name),\n            'change': f('change', model_name),\n            'delete': f('delete', model_name)\n        }\n        for perm in perms.values():\n            perm = f'{app_label}.{perm}'\n            assign_perm(perm, everyone)\n        everyone.user_set.add(*users.values())\n\n        # appropriate object level permissions\n        readers = Group.objects.create(name='readers')\n        writers = Group.objects.create(name='writers')\n        deleters = Group.objects.create(name='deleters')\n\n        model = BasicPermModel.objects.create(text='foo')\n\n        assign_perm(perms['view'], readers, model)\n        assign_perm(perms['change'], writers, model)\n        assign_perm(perms['delete'], deleters, model)\n\n        readers.user_set.add(users['fullaccess'], users['readonly'])\n        writers.user_set.add(users['fullaccess'], users['writeonly'])\n        deleters.user_set.add(users['fullaccess'], users['deleteonly'])\n\n        self.credentials = {}\n        for user in users.values():\n            self.credentials[user.username] = basic_auth_header(user.username, 'password')\n\n    # Delete\n    def test_can_delete_permissions(self):\n        request = factory.delete('/1', HTTP_AUTHORIZATION=self.credentials['deleteonly'])\n        response = object_permissions_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)\n\n    def test_cannot_delete_permissions(self):\n        request = factory.delete('/1', HTTP_AUTHORIZATION=self.credentials['readonly'])\n        response = object_permissions_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)\n\n    # Update\n    def test_can_update_permissions(self):\n        request = factory.patch(\n            '/1', {'text': 'foobar'}, format='json',\n            HTTP_AUTHORIZATION=self.credentials['writeonly']\n        )\n        response = object_permissions_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n        self.assertEqual(response.data.get('text'), 'foobar')\n\n    def test_cannot_update_permissions(self):\n        request = factory.patch(\n            '/1', {'text': 'foobar'}, format='json',\n            HTTP_AUTHORIZATION=self.credentials['deleteonly']\n        )\n        response = object_permissions_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)\n\n    def test_cannot_update_permissions_non_existing(self):\n        request = factory.patch(\n            '/999', {'text': 'foobar'}, format='json',\n            HTTP_AUTHORIZATION=self.credentials['deleteonly']\n        )\n        response = object_permissions_view(request, pk='999')\n        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)\n\n    # Read\n    def test_can_read_permissions(self):\n        request = factory.get('/1', HTTP_AUTHORIZATION=self.credentials['readonly'])\n        response = object_permissions_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n\n    def test_cannot_read_permissions(self):\n        request = factory.get('/1', HTTP_AUTHORIZATION=self.credentials['writeonly'])\n        response = object_permissions_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)\n\n    def test_can_read_get_queryset_permissions(self):\n        \"\"\"\n        same as ``test_can_read_permissions`` but with a view\n        that rely on ``.get_queryset()`` instead of ``.queryset``.\n        \"\"\"\n        request = factory.get('/1', HTTP_AUTHORIZATION=self.credentials['readonly'])\n        response = get_queryset_object_permissions_view(request, pk='1')\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n\n    # Read list\n    # Note: this previously tested `DjangoObjectPermissionsFilter`, which has\n    # since been moved to a separate package. These now act as sanity checks.\n    def test_can_read_list_permissions(self):\n        request = factory.get('/', HTTP_AUTHORIZATION=self.credentials['readonly'])\n        response = object_permissions_list_view(request)\n        self.assertEqual(response.status_code, status.HTTP_200_OK)\n        self.assertEqual(response.data[0].get('id'), 1)\n\n    def test_cannot_method_not_allowed(self):\n        request = factory.generic('METHOD_NOT_ALLOWED', '/', HTTP_AUTHORIZATION=self.credentials['readonly'])\n        response = object_permissions_list_view(request)\n        self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)\n\n\nclass BasicPerm(permissions.BasePermission):\n    def has_permission(self, request, view):\n        return False\n\n\nclass BasicPermWithDetail(permissions.BasePermission):\n    message = 'Custom: You cannot access this resource'\n    code = 'permission_denied_custom'\n\n    def has_permission(self, request, view):\n        return False\n\n\nclass BasicObjectPerm(permissions.BasePermission):\n    def has_object_permission(self, request, view, obj):\n        return False\n\n\nclass BasicObjectPermWithDetail(permissions.BasePermission):\n    message = 'Custom: You cannot access this resource'\n    code = 'permission_denied_custom'\n\n    def has_object_permission(self, request, view, obj):\n        return False\n\n\nclass PermissionInstanceView(generics.RetrieveUpdateDestroyAPIView):\n    queryset = BasicModel.objects.all()\n    serializer_class = BasicSerializer\n\n\nclass DeniedView(PermissionInstanceView):\n    permission_classes = (BasicPerm,)\n\n\nclass DeniedViewWithDetail(PermissionInstanceView):\n    permission_classes = (BasicPermWithDetail,)\n\n\nclass DeniedObjectView(PermissionInstanceView):\n    permission_classes = (BasicObjectPerm,)\n\n\nclass DeniedObjectViewWithDetail(PermissionInstanceView):\n    permission_classes = (BasicObjectPermWithDetail,)\n\n\ndenied_view = DeniedView.as_view()\n\ndenied_view_with_detail = DeniedViewWithDetail.as_view()\n\ndenied_object_view = DeniedObjectView.as_view()\n\ndenied_object_view_with_detail = DeniedObjectViewWithDetail.as_view()\n\n\nclass CustomPermissionsTests(TestCase):\n    def setUp(self):\n        BasicModel(text='foo').save()\n        User.objects.create_user('username', 'username@example.com', 'password')\n        credentials = basic_auth_header('username', 'password')\n        self.request = factory.get('/1', format='json', HTTP_AUTHORIZATION=credentials)\n        self.custom_message = 'Custom: You cannot access this resource'\n        self.custom_code = 'permission_denied_custom'\n\n    def test_permission_denied(self):\n        response = denied_view(self.request, pk=1)\n        detail = response.data.get('detail')\n        self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)\n        self.assertNotEqual(detail, self.custom_message)\n        self.assertNotEqual(detail.code, self.custom_code)\n\n    def test_permission_denied_with_custom_detail(self):\n        response = denied_view_with_detail(self.request, pk=1)\n        detail = response.data.get('detail')\n        self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)\n        self.assertEqual(detail, self.custom_message)\n        self.assertEqual(detail.code, self.custom_code)\n\n    def test_permission_denied_for_object(self):\n        response = denied_object_view(self.request, pk=1)\n        detail = response.data.get('detail')\n        self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)\n        self.assertNotEqual(detail, self.custom_message)\n        self.assertNotEqual(detail.code, self.custom_code)\n\n    def test_permission_denied_for_object_with_custom_detail(self):\n        response = denied_object_view_with_detail(self.request, pk=1)\n        detail = response.data.get('detail')\n        self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)\n        self.assertEqual(detail, self.custom_message)\n        self.assertEqual(detail.code, self.custom_code)\n\n\nclass PermissionsCompositionTests(TestCase):\n\n    def setUp(self):\n        self.username = 'john'\n        self.email = 'lennon@thebeatles.com'\n        self.password = 'password'\n        self.user = User.objects.create_user(\n            self.username,\n            self.email,\n            self.password\n        )\n        self.client.login(username=self.username, password=self.password)\n\n    def test_and_false(self):\n        request = factory.get('/1', format='json')\n        request.user = AnonymousUser()\n        composed_perm = permissions.IsAuthenticated & permissions.AllowAny\n        assert composed_perm().has_permission(request, None) is False\n\n    def test_and_true(self):\n        request = factory.get('/1', format='json')\n        request.user = self.user\n        composed_perm = permissions.IsAuthenticated & permissions.AllowAny\n        assert composed_perm().has_permission(request, None) is True\n\n    def test_or_false(self):\n        request = factory.get('/1', format='json')\n        request.user = AnonymousUser()\n        composed_perm = permissions.IsAuthenticated | permissions.AllowAny\n        assert composed_perm().has_permission(request, None) is True\n\n    def test_or_true(self):\n        request = factory.get('/1', format='json')\n        request.user = self.user\n        composed_perm = permissions.IsAuthenticated | permissions.AllowAny\n        assert composed_perm().has_permission(request, None) is True\n\n    def test_not_false(self):\n        request = factory.get('/1', format='json')\n        request.user = AnonymousUser()\n        composed_perm = ~permissions.IsAuthenticated\n        assert composed_perm().has_permission(request, None) is True\n\n    def test_not_true(self):\n        request = factory.get('/1', format='json')\n        request.user = self.user\n        composed_perm = ~permissions.AllowAny\n        assert composed_perm().has_permission(request, None) is False\n\n    def test_several_levels_without_negation(self):\n        request = factory.get('/1', format='json')\n        request.user = self.user\n        composed_perm = (\n            permissions.IsAuthenticated &\n            permissions.IsAuthenticated &\n            permissions.IsAuthenticated &\n            permissions.IsAuthenticated\n        )\n        assert composed_perm().has_permission(request, None) is True\n\n    def test_several_levels_and_precedence_with_negation(self):\n        request = factory.get('/1', format='json')\n        request.user = self.user\n        composed_perm = (\n            permissions.IsAuthenticated &\n            ~ permissions.IsAdminUser &\n            permissions.IsAuthenticated &\n            ~(permissions.IsAdminUser & permissions.IsAdminUser)\n        )\n        assert composed_perm().has_permission(request, None) is True\n\n    def test_several_levels_and_precedence(self):\n        request = factory.get('/1', format='json')\n        request.user = self.user\n        composed_perm = (\n            permissions.IsAuthenticated &\n            permissions.IsAuthenticated |\n            permissions.IsAuthenticated &\n            permissions.IsAuthenticated\n        )\n        assert composed_perm().has_permission(request, None) is True\n\n    def test_or_laziness(self):\n        request = factory.get('/1', format='json')\n        request.user = AnonymousUser()\n\n        with mock.patch.object(permissions.AllowAny, 'has_permission', return_value=True) as mock_allow:\n            with mock.patch.object(permissions.IsAuthenticated, 'has_permission', return_value=False) as mock_deny:\n                composed_perm = (permissions.AllowAny | permissions.IsAuthenticated)\n                hasperm = composed_perm().has_permission(request, None)\n                assert hasperm is True\n                assert mock_allow.call_count == 1\n                mock_deny.assert_not_called()\n\n        with mock.patch.object(permissions.AllowAny, 'has_permission', return_value=True) as mock_allow:\n            with mock.patch.object(permissions.IsAuthenticated, 'has_permission', return_value=False) as mock_deny:\n                composed_perm = (permissions.IsAuthenticated | permissions.AllowAny)\n                hasperm = composed_perm().has_permission(request, None)\n                assert hasperm is True\n                assert mock_deny.call_count == 1\n                assert mock_allow.call_count == 1\n\n    def test_object_or_laziness(self):\n        request = factory.get('/1', format='json')\n        request.user = AnonymousUser()\n\n        with mock.patch.object(permissions.AllowAny, 'has_object_permission', return_value=True) as mock_allow:\n            with mock.patch.object(permissions.IsAuthenticated, 'has_object_permission', return_value=False) as mock_deny:\n                composed_perm = (permissions.AllowAny | permissions.IsAuthenticated)\n                hasperm = composed_perm().has_object_permission(request, None, None)\n                assert hasperm is True\n                assert mock_allow.call_count == 1\n                mock_deny.assert_not_called()\n\n        with mock.patch.object(permissions.AllowAny, 'has_object_permission', return_value=True) as mock_allow:\n            with mock.patch.object(permissions.IsAuthenticated, 'has_object_permission', return_value=False) as mock_deny:\n                composed_perm = (permissions.IsAuthenticated | permissions.AllowAny)\n                hasperm = composed_perm().has_object_permission(request, None, None)\n                assert hasperm is True\n                assert mock_deny.call_count == 0\n                assert mock_allow.call_count == 1\n\n    def test_and_laziness(self):\n        request = factory.get('/1', format='json')\n        request.user = AnonymousUser()\n\n        with mock.patch.object(permissions.AllowAny, 'has_permission', return_value=True) as mock_allow:\n            with mock.patch.object(permissions.IsAuthenticated, 'has_permission', return_value=False) as mock_deny:\n                composed_perm = (permissions.AllowAny & permissions.IsAuthenticated)\n                hasperm = composed_perm().has_permission(request, None)\n                assert hasperm is False\n                assert mock_allow.call_count == 1\n                assert mock_deny.call_count == 1\n\n        with mock.patch.object(permissions.AllowAny, 'has_permission', return_value=True) as mock_allow:\n            with mock.patch.object(permissions.IsAuthenticated, 'has_permission', return_value=False) as mock_deny:\n                composed_perm = (permissions.IsAuthenticated & permissions.AllowAny)\n                hasperm = composed_perm().has_permission(request, None)\n                assert hasperm is False\n                assert mock_deny.call_count == 1\n                mock_allow.assert_not_called()\n\n    def test_object_and_laziness(self):\n        request = factory.get('/1', format='json')\n        request.user = AnonymousUser()\n\n        with mock.patch.object(permissions.AllowAny, 'has_object_permission', return_value=True) as mock_allow:\n            with mock.patch.object(permissions.IsAuthenticated, 'has_object_permission', return_value=False) as mock_deny:\n                composed_perm = (permissions.AllowAny & permissions.IsAuthenticated)\n                hasperm = composed_perm().has_object_permission(request, None, None)\n                assert hasperm is False\n                assert mock_allow.call_count == 1\n                assert mock_deny.call_count == 1\n\n        with mock.patch.object(permissions.AllowAny, 'has_object_permission', return_value=True) as mock_allow:\n            with mock.patch.object(permissions.IsAuthenticated, 'has_object_permission', return_value=False) as mock_deny:\n                composed_perm = (permissions.IsAuthenticated & permissions.AllowAny)\n                hasperm = composed_perm().has_object_permission(request, None, None)\n                assert hasperm is False\n                assert mock_deny.call_count == 1\n                mock_allow.assert_not_called()\n\n    def test_unimplemented_has_object_permission(self):\n        \"test for issue 6402 https://github.com/encode/django-rest-framework/issues/6402\"\n        request = factory.get('/1', format='json')\n        request.user = AnonymousUser()\n\n        class IsAuthenticatedUserOwner(permissions.IsAuthenticated):\n            def has_object_permission(self, request, view, obj):\n                return True\n\n        composed_perm = (IsAuthenticatedUserOwner | permissions.IsAdminUser)\n        hasperm = composed_perm().has_object_permission(request, None, None)\n        assert hasperm is False\n\n    def test_operand_holder_is_hashable(self):\n        assert hash(permissions.IsAuthenticated & permissions.IsAdminUser)\n\n    def test_operand_holder_hash_same_for_same_operands_and_operator(self):\n        first_operand_holder = (\n            permissions.IsAuthenticated & permissions.IsAdminUser\n        )\n        second_operand_holder = (\n            permissions.IsAuthenticated & permissions.IsAdminUser\n        )\n\n        assert hash(first_operand_holder) == hash(second_operand_holder)\n\n    def test_operand_holder_hash_differs_for_different_operands(self):\n        first_operand_holder = (\n            permissions.IsAuthenticated & permissions.IsAdminUser\n        )\n        second_operand_holder = (\n            permissions.AllowAny & permissions.IsAdminUser\n        )\n        third_operand_holder = (\n            permissions.IsAuthenticated & permissions.AllowAny\n        )\n\n        assert hash(first_operand_holder) != hash(second_operand_holder)\n        assert hash(first_operand_holder) != hash(third_operand_holder)\n        assert hash(second_operand_holder) != hash(third_operand_holder)\n\n    def test_operand_holder_hash_differs_for_different_operators(self):\n        first_operand_holder = (\n            permissions.IsAuthenticated & permissions.IsAdminUser\n        )\n        second_operand_holder = (\n            permissions.IsAuthenticated | permissions.IsAdminUser\n        )\n\n        assert hash(first_operand_holder) != hash(second_operand_holder)\n\n    def test_filtering_permissions(self):\n        unfiltered_permissions = [\n            permissions.IsAuthenticated & permissions.IsAdminUser,\n            permissions.IsAuthenticated & permissions.IsAdminUser,\n            permissions.AllowAny,\n        ]\n        expected_permissions = [\n            permissions.IsAuthenticated & permissions.IsAdminUser,\n            permissions.AllowAny,\n        ]\n\n        filtered_permissions = [\n            perm for perm\n            in dict.fromkeys(unfiltered_permissions)\n        ]\n\n        assert filtered_permissions == expected_permissions\n"
  },
  {
    "path": "tests/test_prefetch_related.py",
    "content": "from django.contrib.auth.models import Group, User\nfrom django.test import TestCase\n\nfrom rest_framework import generics, serializers\nfrom rest_framework.test import APIRequestFactory\n\nfactory = APIRequestFactory()\n\n\nclass UserSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = User\n        fields = ('id', 'username', 'email', 'groups')\n\n\nclass UserUpdate(generics.UpdateAPIView):\n    queryset = User.objects.exclude(username='exclude').prefetch_related('groups')\n    serializer_class = UserSerializer\n\n\nclass TestPrefetchRelatedUpdates(TestCase):\n    def setUp(self):\n        self.user = User.objects.create(username='tom', email='tom@example.com')\n        self.groups = [Group.objects.create(name='a'), Group.objects.create(name='b')]\n        self.user.groups.set(self.groups)\n\n    def test_prefetch_related_updates(self):\n        view = UserUpdate.as_view()\n        pk = self.user.pk\n        groups_pk = self.groups[0].pk\n        request = factory.put('/', {'username': 'new', 'groups': [groups_pk]}, format='json')\n        response = view(request, pk=pk)\n        assert User.objects.get(pk=pk).groups.count() == 1\n        expected = {\n            'id': pk,\n            'username': 'new',\n            'groups': [1],\n            'email': 'tom@example.com'\n        }\n        assert response.data == expected\n\n    def test_prefetch_related_excluding_instance_from_original_queryset(self):\n        \"\"\"\n        Regression test for https://github.com/encode/django-rest-framework/issues/4661\n        \"\"\"\n        view = UserUpdate.as_view()\n        pk = self.user.pk\n        groups_pk = self.groups[0].pk\n        request = factory.put('/', {'username': 'exclude', 'groups': [groups_pk]}, format='json')\n        response = view(request, pk=pk)\n        assert User.objects.get(pk=pk).groups.count() == 1\n        expected = {\n            'id': pk,\n            'username': 'exclude',\n            'groups': [1],\n            'email': 'tom@example.com'\n        }\n        assert response.data == expected\n\n    def test_can_update_without_queryset_on_class_view(self):\n        class UserUpdateWithoutQuerySet(generics.UpdateAPIView):\n            serializer_class = UserSerializer\n\n            def get_object(self):\n                return User.objects.get(pk=self.kwargs['pk'])\n\n        request = factory.patch('/', {'username': 'new'})\n        response = UserUpdateWithoutQuerySet.as_view()(request, pk=self.user.pk)\n        assert response.data['id'] == self.user.id\n        assert response.data['username'] == 'new'\n        self.user.refresh_from_db()\n        assert self.user.username == 'new'\n"
  },
  {
    "path": "tests/test_relations.py",
    "content": "import uuid\n\nimport pytest\nfrom _pytest.monkeypatch import MonkeyPatch\nfrom django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist\nfrom django.test import override_settings\nfrom django.urls import re_path\nfrom django.utils.datastructures import MultiValueDict\n\nfrom rest_framework import relations, serializers\nfrom rest_framework.fields import empty\nfrom rest_framework.test import APISimpleTestCase\n\nfrom .utils import (\n    BadType, MockObject, MockQueryset, fail_reverse, mock_reverse\n)\n\n\nclass TestStringRelatedField(APISimpleTestCase):\n    def setUp(self):\n        self.instance = MockObject(pk=1, name='foo')\n        self.field = serializers.StringRelatedField()\n\n    def test_string_related_representation(self):\n        representation = self.field.to_representation(self.instance)\n        assert representation == '<MockObject name=foo, pk=1>'\n\n\nclass MockApiSettings:\n    def __init__(self, cutoff, cutoff_text):\n        self.HTML_SELECT_CUTOFF = cutoff\n        self.HTML_SELECT_CUTOFF_TEXT = cutoff_text\n\n\nclass TestRelatedFieldHTMLCutoff(APISimpleTestCase):\n    def setUp(self):\n        self.queryset = MockQueryset([\n            MockObject(pk=i, name=str(i)) for i in range(0, 1100)\n        ])\n        self.monkeypatch = MonkeyPatch()\n\n    def test_no_settings(self):\n        # The default is 1,000, so sans settings it should be 1,000 plus one.\n        for many in (False, True):\n            field = serializers.PrimaryKeyRelatedField(queryset=self.queryset,\n                                                       many=many)\n            options = list(field.iter_options())\n            assert len(options) == 1001\n            assert options[-1].display_text == \"More than 1000 items...\"\n\n    def test_settings_cutoff(self):\n        self.monkeypatch.setattr(relations, \"api_settings\",\n                                 MockApiSettings(2, \"Cut Off\"))\n        for many in (False, True):\n            field = serializers.PrimaryKeyRelatedField(queryset=self.queryset,\n                                                       many=many)\n            options = list(field.iter_options())\n            assert len(options) == 3  # 2 real items plus the 'Cut Off' item.\n            assert options[-1].display_text == \"Cut Off\"\n\n    def test_settings_cutoff_none(self):\n        # Setting it to None should mean no limit; the default limit is 1,000.\n        self.monkeypatch.setattr(relations, \"api_settings\",\n                                 MockApiSettings(None, \"Cut Off\"))\n        for many in (False, True):\n            field = serializers.PrimaryKeyRelatedField(queryset=self.queryset,\n                                                       many=many)\n            options = list(field.iter_options())\n            assert len(options) == 1100\n\n    def test_settings_kwargs_cutoff(self):\n        # The explicit argument should override the settings.\n        self.monkeypatch.setattr(relations, \"api_settings\",\n                                 MockApiSettings(2, \"Cut Off\"))\n        for many in (False, True):\n            field = serializers.PrimaryKeyRelatedField(queryset=self.queryset,\n                                                       many=many,\n                                                       html_cutoff=100)\n            options = list(field.iter_options())\n            assert len(options) == 101\n            assert options[-1].display_text == \"Cut Off\"\n\n\nclass TestPrimaryKeyRelatedField(APISimpleTestCase):\n    def setUp(self):\n        self.queryset = MockQueryset([\n            MockObject(pk=1, name='foo'),\n            MockObject(pk=2, name='bar'),\n            MockObject(pk=3, name='baz')\n        ])\n        self.instance = self.queryset.items[2]\n        self.field = serializers.PrimaryKeyRelatedField(queryset=self.queryset)\n\n    def test_pk_related_lookup_exists(self):\n        instance = self.field.to_internal_value(self.instance.pk)\n        assert instance is self.instance\n\n    def test_pk_related_lookup_does_not_exist(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.field.to_internal_value(4)\n        msg = excinfo.value.detail[0]\n        assert msg == 'Invalid pk \"4\" - object does not exist.'\n\n    def test_pk_related_lookup_invalid_type(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.field.to_internal_value(BadType())\n        msg = excinfo.value.detail[0]\n        assert msg == 'Incorrect type. Expected pk value, received BadType.'\n\n    def test_pk_related_lookup_bool(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.field.to_internal_value(True)\n        msg = excinfo.value.detail[0]\n        assert msg == 'Incorrect type. Expected pk value, received bool.'\n\n    def test_pk_representation(self):\n        representation = self.field.to_representation(self.instance)\n        assert representation == self.instance.pk\n\n    def test_explicit_many_false(self):\n        field = serializers.PrimaryKeyRelatedField(queryset=self.queryset, many=False)\n        instance = field.to_internal_value(self.instance.pk)\n        assert instance is self.instance\n\n\nclass TestProxiedPrimaryKeyRelatedField(APISimpleTestCase):\n    def setUp(self):\n        self.queryset = MockQueryset([\n            MockObject(pk=uuid.UUID(int=0), name='foo'),\n            MockObject(pk=uuid.UUID(int=1), name='bar'),\n            MockObject(pk=uuid.UUID(int=2), name='baz')\n        ])\n        self.instance = self.queryset.items[2]\n        self.field = serializers.PrimaryKeyRelatedField(\n            queryset=self.queryset,\n            pk_field=serializers.UUIDField(format='int')\n        )\n\n    def test_pk_related_lookup_exists(self):\n        instance = self.field.to_internal_value(self.instance.pk.int)\n        assert instance is self.instance\n\n    def test_pk_related_lookup_does_not_exist(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.field.to_internal_value(4)\n        msg = excinfo.value.detail[0]\n        assert msg == 'Invalid pk \"00000000-0000-0000-0000-000000000004\" - object does not exist.'\n\n    def test_pk_representation(self):\n        representation = self.field.to_representation(self.instance)\n        assert representation == self.instance.pk.int\n\n\nurlpatterns = [\n    re_path(r'^example/(?P<name>.+)/$', lambda: None, name='example'),\n]\n\n\n@override_settings(ROOT_URLCONF='tests.test_relations')\nclass TestHyperlinkedRelatedField(APISimpleTestCase):\n    def setUp(self):\n        self.queryset = MockQueryset([\n            MockObject(pk=1, name='foobar'),\n            MockObject(pk=2, name='bazABCqux'),\n            MockObject(pk=2, name='bazABC qux'),\n        ])\n        self.field = serializers.HyperlinkedRelatedField(\n            view_name='example',\n            lookup_field='name',\n            lookup_url_kwarg='name',\n            queryset=self.queryset,\n        )\n        self.field.reverse = mock_reverse\n        self.field._context = {'request': True}\n\n    def test_representation_unsaved_object_with_non_nullable_pk(self):\n        representation = self.field.to_representation(MockObject(pk=''))\n        assert representation is None\n\n    def test_serialize_empty_relationship_attribute(self):\n        class TestSerializer(serializers.Serializer):\n            via_unreachable = serializers.HyperlinkedRelatedField(\n                source='does_not_exist.unreachable',\n                view_name='example',\n                read_only=True,\n            )\n\n        class TestSerializable:\n            @property\n            def does_not_exist(self):\n                raise ObjectDoesNotExist\n\n        serializer = TestSerializer(TestSerializable())\n        assert serializer.data == {'via_unreachable': None}\n\n    def test_hyperlinked_related_lookup_exists(self):\n        instance = self.field.to_internal_value('http://example.org/example/foobar/')\n        assert instance is self.queryset.items[0]\n\n    def test_hyperlinked_related_lookup_url_encoded_exists(self):\n        instance = self.field.to_internal_value('http://example.org/example/baz%41%42%43qux/')\n        assert instance is self.queryset.items[1]\n\n    def test_hyperlinked_related_lookup_url_space_encoded_exists(self):\n        instance = self.field.to_internal_value('http://example.org/example/bazABC%20qux/')\n        assert instance is self.queryset.items[2]\n\n    def test_hyperlinked_related_lookup_does_not_exist(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.field.to_internal_value('http://example.org/example/doesnotexist/')\n        msg = excinfo.value.detail[0]\n        assert msg == 'Invalid hyperlink - Object does not exist.'\n\n    def test_hyperlinked_related_internal_type_error(self):\n        class Field(serializers.HyperlinkedRelatedField):\n            def get_object(self, incorrect, signature):\n                raise NotImplementedError()\n\n        field = Field(view_name='example', queryset=self.queryset)\n        with pytest.raises(TypeError):\n            field.to_internal_value('http://example.org/example/doesnotexist/')\n\n    def hyperlinked_related_queryset_error(self, exc_type):\n        class QuerySet:\n            def get(self, *args, **kwargs):\n                raise exc_type\n\n        field = serializers.HyperlinkedRelatedField(\n            view_name='example',\n            lookup_field='name',\n            queryset=QuerySet(),\n        )\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            field.to_internal_value('http://example.org/example/doesnotexist/')\n        msg = excinfo.value.detail[0]\n        assert msg == 'Invalid hyperlink - Object does not exist.'\n\n    def test_hyperlinked_related_queryset_type_error(self):\n        self.hyperlinked_related_queryset_error(TypeError)\n\n    def test_hyperlinked_related_queryset_value_error(self):\n        self.hyperlinked_related_queryset_error(ValueError)\n\n\nclass TestHyperlinkedIdentityField(APISimpleTestCase):\n    def setUp(self):\n        self.instance = MockObject(pk=1, name='foo')\n        self.field = serializers.HyperlinkedIdentityField(view_name='example')\n        self.field.reverse = mock_reverse\n        self.field._context = {'request': True}\n\n    def test_representation(self):\n        representation = self.field.to_representation(self.instance)\n        assert representation == 'http://example.org/example/1/'\n\n    def test_representation_unsaved_object(self):\n        representation = self.field.to_representation(MockObject(pk=None))\n        assert representation is None\n\n    def test_representation_with_format(self):\n        self.field._context['format'] = 'xml'\n        representation = self.field.to_representation(self.instance)\n        assert representation == 'http://example.org/example/1.xml/'\n\n    def test_improperly_configured(self):\n        \"\"\"\n        If a matching view cannot be reversed with the given instance,\n        the user has misconfigured something, as the URL conf and the\n        hyperlinked field do not match.\n        \"\"\"\n        self.field.reverse = fail_reverse\n        with pytest.raises(ImproperlyConfigured):\n            self.field.to_representation(self.instance)\n\n\nclass TestHyperlinkedIdentityFieldWithFormat(APISimpleTestCase):\n    \"\"\"\n    Tests for a hyperlinked identity field that has a `format` set,\n    which enforces that alternate formats are never linked too.\n\n    Eg. If your API includes some endpoints that accept both `.xml` and `.json`,\n    but other endpoints that only accept `.json`, we allow for hyperlinked\n    relationships that enforce only a single suffix type.\n    \"\"\"\n\n    def setUp(self):\n        self.instance = MockObject(pk=1, name='foo')\n        self.field = serializers.HyperlinkedIdentityField(view_name='example', format='json')\n        self.field.reverse = mock_reverse\n        self.field._context = {'request': True}\n\n    def test_representation(self):\n        representation = self.field.to_representation(self.instance)\n        assert representation == 'http://example.org/example/1/'\n\n    def test_representation_with_format(self):\n        self.field._context['format'] = 'xml'\n        representation = self.field.to_representation(self.instance)\n        assert representation == 'http://example.org/example/1.json/'\n\n\nclass TestSlugRelatedField(APISimpleTestCase):\n    def setUp(self):\n        self.queryset = MockQueryset([\n            MockObject(pk=1, name='foo'),\n            MockObject(pk=2, name='bar'),\n            MockObject(pk=3, name='baz')\n        ])\n        self.instance = self.queryset.items[2]\n        self.field = serializers.SlugRelatedField(\n            slug_field='name', queryset=self.queryset\n        )\n\n    def test_slug_related_lookup_exists(self):\n        instance = self.field.to_internal_value(self.instance.name)\n        assert instance is self.instance\n\n    def test_slug_related_lookup_does_not_exist(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.field.to_internal_value('doesnotexist')\n        msg = excinfo.value.detail[0]\n        assert msg == 'Object with name=doesnotexist does not exist.'\n\n    def test_slug_related_lookup_invalid_type(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.field.to_internal_value(BadType())\n        msg = excinfo.value.detail[0]\n        assert msg == 'Invalid value.'\n\n    def test_representation(self):\n        representation = self.field.to_representation(self.instance)\n        assert representation == self.instance.name\n\n    def test_overriding_get_queryset(self):\n        qs = self.queryset\n\n        class NoQuerySetSlugRelatedField(serializers.SlugRelatedField):\n            def get_queryset(self):\n                return qs\n\n        field = NoQuerySetSlugRelatedField(slug_field='name')\n        field.to_internal_value(self.instance.name)\n\n\nclass TestNestedSlugRelatedField(APISimpleTestCase):\n    def setUp(self):\n        self.queryset = MockQueryset([\n            MockObject(\n                pk=1, name='foo', nested=MockObject(\n                    pk=2, name='bar', nested=MockObject(\n                        pk=7, name=\"foobar\"\n                    )\n                )\n            ),\n            MockObject(\n                pk=3, name='hello', nested=MockObject(\n                    pk=4, name='world', nested=MockObject(\n                        pk=8, name=\"helloworld\"\n                    )\n                )\n            ),\n            MockObject(\n                pk=5, name='harry', nested=MockObject(\n                    pk=6, name='potter', nested=MockObject(\n                        pk=9, name=\"harrypotter\"\n                    )\n                )\n            )\n        ])\n        self.instance = self.queryset.items[2]\n        self.field = serializers.SlugRelatedField(\n            slug_field='name', queryset=self.queryset\n        )\n        self.nested_field = serializers.SlugRelatedField(\n            slug_field='nested__name', queryset=self.queryset\n        )\n\n        self.nested_nested_field = serializers.SlugRelatedField(\n            slug_field='nested__nested__name', queryset=self.queryset\n        )\n\n    # testing nested inside nested relations\n    def test_slug_related_nested_nested_lookup_exists(self):\n        instance = self.nested_nested_field.to_internal_value(\n            self.instance.nested.nested.name\n        )\n        assert instance is self.instance\n\n    def test_slug_related_nested_nested_lookup_does_not_exist(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.nested_nested_field.to_internal_value('doesnotexist')\n        msg = excinfo.value.detail[0]\n        assert msg == \\\n            'Object with nested__nested__name=doesnotexist does not exist.'\n\n    def test_slug_related_nested_nested_lookup_invalid_type(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.nested_nested_field.to_internal_value(BadType())\n        msg = excinfo.value.detail[0]\n        assert msg == 'Invalid value.'\n\n    def test_nested_nested_representation(self):\n        representation =\\\n            self.nested_nested_field.to_representation(self.instance)\n        assert representation == self.instance.nested.nested.name\n\n    def test_nested_nested_overriding_get_queryset(self):\n        qs = self.queryset\n\n        class NoQuerySetSlugRelatedField(serializers.SlugRelatedField):\n            def get_queryset(self):\n                return qs\n\n        field = NoQuerySetSlugRelatedField(slug_field='nested__nested__name')\n        field.to_internal_value(self.instance.nested.nested.name)\n\n    # testing nested relations\n    def test_slug_related_nested_lookup_exists(self):\n        instance = \\\n            self.nested_field.to_internal_value(self.instance.nested.name)\n        assert instance is self.instance\n\n    def test_slug_related_nested_lookup_does_not_exist(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.nested_field.to_internal_value('doesnotexist')\n        msg = excinfo.value.detail[0]\n        assert msg == 'Object with nested__name=doesnotexist does not exist.'\n\n    def test_slug_related_nested_lookup_invalid_type(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.nested_field.to_internal_value(BadType())\n        msg = excinfo.value.detail[0]\n        assert msg == 'Invalid value.'\n\n    def test_nested_representation(self):\n        representation = self.nested_field.to_representation(self.instance)\n        assert representation == self.instance.nested.name\n\n    def test_nested_overriding_get_queryset(self):\n        qs = self.queryset\n\n        class NoQuerySetSlugRelatedField(serializers.SlugRelatedField):\n            def get_queryset(self):\n                return qs\n\n        field = NoQuerySetSlugRelatedField(slug_field='nested__name')\n        field.to_internal_value(self.instance.nested.name)\n\n    # testing non-nested relations\n    def test_slug_related_lookup_exists(self):\n        instance = self.field.to_internal_value(self.instance.name)\n        assert instance is self.instance\n\n    def test_slug_related_lookup_does_not_exist(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.field.to_internal_value('doesnotexist')\n        msg = excinfo.value.detail[0]\n        assert msg == 'Object with name=doesnotexist does not exist.'\n\n    def test_slug_related_lookup_invalid_type(self):\n        with pytest.raises(serializers.ValidationError) as excinfo:\n            self.field.to_internal_value(BadType())\n        msg = excinfo.value.detail[0]\n        assert msg == 'Invalid value.'\n\n    def test_representation(self):\n        representation = self.field.to_representation(self.instance)\n        assert representation == self.instance.name\n\n    def test_overriding_get_queryset(self):\n        qs = self.queryset\n\n        class NoQuerySetSlugRelatedField(serializers.SlugRelatedField):\n            def get_queryset(self):\n                return qs\n\n        field = NoQuerySetSlugRelatedField(slug_field='name')\n        field.to_internal_value(self.instance.name)\n\n\nclass TestManyRelatedField(APISimpleTestCase):\n    def setUp(self):\n        self.instance = MockObject(pk=1, name='foo')\n        self.field = serializers.StringRelatedField(many=True)\n        self.field.field_name = 'foo'\n\n    def test_get_value_regular_dictionary_full(self):\n        assert 'bar' == self.field.get_value({'foo': 'bar'})\n        assert empty == self.field.get_value({'baz': 'bar'})\n\n    def test_get_value_regular_dictionary_partial(self):\n        setattr(self.field.root, 'partial', True)\n        assert 'bar' == self.field.get_value({'foo': 'bar'})\n        assert empty == self.field.get_value({'baz': 'bar'})\n\n    def test_get_value_multi_dictionary_full(self):\n        mvd = MultiValueDict({'foo': ['bar1', 'bar2']})\n        assert ['bar1', 'bar2'] == self.field.get_value(mvd)\n\n        mvd = MultiValueDict({'baz': ['bar1', 'bar2']})\n        assert [] == self.field.get_value(mvd)\n\n    def test_get_value_multi_dictionary_partial(self):\n        setattr(self.field.root, 'partial', True)\n        mvd = MultiValueDict({'foo': ['bar1', 'bar2']})\n        assert ['bar1', 'bar2'] == self.field.get_value(mvd)\n\n        mvd = MultiValueDict({'baz': ['bar1', 'bar2']})\n        assert empty == self.field.get_value(mvd)\n\n\nclass TestHyperlink:\n    def setup_method(self):\n        self.default_hyperlink = serializers.Hyperlink('http://example.com', 'test')\n\n    def test_can_be_pickled(self):\n        import pickle\n        upkled = pickle.loads(pickle.dumps(self.default_hyperlink))\n        assert upkled == self.default_hyperlink\n        assert upkled.name == self.default_hyperlink.name\n"
  },
  {
    "path": "tests/test_relations_hyperlink.py",
    "content": "import pytest\nfrom django.test import TestCase, override_settings\nfrom django.urls import path\n\nfrom rest_framework import serializers\nfrom rest_framework.test import APIRequestFactory\nfrom tests.models import (\n    ForeignKeySource, ForeignKeyTarget, ManyToManySource, ManyToManyTarget,\n    NullableForeignKeySource, NullableOneToOneSource, OneToOneTarget\n)\n\nfactory = APIRequestFactory()\nrequest = factory.get('/')  # Just to ensure we have a request in the serializer context\n\n\ndef dummy_view(request, pk):\n    pass\n\n\nurlpatterns = [\n    path('dummyurl/<int:pk>/', dummy_view, name='dummy-url'),\n    path('manytomanysource/<int:pk>/', dummy_view, name='manytomanysource-detail'),\n    path('manytomanytarget/<int:pk>/', dummy_view, name='manytomanytarget-detail'),\n    path('foreignkeysource/<int:pk>/', dummy_view, name='foreignkeysource-detail'),\n    path('foreignkeytarget/<int:pk>/', dummy_view, name='foreignkeytarget-detail'),\n    path('nullableforeignkeysource/<int:pk>/', dummy_view, name='nullableforeignkeysource-detail'),\n    path('onetoonetarget/<int:pk>/', dummy_view, name='onetoonetarget-detail'),\n    path('nullableonetoonesource/<int:pk>/', dummy_view, name='nullableonetoonesource-detail'),\n]\n\n\n# ManyToMany\nclass ManyToManyTargetSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = ManyToManyTarget\n        fields = ('url', 'name', 'sources')\n\n\nclass ManyToManySourceSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = ManyToManySource\n        fields = ('url', 'name', 'targets')\n\n\n# ForeignKey\nclass ForeignKeyTargetSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = ForeignKeyTarget\n        fields = ('url', 'name', 'sources')\n\n\nclass ForeignKeySourceSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = ForeignKeySource\n        fields = ('url', 'name', 'target')\n\n\n# Nullable ForeignKey\nclass NullableForeignKeySourceSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = NullableForeignKeySource\n        fields = ('url', 'name', 'target')\n\n\n# Nullable OneToOne\nclass NullableOneToOneTargetSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = OneToOneTarget\n        fields = ('url', 'name', 'nullable_source')\n\n\n@override_settings(ROOT_URLCONF='tests.test_relations_hyperlink')\nclass HyperlinkedManyToManyTests(TestCase):\n    def setUp(self):\n        for idx in range(1, 4):\n            target = ManyToManyTarget(name='target-%d' % idx)\n            target.save()\n            source = ManyToManySource(name='source-%d' % idx)\n            source.save()\n            for target in ManyToManyTarget.objects.all():\n                source.targets.add(target)\n\n    def test_relative_hyperlinks(self):\n        queryset = ManyToManySource.objects.all()\n        serializer = ManyToManySourceSerializer(queryset, many=True, context={'request': None})\n        expected = [\n            {'url': '/manytomanysource/1/', 'name': 'source-1', 'targets': ['/manytomanytarget/1/']},\n            {'url': '/manytomanysource/2/', 'name': 'source-2', 'targets': ['/manytomanytarget/1/', '/manytomanytarget/2/']},\n            {'url': '/manytomanysource/3/', 'name': 'source-3', 'targets': ['/manytomanytarget/1/', '/manytomanytarget/2/', '/manytomanytarget/3/']}\n        ]\n        with self.assertNumQueries(4):\n            assert serializer.data == expected\n\n    def test_many_to_many_retrieve(self):\n        queryset = ManyToManySource.objects.all()\n        serializer = ManyToManySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/manytomanysource/1/', 'name': 'source-1', 'targets': ['http://testserver/manytomanytarget/1/']},\n            {'url': 'http://testserver/manytomanysource/2/', 'name': 'source-2', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/2/']},\n            {'url': 'http://testserver/manytomanysource/3/', 'name': 'source-3', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/2/', 'http://testserver/manytomanytarget/3/']}\n        ]\n        with self.assertNumQueries(4):\n            assert serializer.data == expected\n\n    def test_many_to_many_retrieve_prefetch_related(self):\n        queryset = ManyToManySource.objects.all().prefetch_related('targets')\n        serializer = ManyToManySourceSerializer(queryset, many=True, context={'request': request})\n        with self.assertNumQueries(2):\n            serializer.data\n\n    def test_reverse_many_to_many_retrieve(self):\n        queryset = ManyToManyTarget.objects.all()\n        serializer = ManyToManyTargetSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/manytomanytarget/1/', 'name': 'target-1', 'sources': ['http://testserver/manytomanysource/1/', 'http://testserver/manytomanysource/2/', 'http://testserver/manytomanysource/3/']},\n            {'url': 'http://testserver/manytomanytarget/2/', 'name': 'target-2', 'sources': ['http://testserver/manytomanysource/2/', 'http://testserver/manytomanysource/3/']},\n            {'url': 'http://testserver/manytomanytarget/3/', 'name': 'target-3', 'sources': ['http://testserver/manytomanysource/3/']}\n        ]\n        with self.assertNumQueries(4):\n            assert serializer.data == expected\n\n    def test_many_to_many_update(self):\n        data = {'url': 'http://testserver/manytomanysource/1/', 'name': 'source-1', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/2/', 'http://testserver/manytomanytarget/3/']}\n        instance = ManyToManySource.objects.get(pk=1)\n        serializer = ManyToManySourceSerializer(instance, data=data, context={'request': request})\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = ManyToManySource.objects.all()\n        serializer = ManyToManySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/manytomanysource/1/', 'name': 'source-1', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/2/', 'http://testserver/manytomanytarget/3/']},\n            {'url': 'http://testserver/manytomanysource/2/', 'name': 'source-2', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/2/']},\n            {'url': 'http://testserver/manytomanysource/3/', 'name': 'source-3', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/2/', 'http://testserver/manytomanytarget/3/']}\n        ]\n        assert serializer.data == expected\n\n    def test_reverse_many_to_many_update(self):\n        data = {'url': 'http://testserver/manytomanytarget/1/', 'name': 'target-1', 'sources': ['http://testserver/manytomanysource/1/']}\n        instance = ManyToManyTarget.objects.get(pk=1)\n        serializer = ManyToManyTargetSerializer(instance, data=data, context={'request': request})\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == data\n        # Ensure target 1 is updated, and everything else is as expected\n        queryset = ManyToManyTarget.objects.all()\n        serializer = ManyToManyTargetSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/manytomanytarget/1/', 'name': 'target-1', 'sources': ['http://testserver/manytomanysource/1/']},\n            {'url': 'http://testserver/manytomanytarget/2/', 'name': 'target-2', 'sources': ['http://testserver/manytomanysource/2/', 'http://testserver/manytomanysource/3/']},\n            {'url': 'http://testserver/manytomanytarget/3/', 'name': 'target-3', 'sources': ['http://testserver/manytomanysource/3/']}\n\n        ]\n        assert serializer.data == expected\n\n    def test_many_to_many_create(self):\n        data = {'url': 'http://testserver/manytomanysource/4/', 'name': 'source-4', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/3/']}\n        serializer = ManyToManySourceSerializer(data=data, context={'request': request})\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'source-4'\n\n        # Ensure source 4 is added, and everything else is as expected\n        queryset = ManyToManySource.objects.all()\n        serializer = ManyToManySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/manytomanysource/1/', 'name': 'source-1', 'targets': ['http://testserver/manytomanytarget/1/']},\n            {'url': 'http://testserver/manytomanysource/2/', 'name': 'source-2', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/2/']},\n            {'url': 'http://testserver/manytomanysource/3/', 'name': 'source-3', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/2/', 'http://testserver/manytomanytarget/3/']},\n            {'url': 'http://testserver/manytomanysource/4/', 'name': 'source-4', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/3/']}\n        ]\n        assert serializer.data == expected\n\n    def test_reverse_many_to_many_create(self):\n        data = {'url': 'http://testserver/manytomanytarget/4/', 'name': 'target-4', 'sources': ['http://testserver/manytomanysource/1/', 'http://testserver/manytomanysource/3/']}\n        serializer = ManyToManyTargetSerializer(data=data, context={'request': request})\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'target-4'\n\n        # Ensure target 4 is added, and everything else is as expected\n        queryset = ManyToManyTarget.objects.all()\n        serializer = ManyToManyTargetSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/manytomanytarget/1/', 'name': 'target-1', 'sources': ['http://testserver/manytomanysource/1/', 'http://testserver/manytomanysource/2/', 'http://testserver/manytomanysource/3/']},\n            {'url': 'http://testserver/manytomanytarget/2/', 'name': 'target-2', 'sources': ['http://testserver/manytomanysource/2/', 'http://testserver/manytomanysource/3/']},\n            {'url': 'http://testserver/manytomanytarget/3/', 'name': 'target-3', 'sources': ['http://testserver/manytomanysource/3/']},\n            {'url': 'http://testserver/manytomanytarget/4/', 'name': 'target-4', 'sources': ['http://testserver/manytomanysource/1/', 'http://testserver/manytomanysource/3/']}\n        ]\n        assert serializer.data == expected\n\n    def test_data_cannot_be_accessed_prior_to_is_valid(self):\n        \"\"\"Test that .data cannot be accessed prior to .is_valid for hyperlinked serializers.\"\"\"\n        serializer = ManyToManySourceSerializer(\n            data={'name': 'test-source', 'targets': ['http://testserver/manytomanytarget/1/']},\n            context={'request': request}\n        )\n        with pytest.raises(AssertionError):\n            serializer.data\n\n\n@override_settings(ROOT_URLCONF='tests.test_relations_hyperlink')\nclass HyperlinkedForeignKeyTests(TestCase):\n    def setUp(self):\n        target = ForeignKeyTarget(name='target-1')\n        target.save()\n        new_target = ForeignKeyTarget(name='target-2')\n        new_target.save()\n        for idx in range(1, 4):\n            source = ForeignKeySource(name='source-%d' % idx, target=target)\n            source.save()\n\n    def test_foreign_key_retrieve(self):\n        queryset = ForeignKeySource.objects.all()\n        serializer = ForeignKeySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/foreignkeysource/1/', 'name': 'source-1', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/foreignkeysource/2/', 'name': 'source-2', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/foreignkeysource/3/', 'name': 'source-3', 'target': 'http://testserver/foreignkeytarget/1/'}\n        ]\n        with self.assertNumQueries(1):\n            assert serializer.data == expected\n\n    def test_reverse_foreign_key_retrieve(self):\n        queryset = ForeignKeyTarget.objects.all()\n        serializer = ForeignKeyTargetSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/foreignkeytarget/1/', 'name': 'target-1', 'sources': ['http://testserver/foreignkeysource/1/', 'http://testserver/foreignkeysource/2/', 'http://testserver/foreignkeysource/3/']},\n            {'url': 'http://testserver/foreignkeytarget/2/', 'name': 'target-2', 'sources': []},\n        ]\n        with self.assertNumQueries(3):\n            assert serializer.data == expected\n\n    def test_foreign_key_update(self):\n        data = {'url': 'http://testserver/foreignkeysource/1/', 'name': 'source-1', 'target': 'http://testserver/foreignkeytarget/2/'}\n        instance = ForeignKeySource.objects.get(pk=1)\n        serializer = ForeignKeySourceSerializer(instance, data=data, context={'request': request})\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = ForeignKeySource.objects.all()\n        serializer = ForeignKeySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/foreignkeysource/1/', 'name': 'source-1', 'target': 'http://testserver/foreignkeytarget/2/'},\n            {'url': 'http://testserver/foreignkeysource/2/', 'name': 'source-2', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/foreignkeysource/3/', 'name': 'source-3', 'target': 'http://testserver/foreignkeytarget/1/'}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_incorrect_type(self):\n        data = {'url': 'http://testserver/foreignkeysource/1/', 'name': 'source-1', 'target': 2}\n        instance = ForeignKeySource.objects.get(pk=1)\n        serializer = ForeignKeySourceSerializer(instance, data=data, context={'request': request})\n        assert not serializer.is_valid()\n        assert serializer.errors == {'target': ['Incorrect type. Expected URL string, received int.']}\n\n    def test_reverse_foreign_key_update(self):\n        data = {'url': 'http://testserver/foreignkeytarget/2/', 'name': 'target-2', 'sources': ['http://testserver/foreignkeysource/1/', 'http://testserver/foreignkeysource/3/']}\n        instance = ForeignKeyTarget.objects.get(pk=2)\n        serializer = ForeignKeyTargetSerializer(instance, data=data, context={'request': request})\n        assert serializer.is_valid()\n        # We shouldn't have saved anything to the db yet since save\n        # hasn't been called.\n        queryset = ForeignKeyTarget.objects.all()\n        new_serializer = ForeignKeyTargetSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/foreignkeytarget/1/', 'name': 'target-1', 'sources': ['http://testserver/foreignkeysource/1/', 'http://testserver/foreignkeysource/2/', 'http://testserver/foreignkeysource/3/']},\n            {'url': 'http://testserver/foreignkeytarget/2/', 'name': 'target-2', 'sources': []},\n        ]\n        assert new_serializer.data == expected\n\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure target 2 is update, and everything else is as expected\n        queryset = ForeignKeyTarget.objects.all()\n        serializer = ForeignKeyTargetSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/foreignkeytarget/1/', 'name': 'target-1', 'sources': ['http://testserver/foreignkeysource/2/']},\n            {'url': 'http://testserver/foreignkeytarget/2/', 'name': 'target-2', 'sources': ['http://testserver/foreignkeysource/1/', 'http://testserver/foreignkeysource/3/']},\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_create(self):\n        data = {'url': 'http://testserver/foreignkeysource/4/', 'name': 'source-4', 'target': 'http://testserver/foreignkeytarget/2/'}\n        serializer = ForeignKeySourceSerializer(data=data, context={'request': request})\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'source-4'\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = ForeignKeySource.objects.all()\n        serializer = ForeignKeySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/foreignkeysource/1/', 'name': 'source-1', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/foreignkeysource/2/', 'name': 'source-2', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/foreignkeysource/3/', 'name': 'source-3', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/foreignkeysource/4/', 'name': 'source-4', 'target': 'http://testserver/foreignkeytarget/2/'},\n        ]\n        assert serializer.data == expected\n\n    def test_reverse_foreign_key_create(self):\n        data = {'url': 'http://testserver/foreignkeytarget/3/', 'name': 'target-3', 'sources': ['http://testserver/foreignkeysource/1/', 'http://testserver/foreignkeysource/3/']}\n        serializer = ForeignKeyTargetSerializer(data=data, context={'request': request})\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'target-3'\n\n        # Ensure target 4 is added, and everything else is as expected\n        queryset = ForeignKeyTarget.objects.all()\n        serializer = ForeignKeyTargetSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/foreignkeytarget/1/', 'name': 'target-1', 'sources': ['http://testserver/foreignkeysource/2/']},\n            {'url': 'http://testserver/foreignkeytarget/2/', 'name': 'target-2', 'sources': []},\n            {'url': 'http://testserver/foreignkeytarget/3/', 'name': 'target-3', 'sources': ['http://testserver/foreignkeysource/1/', 'http://testserver/foreignkeysource/3/']},\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_with_invalid_null(self):\n        data = {'url': 'http://testserver/foreignkeysource/1/', 'name': 'source-1', 'target': None}\n        instance = ForeignKeySource.objects.get(pk=1)\n        serializer = ForeignKeySourceSerializer(instance, data=data, context={'request': request})\n        assert not serializer.is_valid()\n        assert serializer.errors == {'target': ['This field may not be null.']}\n\n\n@override_settings(ROOT_URLCONF='tests.test_relations_hyperlink')\nclass HyperlinkedNullableForeignKeyTests(TestCase):\n    def setUp(self):\n        target = ForeignKeyTarget(name='target-1')\n        target.save()\n        for idx in range(1, 4):\n            if idx == 3:\n                target = None\n            source = NullableForeignKeySource(name='source-%d' % idx, target=target)\n            source.save()\n\n    def test_foreign_key_retrieve_with_null(self):\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/nullableforeignkeysource/1/', 'name': 'source-1', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/nullableforeignkeysource/2/', 'name': 'source-2', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/nullableforeignkeysource/3/', 'name': 'source-3', 'target': None},\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_create_with_valid_null(self):\n        data = {'url': 'http://testserver/nullableforeignkeysource/4/', 'name': 'source-4', 'target': None}\n        serializer = NullableForeignKeySourceSerializer(data=data, context={'request': request})\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'source-4'\n\n        # Ensure source 4 is created, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/nullableforeignkeysource/1/', 'name': 'source-1', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/nullableforeignkeysource/2/', 'name': 'source-2', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/nullableforeignkeysource/3/', 'name': 'source-3', 'target': None},\n            {'url': 'http://testserver/nullableforeignkeysource/4/', 'name': 'source-4', 'target': None}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_create_with_valid_emptystring(self):\n        \"\"\"\n        The emptystring should be interpreted as null in the context\n        of relationships.\n        \"\"\"\n        data = {'url': 'http://testserver/nullableforeignkeysource/4/', 'name': 'source-4', 'target': ''}\n        expected_data = {'url': 'http://testserver/nullableforeignkeysource/4/', 'name': 'source-4', 'target': None}\n        serializer = NullableForeignKeySourceSerializer(data=data, context={'request': request})\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == expected_data\n        assert obj.name == 'source-4'\n\n        # Ensure source 4 is created, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/nullableforeignkeysource/1/', 'name': 'source-1', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/nullableforeignkeysource/2/', 'name': 'source-2', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/nullableforeignkeysource/3/', 'name': 'source-3', 'target': None},\n            {'url': 'http://testserver/nullableforeignkeysource/4/', 'name': 'source-4', 'target': None}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_with_valid_null(self):\n        data = {'url': 'http://testserver/nullableforeignkeysource/1/', 'name': 'source-1', 'target': None}\n        instance = NullableForeignKeySource.objects.get(pk=1)\n        serializer = NullableForeignKeySourceSerializer(instance, data=data, context={'request': request})\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/nullableforeignkeysource/1/', 'name': 'source-1', 'target': None},\n            {'url': 'http://testserver/nullableforeignkeysource/2/', 'name': 'source-2', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/nullableforeignkeysource/3/', 'name': 'source-3', 'target': None},\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_with_valid_emptystring(self):\n        \"\"\"\n        The emptystring should be interpreted as null in the context\n        of relationships.\n        \"\"\"\n        data = {'url': 'http://testserver/nullableforeignkeysource/1/', 'name': 'source-1', 'target': ''}\n        expected_data = {'url': 'http://testserver/nullableforeignkeysource/1/', 'name': 'source-1', 'target': None}\n        instance = NullableForeignKeySource.objects.get(pk=1)\n        serializer = NullableForeignKeySourceSerializer(instance, data=data, context={'request': request})\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == expected_data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/nullableforeignkeysource/1/', 'name': 'source-1', 'target': None},\n            {'url': 'http://testserver/nullableforeignkeysource/2/', 'name': 'source-2', 'target': 'http://testserver/foreignkeytarget/1/'},\n            {'url': 'http://testserver/nullableforeignkeysource/3/', 'name': 'source-3', 'target': None},\n        ]\n        assert serializer.data == expected\n\n\n@override_settings(ROOT_URLCONF='tests.test_relations_hyperlink')\nclass HyperlinkedNullableOneToOneTests(TestCase):\n    def setUp(self):\n        target = OneToOneTarget(name='target-1')\n        target.save()\n        new_target = OneToOneTarget(name='target-2')\n        new_target.save()\n        source = NullableOneToOneSource(name='source-1', target=target)\n        source.save()\n\n    def test_reverse_foreign_key_retrieve_with_null(self):\n        queryset = OneToOneTarget.objects.all()\n        serializer = NullableOneToOneTargetSerializer(queryset, many=True, context={'request': request})\n        expected = [\n            {'url': 'http://testserver/onetoonetarget/1/', 'name': 'target-1', 'nullable_source': 'http://testserver/nullableonetoonesource/1/'},\n            {'url': 'http://testserver/onetoonetarget/2/', 'name': 'target-2', 'nullable_source': None},\n        ]\n        assert serializer.data == expected\n"
  },
  {
    "path": "tests/test_relations_pk.py",
    "content": "import pytest\nfrom django.test import TestCase\n\nfrom rest_framework import serializers\nfrom tests.models import (\n    ForeignKeySource, ForeignKeySourceWithLimitedChoices,\n    ForeignKeySourceWithQLimitedChoices, ForeignKeyTarget, ManyToManySource,\n    ManyToManyTarget, NullableForeignKeySource, NullableOneToOneSource,\n    NullableUUIDForeignKeySource, OneToOnePKSource, OneToOneTarget,\n    UUIDForeignKeyTarget\n)\n\n\n# ManyToMany\nclass ManyToManyTargetSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = ManyToManyTarget\n        fields = ('id', 'name', 'sources')\n\n\nclass ManyToManySourceSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = ManyToManySource\n        fields = ('id', 'name', 'targets')\n\n\n# ForeignKey\nclass ForeignKeyTargetSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = ForeignKeyTarget\n        fields = ('id', 'name', 'sources')\n\n\nclass ForeignKeyTargetCallableSourceSerializer(serializers.ModelSerializer):\n    first_source = serializers.PrimaryKeyRelatedField(\n        source='get_first_source',\n        read_only=True,\n    )\n\n    class Meta:\n        model = ForeignKeyTarget\n        fields = ('id', 'name', 'first_source')\n\n\nclass ForeignKeyTargetPropertySourceSerializer(serializers.ModelSerializer):\n    first_source = serializers.PrimaryKeyRelatedField(read_only=True)\n\n    class Meta:\n        model = ForeignKeyTarget\n        fields = ('id', 'name', 'first_source')\n\n\nclass ForeignKeySourceSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = ForeignKeySource\n        fields = ('id', 'name', 'target')\n\n\nclass ForeignKeySourceWithLimitedChoicesSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = ForeignKeySourceWithLimitedChoices\n        fields = (\"id\", \"target\")\n\n\n# Nullable ForeignKey\nclass NullableForeignKeySourceSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = NullableForeignKeySource\n        fields = ('id', 'name', 'target')\n\n\n# Nullable UUIDForeignKey\nclass NullableUUIDForeignKeySourceSerializer(serializers.ModelSerializer):\n    target = serializers.PrimaryKeyRelatedField(\n        pk_field=serializers.UUIDField(),\n        queryset=UUIDForeignKeyTarget.objects.all(),\n        allow_null=True)\n\n    class Meta:\n        model = NullableUUIDForeignKeySource\n        fields = ('id', 'name', 'target')\n\n\n# Nullable OneToOne\nclass NullableOneToOneTargetSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = OneToOneTarget\n        fields = ('id', 'name', 'nullable_source')\n\n\nclass OneToOnePKSourceSerializer(serializers.ModelSerializer):\n\n    class Meta:\n        model = OneToOnePKSource\n        fields = '__all__'\n\n\nclass PKManyToManyTests(TestCase):\n    def setUp(self):\n        for idx in range(1, 4):\n            target = ManyToManyTarget(name='target-%d' % idx)\n            target.save()\n            source = ManyToManySource(name='source-%d' % idx)\n            source.save()\n            for target in ManyToManyTarget.objects.all():\n                source.targets.add(target)\n\n    def test_many_to_many_retrieve(self):\n        queryset = ManyToManySource.objects.all()\n        serializer = ManyToManySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'targets': [1]},\n            {'id': 2, 'name': 'source-2', 'targets': [1, 2]},\n            {'id': 3, 'name': 'source-3', 'targets': [1, 2, 3]}\n        ]\n        with self.assertNumQueries(4):\n            assert serializer.data == expected\n\n    def test_many_to_many_retrieve_prefetch_related(self):\n        queryset = ManyToManySource.objects.all().prefetch_related('targets')\n        serializer = ManyToManySourceSerializer(queryset, many=True)\n        with self.assertNumQueries(2):\n            serializer.data\n\n    def test_reverse_many_to_many_retrieve(self):\n        queryset = ManyToManyTarget.objects.all()\n        serializer = ManyToManyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': [1, 2, 3]},\n            {'id': 2, 'name': 'target-2', 'sources': [2, 3]},\n            {'id': 3, 'name': 'target-3', 'sources': [3]}\n        ]\n        with self.assertNumQueries(4):\n            assert serializer.data == expected\n\n    def test_many_to_many_update(self):\n        data = {'id': 1, 'name': 'source-1', 'targets': [1, 2, 3]}\n        instance = ManyToManySource.objects.get(pk=1)\n        serializer = ManyToManySourceSerializer(instance, data=data)\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = ManyToManySource.objects.all()\n        serializer = ManyToManySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'targets': [1, 2, 3]},\n            {'id': 2, 'name': 'source-2', 'targets': [1, 2]},\n            {'id': 3, 'name': 'source-3', 'targets': [1, 2, 3]}\n        ]\n        assert serializer.data == expected\n\n    def test_reverse_many_to_many_update(self):\n        data = {'id': 1, 'name': 'target-1', 'sources': [1]}\n        instance = ManyToManyTarget.objects.get(pk=1)\n        serializer = ManyToManyTargetSerializer(instance, data=data)\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure target 1 is updated, and everything else is as expected\n        queryset = ManyToManyTarget.objects.all()\n        serializer = ManyToManyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': [1]},\n            {'id': 2, 'name': 'target-2', 'sources': [2, 3]},\n            {'id': 3, 'name': 'target-3', 'sources': [3]}\n        ]\n        assert serializer.data == expected\n\n    def test_many_to_many_create(self):\n        data = {'id': 4, 'name': 'source-4', 'targets': [1, 3]}\n        serializer = ManyToManySourceSerializer(data=data)\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'source-4'\n\n        # Ensure source 4 is added, and everything else is as expected\n        queryset = ManyToManySource.objects.all()\n        serializer = ManyToManySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'targets': [1]},\n            {'id': 2, 'name': 'source-2', 'targets': [1, 2]},\n            {'id': 3, 'name': 'source-3', 'targets': [1, 2, 3]},\n            {'id': 4, 'name': 'source-4', 'targets': [1, 3]},\n        ]\n        assert serializer.data == expected\n\n    def test_many_to_many_unsaved(self):\n        source = ManyToManySource(name='source-unsaved')\n\n        serializer = ManyToManySourceSerializer(source)\n\n        expected = {'id': None, 'name': 'source-unsaved', 'targets': []}\n        # no query if source hasn't been created yet\n        with self.assertNumQueries(0):\n            assert serializer.data == expected\n\n    def test_reverse_many_to_many_create(self):\n        data = {'id': 4, 'name': 'target-4', 'sources': [1, 3]}\n        serializer = ManyToManyTargetSerializer(data=data)\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'target-4'\n\n        # Ensure target 4 is added, and everything else is as expected\n        queryset = ManyToManyTarget.objects.all()\n        serializer = ManyToManyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': [1, 2, 3]},\n            {'id': 2, 'name': 'target-2', 'sources': [2, 3]},\n            {'id': 3, 'name': 'target-3', 'sources': [3]},\n            {'id': 4, 'name': 'target-4', 'sources': [1, 3]}\n        ]\n        assert serializer.data == expected\n\n    def test_data_cannot_be_accessed_prior_to_is_valid(self):\n        \"\"\"Test that .data cannot be accessed prior to .is_valid for primary key serializers.\"\"\"\n        serializer = ManyToManySourceSerializer(\n            data={'name': 'test-source', 'targets': [1]}\n        )\n        with pytest.raises(AssertionError):\n            serializer.data\n\n\nclass PKForeignKeyTests(TestCase):\n    def setUp(self):\n        target = ForeignKeyTarget(name='target-1')\n        target.save()\n        new_target = ForeignKeyTarget(name='target-2')\n        new_target.save()\n        for idx in range(1, 4):\n            source = ForeignKeySource(name='source-%d' % idx, target=target)\n            source.save()\n\n    def test_foreign_key_retrieve(self):\n        queryset = ForeignKeySource.objects.all()\n        serializer = ForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 1},\n            {'id': 2, 'name': 'source-2', 'target': 1},\n            {'id': 3, 'name': 'source-3', 'target': 1}\n        ]\n        with self.assertNumQueries(1):\n            assert serializer.data == expected\n\n    def test_reverse_foreign_key_retrieve(self):\n        queryset = ForeignKeyTarget.objects.all()\n        serializer = ForeignKeyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': [1, 2, 3]},\n            {'id': 2, 'name': 'target-2', 'sources': []},\n        ]\n        with self.assertNumQueries(3):\n            assert serializer.data == expected\n\n    def test_reverse_foreign_key_retrieve_prefetch_related(self):\n        queryset = ForeignKeyTarget.objects.all().prefetch_related('sources')\n        serializer = ForeignKeyTargetSerializer(queryset, many=True)\n        with self.assertNumQueries(2):\n            serializer.data\n\n    def test_foreign_key_update(self):\n        data = {'id': 1, 'name': 'source-1', 'target': 2}\n        instance = ForeignKeySource.objects.get(pk=1)\n        serializer = ForeignKeySourceSerializer(instance, data=data)\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = ForeignKeySource.objects.all()\n        serializer = ForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 2},\n            {'id': 2, 'name': 'source-2', 'target': 1},\n            {'id': 3, 'name': 'source-3', 'target': 1}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_incorrect_type(self):\n        data = {'id': 1, 'name': 'source-1', 'target': 'foo'}\n        instance = ForeignKeySource.objects.get(pk=1)\n        serializer = ForeignKeySourceSerializer(instance, data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {'target': ['Incorrect type. Expected pk value, received str.']}\n\n    def test_reverse_foreign_key_update(self):\n        data = {'id': 2, 'name': 'target-2', 'sources': [1, 3]}\n        instance = ForeignKeyTarget.objects.get(pk=2)\n        serializer = ForeignKeyTargetSerializer(instance, data=data)\n        assert serializer.is_valid()\n        # We shouldn't have saved anything to the db yet since save\n        # hasn't been called.\n        queryset = ForeignKeyTarget.objects.all()\n        new_serializer = ForeignKeyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': [1, 2, 3]},\n            {'id': 2, 'name': 'target-2', 'sources': []},\n        ]\n        assert new_serializer.data == expected\n\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure target 2 is update, and everything else is as expected\n        queryset = ForeignKeyTarget.objects.all()\n        serializer = ForeignKeyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': [2]},\n            {'id': 2, 'name': 'target-2', 'sources': [1, 3]},\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_create(self):\n        data = {'id': 4, 'name': 'source-4', 'target': 2}\n        serializer = ForeignKeySourceSerializer(data=data)\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'source-4'\n\n        # Ensure source 4 is added, and everything else is as expected\n        queryset = ForeignKeySource.objects.all()\n        serializer = ForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 1},\n            {'id': 2, 'name': 'source-2', 'target': 1},\n            {'id': 3, 'name': 'source-3', 'target': 1},\n            {'id': 4, 'name': 'source-4', 'target': 2},\n        ]\n        assert serializer.data == expected\n\n    def test_reverse_foreign_key_create(self):\n        data = {'id': 3, 'name': 'target-3', 'sources': [1, 3]}\n        serializer = ForeignKeyTargetSerializer(data=data)\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'target-3'\n\n        # Ensure target 3 is added, and everything else is as expected\n        queryset = ForeignKeyTarget.objects.all()\n        serializer = ForeignKeyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': [2]},\n            {'id': 2, 'name': 'target-2', 'sources': []},\n            {'id': 3, 'name': 'target-3', 'sources': [1, 3]},\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_with_invalid_null(self):\n        data = {'id': 1, 'name': 'source-1', 'target': None}\n        instance = ForeignKeySource.objects.get(pk=1)\n        serializer = ForeignKeySourceSerializer(instance, data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {'target': ['This field may not be null.']}\n\n    def test_foreign_key_with_unsaved(self):\n        source = ForeignKeySource(name='source-unsaved')\n        expected = {'id': None, 'name': 'source-unsaved', 'target': None}\n\n        serializer = ForeignKeySourceSerializer(source)\n\n        # no query if source hasn't been created yet\n        with self.assertNumQueries(0):\n            assert serializer.data == expected\n\n    def test_foreign_key_with_empty(self):\n        \"\"\"\n        Regression test for #1072\n\n        https://github.com/encode/django-rest-framework/issues/1072\n        \"\"\"\n        serializer = NullableForeignKeySourceSerializer()\n        assert serializer.data['target'] is None\n\n    def test_foreign_key_not_required(self):\n        \"\"\"\n        Let's say we wanted to fill the non-nullable model field inside\n        Model.save(), we would make it empty and not required.\n        \"\"\"\n        class ModelSerializer(ForeignKeySourceSerializer):\n            class Meta(ForeignKeySourceSerializer.Meta):\n                extra_kwargs = {'target': {'required': False}}\n        serializer = ModelSerializer(data={'name': 'test'})\n        serializer.is_valid(raise_exception=True)\n        assert 'target' not in serializer.validated_data\n\n    def test_queryset_size_without_limited_choices(self):\n        limited_target = ForeignKeyTarget(name=\"limited-target\")\n        limited_target.save()\n        queryset = ForeignKeySourceSerializer().fields[\"target\"].get_queryset()\n        assert len(queryset) == 3\n\n    def test_queryset_size_with_limited_choices(self):\n        limited_target = ForeignKeyTarget(name=\"limited-target\")\n        limited_target.save()\n        queryset = ForeignKeySourceWithLimitedChoicesSerializer().fields[\"target\"].get_queryset()\n        assert len(queryset) == 1\n\n    def test_queryset_size_with_Q_limited_choices(self):\n        limited_target = ForeignKeyTarget(name=\"limited-target\")\n        limited_target.save()\n\n        class QLimitedChoicesSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = ForeignKeySourceWithQLimitedChoices\n                fields = (\"id\", \"target\")\n\n        queryset = QLimitedChoicesSerializer().fields[\"target\"].get_queryset()\n        assert len(queryset) == 1\n\n\nclass PKRelationTests(TestCase):\n\n    def setUp(self):\n        self.target = ForeignKeyTarget.objects.create(name='target-1')\n        ForeignKeySource.objects.create(name='source-1', target=self.target)\n        ForeignKeySource.objects.create(name='source-2', target=self.target)\n\n    def test_relation_field_callable_source(self):\n        serializer = ForeignKeyTargetCallableSourceSerializer(self.target)\n        expected = {\n            'id': 1,\n            'name': 'target-1',\n            'first_source': 1,\n        }\n        with self.assertNumQueries(1):\n            self.assertEqual(serializer.data, expected)\n\n    def test_relation_field_property_source(self):\n        serializer = ForeignKeyTargetPropertySourceSerializer(self.target)\n        expected = {\n            'id': 1,\n            'name': 'target-1',\n            'first_source': 1,\n        }\n        with self.assertNumQueries(1):\n            self.assertEqual(serializer.data, expected)\n\n\nclass PKNullableForeignKeyTests(TestCase):\n    def setUp(self):\n        target = ForeignKeyTarget(name='target-1')\n        target.save()\n        for idx in range(1, 4):\n            if idx == 3:\n                target = None\n            source = NullableForeignKeySource(name='source-%d' % idx, target=target)\n            source.save()\n\n    def test_foreign_key_retrieve_with_null(self):\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 1},\n            {'id': 2, 'name': 'source-2', 'target': 1},\n            {'id': 3, 'name': 'source-3', 'target': None},\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_create_with_valid_null(self):\n        data = {'id': 4, 'name': 'source-4', 'target': None}\n        serializer = NullableForeignKeySourceSerializer(data=data)\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'source-4'\n\n        # Ensure source 4 is created, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 1},\n            {'id': 2, 'name': 'source-2', 'target': 1},\n            {'id': 3, 'name': 'source-3', 'target': None},\n            {'id': 4, 'name': 'source-4', 'target': None}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_create_with_valid_emptystring(self):\n        \"\"\"\n        The emptystring should be interpreted as null in the context\n        of relationships.\n        \"\"\"\n        data = {'id': 4, 'name': 'source-4', 'target': ''}\n        expected_data = {'id': 4, 'name': 'source-4', 'target': None}\n        serializer = NullableForeignKeySourceSerializer(data=data)\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == expected_data\n        assert obj.name == 'source-4'\n\n        # Ensure source 4 is created, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 1},\n            {'id': 2, 'name': 'source-2', 'target': 1},\n            {'id': 3, 'name': 'source-3', 'target': None},\n            {'id': 4, 'name': 'source-4', 'target': None}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_with_valid_null(self):\n        data = {'id': 1, 'name': 'source-1', 'target': None}\n        instance = NullableForeignKeySource.objects.get(pk=1)\n        serializer = NullableForeignKeySourceSerializer(instance, data=data)\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': None},\n            {'id': 2, 'name': 'source-2', 'target': 1},\n            {'id': 3, 'name': 'source-3', 'target': None}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_with_valid_emptystring(self):\n        \"\"\"\n        The emptystring should be interpreted as null in the context\n        of relationships.\n        \"\"\"\n        data = {'id': 1, 'name': 'source-1', 'target': ''}\n        expected_data = {'id': 1, 'name': 'source-1', 'target': None}\n        instance = NullableForeignKeySource.objects.get(pk=1)\n        serializer = NullableForeignKeySourceSerializer(instance, data=data)\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == expected_data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': None},\n            {'id': 2, 'name': 'source-2', 'target': 1},\n            {'id': 3, 'name': 'source-3', 'target': None}\n        ]\n        assert serializer.data == expected\n\n    def test_null_uuid_foreign_key_serializes_as_none(self):\n        source = NullableUUIDForeignKeySource(name='Source')\n        serializer = NullableUUIDForeignKeySourceSerializer(source)\n        data = serializer.data\n        assert data[\"target\"] is None\n\n    def test_nullable_uuid_foreign_key_is_valid_when_none(self):\n        data = {\"name\": \"Source\", \"target\": None}\n        serializer = NullableUUIDForeignKeySourceSerializer(data=data)\n        assert serializer.is_valid(), serializer.errors\n\n\nclass PKNullableOneToOneTests(TestCase):\n    def setUp(self):\n        target = OneToOneTarget(name='target-1')\n        target.save()\n        new_target = OneToOneTarget(name='target-2')\n        new_target.save()\n        source = NullableOneToOneSource(name='source-1', target=new_target)\n        source.save()\n\n    def test_reverse_foreign_key_retrieve_with_null(self):\n        queryset = OneToOneTarget.objects.all()\n        serializer = NullableOneToOneTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'nullable_source': None},\n            {'id': 2, 'name': 'target-2', 'nullable_source': 1},\n        ]\n        assert serializer.data == expected\n\n\nclass OneToOnePrimaryKeyTests(TestCase):\n\n    def setUp(self):\n        # Given: Some target models already exist\n        self.target = target = OneToOneTarget(name='target-1')\n        target.save()\n        self.alt_target = alt_target = OneToOneTarget(name='target-2')\n        alt_target.save()\n\n    def test_one_to_one_when_primary_key(self):\n        # When: Creating a Source pointing at the id of the second Target\n        target_pk = self.alt_target.id\n        source = OneToOnePKSourceSerializer(data={'name': 'source-2', 'target': target_pk})\n        # Then: The source is valid with the serializer\n        if not source.is_valid():\n            self.fail(f\"Expected OneToOnePKTargetSerializer to be valid but had errors: {source.errors}\")\n        # Then: Saving the serializer creates a new object\n        new_source = source.save()\n        # Then: The new object has the same pk as the target object\n        self.assertEqual(new_source.pk, target_pk)\n\n    def test_one_to_one_when_primary_key_no_duplicates(self):\n        # When: Creating a Source pointing at the id of the second Target\n        target_pk = self.target.id\n        data = {'name': 'source-1', 'target': target_pk}\n        source = OneToOnePKSourceSerializer(data=data)\n        # Then: The source is valid with the serializer\n        self.assertTrue(source.is_valid())\n        # Then: Saving the serializer creates a new object\n        new_source = source.save()\n        # Then: The new object has the same pk as the target object\n        self.assertEqual(new_source.pk, target_pk)\n        # When: Trying to create a second object\n        second_source = OneToOnePKSourceSerializer(data=data)\n        self.assertFalse(second_source.is_valid())\n        expected = {'target': ['one to one pk source with this target already exists.']}\n        self.assertDictEqual(second_source.errors, expected)\n\n    def test_one_to_one_when_primary_key_does_not_exist(self):\n        # Given: a target PK that does not exist\n        target_pk = self.target.pk + self.alt_target.pk\n        source = OneToOnePKSourceSerializer(data={'name': 'source-2', 'target': target_pk})\n        # Then: The source is not valid with the serializer\n        self.assertFalse(source.is_valid())\n        self.assertIn(\"Invalid pk\", source.errors['target'][0])\n        self.assertIn(\"object does not exist\", source.errors['target'][0])\n"
  },
  {
    "path": "tests/test_relations_slug.py",
    "content": "from django.test import TestCase\n\nfrom rest_framework import serializers\nfrom tests.models import (\n    ForeignKeySource, ForeignKeyTarget, NullableForeignKeySource\n)\n\n\nclass ForeignKeyTargetSerializer(serializers.ModelSerializer):\n    sources = serializers.SlugRelatedField(\n        slug_field='name',\n        queryset=ForeignKeySource.objects.all(),\n        many=True\n    )\n\n    class Meta:\n        model = ForeignKeyTarget\n        fields = '__all__'\n\n\nclass ForeignKeySourceSerializer(serializers.ModelSerializer):\n    target = serializers.SlugRelatedField(\n        slug_field='name',\n        queryset=ForeignKeyTarget.objects.all()\n    )\n\n    class Meta:\n        model = ForeignKeySource\n        fields = '__all__'\n\n\nclass NullableForeignKeySourceSerializer(serializers.ModelSerializer):\n    target = serializers.SlugRelatedField(\n        slug_field='name',\n        queryset=ForeignKeyTarget.objects.all(),\n        allow_null=True\n    )\n\n    class Meta:\n        model = NullableForeignKeySource\n        fields = '__all__'\n\n\n# TODO: M2M Tests, FKTests (Non-nullable), One2One\nclass SlugForeignKeyTests(TestCase):\n    def setUp(self):\n        target = ForeignKeyTarget(name='target-1')\n        target.save()\n        new_target = ForeignKeyTarget(name='target-2')\n        new_target.save()\n        for idx in range(1, 4):\n            source = ForeignKeySource(name='source-%d' % idx, target=target)\n            source.save()\n\n    def test_foreign_key_retrieve(self):\n        queryset = ForeignKeySource.objects.all()\n        serializer = ForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 'target-1'},\n            {'id': 2, 'name': 'source-2', 'target': 'target-1'},\n            {'id': 3, 'name': 'source-3', 'target': 'target-1'}\n        ]\n        with self.assertNumQueries(4):\n            assert serializer.data == expected\n\n    def test_foreign_key_retrieve_select_related(self):\n        queryset = ForeignKeySource.objects.all().select_related('target')\n        serializer = ForeignKeySourceSerializer(queryset, many=True)\n        with self.assertNumQueries(1):\n            serializer.data\n\n    def test_reverse_foreign_key_retrieve(self):\n        queryset = ForeignKeyTarget.objects.all()\n        serializer = ForeignKeyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': ['source-1', 'source-2', 'source-3']},\n            {'id': 2, 'name': 'target-2', 'sources': []},\n        ]\n        assert serializer.data == expected\n\n    def test_reverse_foreign_key_retrieve_prefetch_related(self):\n        queryset = ForeignKeyTarget.objects.all().prefetch_related('sources')\n        serializer = ForeignKeyTargetSerializer(queryset, many=True)\n        with self.assertNumQueries(2):\n            serializer.data\n\n    def test_foreign_key_update(self):\n        data = {'id': 1, 'name': 'source-1', 'target': 'target-2'}\n        instance = ForeignKeySource.objects.get(pk=1)\n        serializer = ForeignKeySourceSerializer(instance, data=data)\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = ForeignKeySource.objects.all()\n        serializer = ForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 'target-2'},\n            {'id': 2, 'name': 'source-2', 'target': 'target-1'},\n            {'id': 3, 'name': 'source-3', 'target': 'target-1'}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_incorrect_type(self):\n        data = {'id': 1, 'name': 'source-1', 'target': 123}\n        instance = ForeignKeySource.objects.get(pk=1)\n        serializer = ForeignKeySourceSerializer(instance, data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {'target': ['Object with name=123 does not exist.']}\n\n    def test_reverse_foreign_key_update(self):\n        data = {'id': 2, 'name': 'target-2', 'sources': ['source-1', 'source-3']}\n        instance = ForeignKeyTarget.objects.get(pk=2)\n        serializer = ForeignKeyTargetSerializer(instance, data=data)\n        assert serializer.is_valid()\n        # We shouldn't have saved anything to the db yet since save\n        # hasn't been called.\n        queryset = ForeignKeyTarget.objects.all()\n        new_serializer = ForeignKeyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': ['source-1', 'source-2', 'source-3']},\n            {'id': 2, 'name': 'target-2', 'sources': []},\n        ]\n        assert new_serializer.data == expected\n\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure target 2 is update, and everything else is as expected\n        queryset = ForeignKeyTarget.objects.all()\n        serializer = ForeignKeyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': ['source-2']},\n            {'id': 2, 'name': 'target-2', 'sources': ['source-1', 'source-3']},\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_create(self):\n        data = {'id': 4, 'name': 'source-4', 'target': 'target-2'}\n        serializer = ForeignKeySourceSerializer(data=data)\n        serializer.is_valid()\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'source-4'\n\n        # Ensure source 4 is added, and everything else is as expected\n        queryset = ForeignKeySource.objects.all()\n        serializer = ForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 'target-1'},\n            {'id': 2, 'name': 'source-2', 'target': 'target-1'},\n            {'id': 3, 'name': 'source-3', 'target': 'target-1'},\n            {'id': 4, 'name': 'source-4', 'target': 'target-2'},\n        ]\n        assert serializer.data == expected\n\n    def test_reverse_foreign_key_create(self):\n        data = {'id': 3, 'name': 'target-3', 'sources': ['source-1', 'source-3']}\n        serializer = ForeignKeyTargetSerializer(data=data)\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'target-3'\n\n        # Ensure target 3 is added, and everything else is as expected\n        queryset = ForeignKeyTarget.objects.all()\n        serializer = ForeignKeyTargetSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'target-1', 'sources': ['source-2']},\n            {'id': 2, 'name': 'target-2', 'sources': []},\n            {'id': 3, 'name': 'target-3', 'sources': ['source-1', 'source-3']},\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_with_invalid_null(self):\n        data = {'id': 1, 'name': 'source-1', 'target': None}\n        instance = ForeignKeySource.objects.get(pk=1)\n        serializer = ForeignKeySourceSerializer(instance, data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {'target': ['This field may not be null.']}\n\n\nclass SlugNullableForeignKeyTests(TestCase):\n    def setUp(self):\n        target = ForeignKeyTarget(name='target-1')\n        target.save()\n        for idx in range(1, 4):\n            if idx == 3:\n                target = None\n            source = NullableForeignKeySource(name='source-%d' % idx, target=target)\n            source.save()\n\n    def test_foreign_key_retrieve_with_null(self):\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 'target-1'},\n            {'id': 2, 'name': 'source-2', 'target': 'target-1'},\n            {'id': 3, 'name': 'source-3', 'target': None},\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_create_with_valid_null(self):\n        data = {'id': 4, 'name': 'source-4', 'target': None}\n        serializer = NullableForeignKeySourceSerializer(data=data)\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == data\n        assert obj.name == 'source-4'\n\n        # Ensure source 4 is created, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 'target-1'},\n            {'id': 2, 'name': 'source-2', 'target': 'target-1'},\n            {'id': 3, 'name': 'source-3', 'target': None},\n            {'id': 4, 'name': 'source-4', 'target': None}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_create_with_valid_emptystring(self):\n        \"\"\"\n        The emptystring should be interpreted as null in the context\n        of relationships.\n        \"\"\"\n        data = {'id': 4, 'name': 'source-4', 'target': ''}\n        expected_data = {'id': 4, 'name': 'source-4', 'target': None}\n        serializer = NullableForeignKeySourceSerializer(data=data)\n        assert serializer.is_valid()\n        obj = serializer.save()\n        assert serializer.data == expected_data\n        assert obj.name == 'source-4'\n\n        # Ensure source 4 is created, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': 'target-1'},\n            {'id': 2, 'name': 'source-2', 'target': 'target-1'},\n            {'id': 3, 'name': 'source-3', 'target': None},\n            {'id': 4, 'name': 'source-4', 'target': None}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_with_valid_null(self):\n        data = {'id': 1, 'name': 'source-1', 'target': None}\n        instance = NullableForeignKeySource.objects.get(pk=1)\n        serializer = NullableForeignKeySourceSerializer(instance, data=data)\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': None},\n            {'id': 2, 'name': 'source-2', 'target': 'target-1'},\n            {'id': 3, 'name': 'source-3', 'target': None}\n        ]\n        assert serializer.data == expected\n\n    def test_foreign_key_update_with_valid_emptystring(self):\n        \"\"\"\n        The emptystring should be interpreted as null in the context\n        of relationships.\n        \"\"\"\n        data = {'id': 1, 'name': 'source-1', 'target': ''}\n        expected_data = {'id': 1, 'name': 'source-1', 'target': None}\n        instance = NullableForeignKeySource.objects.get(pk=1)\n        serializer = NullableForeignKeySourceSerializer(instance, data=data)\n        assert serializer.is_valid()\n        serializer.save()\n        assert serializer.data == expected_data\n\n        # Ensure source 1 is updated, and everything else is as expected\n        queryset = NullableForeignKeySource.objects.all()\n        serializer = NullableForeignKeySourceSerializer(queryset, many=True)\n        expected = [\n            {'id': 1, 'name': 'source-1', 'target': None},\n            {'id': 2, 'name': 'source-2', 'target': 'target-1'},\n            {'id': 3, 'name': 'source-3', 'target': None}\n        ]\n        assert serializer.data == expected\n"
  },
  {
    "path": "tests/test_renderers.py",
    "content": "import re\nfrom collections.abc import MutableMapping\nfrom datetime import datetime\nfrom zoneinfo import ZoneInfo\n\nimport pytest\nfrom django.core.cache import cache\nfrom django.db import models\nfrom django.http.request import HttpRequest\nfrom django.test import TestCase, override_settings\nfrom django.urls import include, path, re_path\nfrom django.utils.safestring import SafeText\nfrom django.utils.translation import gettext_lazy as _\n\nfrom rest_framework import permissions, serializers, status\nfrom rest_framework.decorators import action\nfrom rest_framework.renderers import (\n    AdminRenderer, BaseRenderer, BrowsableAPIRenderer, HTMLFormRenderer,\n    JSONRenderer, StaticHTMLRenderer\n)\nfrom rest_framework.request import Request\nfrom rest_framework.response import Response\nfrom rest_framework.routers import SimpleRouter\nfrom rest_framework.settings import api_settings\nfrom rest_framework.test import APIRequestFactory, URLPatternsTestCase\nfrom rest_framework.utils import json\nfrom rest_framework.views import APIView\nfrom rest_framework.viewsets import ViewSet\n\nDUMMYSTATUS = status.HTTP_200_OK\nDUMMYCONTENT = 'dummycontent'\n\n\ndef RENDERER_A_SERIALIZER(x):\n    return ('Renderer A: %s' % x).encode('ascii')\n\n\ndef RENDERER_B_SERIALIZER(x):\n    return ('Renderer B: %s' % x).encode('ascii')\n\n\nexpected_results = [\n    ((elem for elem in [1, 2, 3]), JSONRenderer, b'[1,2,3]')  # Generator\n]\n\n\nclass DummyTestModel(models.Model):\n    name = models.CharField(max_length=42, default='')\n\n\nclass BasicRendererTests(TestCase):\n    def test_expected_results(self):\n        for value, renderer_cls, expected in expected_results:\n            output = renderer_cls().render(value)\n            self.assertEqual(output, expected)\n\n\nclass RendererA(BaseRenderer):\n    media_type = 'mock/renderera'\n    format = \"formata\"\n\n    def render(self, data, media_type=None, renderer_context=None):\n        return RENDERER_A_SERIALIZER(data)\n\n\nclass RendererB(BaseRenderer):\n    media_type = 'mock/rendererb'\n    format = \"formatb\"\n\n    def render(self, data, media_type=None, renderer_context=None):\n        return RENDERER_B_SERIALIZER(data)\n\n\nclass MockView(APIView):\n    renderer_classes = (RendererA, RendererB)\n\n    def get(self, request, **kwargs):\n        return Response(DUMMYCONTENT, status=DUMMYSTATUS)\n\n\nclass MockGETView(APIView):\n    def get(self, request, **kwargs):\n        return Response({'foo': ['bar', 'baz']})\n\n\nclass MockPOSTView(APIView):\n    def post(self, request, **kwargs):\n        return Response({'foo': request.data})\n\n\nclass EmptyGETView(APIView):\n    renderer_classes = (JSONRenderer,)\n\n    def get(self, request, **kwargs):\n        return Response(status=status.HTTP_204_NO_CONTENT)\n\n\nclass HTMLView(APIView):\n    renderer_classes = (BrowsableAPIRenderer, )\n\n    def get(self, request, **kwargs):\n        return Response('text')\n\n\nclass HTMLView1(APIView):\n    renderer_classes = (BrowsableAPIRenderer, JSONRenderer)\n\n    def get(self, request, **kwargs):\n        return Response('text')\n\n\nurlpatterns = [\n    re_path(r'^.*\\.(?P<format>.+)$', MockView.as_view(renderer_classes=[RendererA, RendererB])),\n    path('', MockView.as_view(renderer_classes=[RendererA, RendererB])),\n    path('cache', MockGETView.as_view()),\n    path('parseerror', MockPOSTView.as_view(renderer_classes=[JSONRenderer, BrowsableAPIRenderer])),\n    path('html', HTMLView.as_view()),\n    path('html1', HTMLView1.as_view()),\n    path('empty', EmptyGETView.as_view()),\n    path('api', include('rest_framework.urls', namespace='rest_framework'))\n]\n\n\nclass POSTDeniedPermission(permissions.BasePermission):\n    def has_permission(self, request, view):\n        return request.method != 'POST'\n\n\nclass POSTDeniedView(APIView):\n    renderer_classes = (BrowsableAPIRenderer,)\n    permission_classes = (POSTDeniedPermission,)\n\n    def get(self, request):\n        return Response()\n\n    def post(self, request):\n        return Response()\n\n    def put(self, request):\n        return Response()\n\n    def patch(self, request):\n        return Response()\n\n\nclass DocumentingRendererTests(TestCase):\n    def test_only_permitted_forms_are_displayed(self):\n        view = POSTDeniedView.as_view()\n        request = APIRequestFactory().get('/')\n        response = view(request).render()\n        self.assertNotContains(response, '>POST<')\n        self.assertContains(response, '>PUT<')\n        self.assertContains(response, '>PATCH<')\n\n\n@override_settings(ROOT_URLCONF='tests.test_renderers')\nclass RendererEndToEndTests(TestCase):\n    \"\"\"\n    End-to-end testing of renderers using an RendererMixin on a generic view.\n    \"\"\"\n    def test_default_renderer_serializes_content(self):\n        \"\"\"If the Accept header is not set the default renderer should serialize the response.\"\"\"\n        resp = self.client.get('/')\n        self.assertEqual(resp['Content-Type'], RendererA.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_A_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_head_method_serializes_no_content(self):\n        \"\"\"No response must be included in HEAD requests.\"\"\"\n        resp = self.client.head('/')\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n        self.assertEqual(resp['Content-Type'], RendererA.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, b'')\n\n    def test_default_renderer_serializes_content_on_accept_any(self):\n        \"\"\"If the Accept header is set to */* the default renderer should serialize the response.\"\"\"\n        resp = self.client.get('/', HTTP_ACCEPT='*/*')\n        self.assertEqual(resp['Content-Type'], RendererA.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_A_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_specified_renderer_serializes_content_default_case(self):\n        \"\"\"If the Accept header is set the specified renderer should serialize the response.\n        (In this case we check that works for the default renderer)\"\"\"\n        resp = self.client.get('/', HTTP_ACCEPT=RendererA.media_type)\n        self.assertEqual(resp['Content-Type'], RendererA.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_A_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_specified_renderer_serializes_content_non_default_case(self):\n        \"\"\"If the Accept header is set the specified renderer should serialize the response.\n        (In this case we check that works for a non-default renderer)\"\"\"\n        resp = self.client.get('/', HTTP_ACCEPT=RendererB.media_type)\n        self.assertEqual(resp['Content-Type'], RendererB.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_B_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_unsatisfiable_accept_header_on_request_returns_406_status(self):\n        \"\"\"If the Accept header is unsatisfiable we should return a 406 Not Acceptable response.\"\"\"\n        resp = self.client.get('/', HTTP_ACCEPT='foo/bar')\n        self.assertEqual(resp.status_code, status.HTTP_406_NOT_ACCEPTABLE)\n\n    def test_specified_renderer_serializes_content_on_format_query(self):\n        \"\"\"If a 'format' query is specified, the renderer with the matching\n        format attribute should serialize the response.\"\"\"\n        param = '?%s=%s' % (\n            api_settings.URL_FORMAT_OVERRIDE,\n            RendererB.format\n        )\n        resp = self.client.get('/' + param)\n        self.assertEqual(resp['Content-Type'], RendererB.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_B_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_specified_renderer_serializes_content_on_format_kwargs(self):\n        \"\"\"If a 'format' keyword arg is specified, the renderer with the matching\n        format attribute should serialize the response.\"\"\"\n        resp = self.client.get('/something.formatb')\n        self.assertEqual(resp['Content-Type'], RendererB.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_B_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_specified_renderer_is_used_on_format_query_with_matching_accept(self):\n        \"\"\"If both a 'format' query and a matching Accept header specified,\n        the renderer with the matching format attribute should serialize the response.\"\"\"\n        param = '?%s=%s' % (\n            api_settings.URL_FORMAT_OVERRIDE,\n            RendererB.format\n        )\n        resp = self.client.get('/' + param,\n                               HTTP_ACCEPT=RendererB.media_type)\n        self.assertEqual(resp['Content-Type'], RendererB.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_B_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_parse_error_renderers_browsable_api(self):\n        \"\"\"Invalid data should still render the browsable API correctly.\"\"\"\n        resp = self.client.post('/parseerror', data='foobar', content_type='application/json', HTTP_ACCEPT='text/html')\n        self.assertEqual(resp['Content-Type'], 'text/html; charset=utf-8')\n        self.assertEqual(resp.status_code, status.HTTP_400_BAD_REQUEST)\n\n    def test_204_no_content_responses_have_no_content_type_set(self):\n        \"\"\"\n        Regression test for #1196\n\n        https://github.com/encode/django-rest-framework/issues/1196\n        \"\"\"\n        resp = self.client.get('/empty')\n        self.assertEqual(resp.get('Content-Type', None), None)\n        self.assertEqual(resp.status_code, status.HTTP_204_NO_CONTENT)\n\n    def test_contains_headers_of_api_response(self):\n        \"\"\"\n        Issue #1437\n\n        Test we display the headers of the API response and not those from the\n        HTML response\n        \"\"\"\n        resp = self.client.get('/html1')\n        self.assertContains(resp, '>GET, HEAD, OPTIONS<')\n        self.assertContains(resp, '>application/json<')\n        self.assertNotContains(resp, '>text/html; charset=utf-8<')\n\n\n_flat_repr = '{\"foo\":[\"bar\",\"baz\"]}'\n_indented_repr = '{\\n  \"foo\": [\\n    \"bar\",\\n    \"baz\"\\n  ]\\n}'\n\n\ndef strip_trailing_whitespace(content):\n    \"\"\"\n    Seems to be some inconsistencies re. trailing whitespace with\n    different versions of the json lib.\n    \"\"\"\n    return re.sub(' +\\n', '\\n', content)\n\n\nclass BaseRendererTests(TestCase):\n    \"\"\"\n    Tests BaseRenderer\n    \"\"\"\n    def test_render_raise_error(self):\n        \"\"\"\n        BaseRenderer.render should raise NotImplementedError\n        \"\"\"\n        with pytest.raises(NotImplementedError):\n            BaseRenderer().render('test')\n\n\nclass JSONRendererTests(TestCase):\n    \"\"\"\n    Tests specific to the JSON Renderer\n    \"\"\"\n\n    def test_render_lazy_strings(self):\n        \"\"\"\n        JSONRenderer should deal with lazy translated strings.\n        \"\"\"\n        ret = JSONRenderer().render(_('test'))\n        self.assertEqual(ret, b'\"test\"')\n\n    def test_render_queryset_values(self):\n        o = DummyTestModel.objects.create(name='dummy')\n        qs = DummyTestModel.objects.values('id', 'name')\n        ret = JSONRenderer().render(qs)\n        data = json.loads(ret.decode())\n        self.assertEqual(data, [{'id': o.id, 'name': o.name}])\n\n    def test_render_queryset_values_list(self):\n        o = DummyTestModel.objects.create(name='dummy')\n        qs = DummyTestModel.objects.values_list('id', 'name')\n        ret = JSONRenderer().render(qs)\n        data = json.loads(ret.decode())\n        self.assertEqual(data, [[o.id, o.name]])\n\n    def test_render_dict_abc_obj(self):\n        class Dict(MutableMapping):\n            def __init__(self):\n                self._dict = {}\n\n            def __getitem__(self, key):\n                return self._dict.__getitem__(key)\n\n            def __setitem__(self, key, value):\n                return self._dict.__setitem__(key, value)\n\n            def __delitem__(self, key):\n                return self._dict.__delitem__(key)\n\n            def __iter__(self):\n                return self._dict.__iter__()\n\n            def __len__(self):\n                return self._dict.__len__()\n\n            def keys(self):\n                return self._dict.keys()\n\n        x = Dict()\n        x['key'] = 'string value'\n        x[2] = 3\n        ret = JSONRenderer().render(x)\n        data = json.loads(ret.decode())\n        self.assertEqual(data, {'key': 'string value', '2': 3})\n\n    def test_render_obj_with_getitem(self):\n        class DictLike:\n            def __init__(self):\n                self._dict = {}\n\n            def set(self, value):\n                self._dict = dict(value)\n\n            def __getitem__(self, key):\n                return self._dict[key]\n\n        x = DictLike()\n        x.set({'a': 1, 'b': 'string'})\n        with self.assertRaises(TypeError):\n            JSONRenderer().render(x)\n\n    def test_float_strictness(self):\n        renderer = JSONRenderer()\n\n        # Default to strict\n        for value in [float('inf'), float('-inf'), float('nan')]:\n            with pytest.raises(ValueError):\n                renderer.render(value)\n\n        renderer.strict = False\n        assert renderer.render(float('inf')) == b'Infinity'\n        assert renderer.render(float('-inf')) == b'-Infinity'\n        assert renderer.render(float('nan')) == b'NaN'\n\n    def test_without_content_type_args(self):\n        \"\"\"\n        Test basic JSON rendering.\n        \"\"\"\n        obj = {'foo': ['bar', 'baz']}\n        renderer = JSONRenderer()\n        content = renderer.render(obj, 'application/json')\n        # Fix failing test case which depends on version of JSON library.\n        self.assertEqual(content.decode(), _flat_repr)\n\n    def test_with_content_type_args(self):\n        \"\"\"\n        Test JSON rendering with additional content type arguments supplied.\n        \"\"\"\n        obj = {'foo': ['bar', 'baz']}\n        renderer = JSONRenderer()\n        content = renderer.render(obj, 'application/json; indent=2')\n        self.assertEqual(strip_trailing_whitespace(content.decode()), _indented_repr)\n\n\nclass UnicodeJSONRendererTests(TestCase):\n    \"\"\"\n    Tests specific for the Unicode JSON Renderer\n    \"\"\"\n    def test_proper_encoding(self):\n        obj = {'countries': ['United Kingdom', 'France', 'España']}\n        renderer = JSONRenderer()\n        content = renderer.render(obj, 'application/json')\n        self.assertEqual(content, '{\"countries\":[\"United Kingdom\",\"France\",\"España\"]}'.encode())\n\n    def test_u2028_u2029(self):\n        # The \\u2028 and \\u2029 characters should be escaped,\n        # even when the non-escaping unicode representation is used.\n        # Regression test for #2169\n        obj = {'should_escape': '\\u2028\\u2029'}\n        renderer = JSONRenderer()\n        content = renderer.render(obj, 'application/json')\n        self.assertEqual(content, b'{\"should_escape\":\"\\\\u2028\\\\u2029\"}')\n\n\nclass AsciiJSONRendererTests(TestCase):\n    \"\"\"\n    Tests specific for the Unicode JSON Renderer\n    \"\"\"\n    def test_proper_encoding(self):\n        class AsciiJSONRenderer(JSONRenderer):\n            ensure_ascii = True\n        obj = {'countries': ['United Kingdom', 'France', 'España']}\n        renderer = AsciiJSONRenderer()\n        content = renderer.render(obj, 'application/json')\n        self.assertEqual(content, b'{\"countries\":[\"United Kingdom\",\"France\",\"Espa\\\\u00f1a\"]}')\n\n\n# Tests for caching issue, #346\n@override_settings(ROOT_URLCONF='tests.test_renderers')\nclass CacheRenderTest(TestCase):\n    \"\"\"\n    Tests specific to caching responses\n    \"\"\"\n    def test_head_caching(self):\n        \"\"\"\n        Test caching of HEAD requests\n        \"\"\"\n        response = self.client.head('/cache')\n        cache.set('key', response)\n        cached_response = cache.get('key')\n        assert isinstance(cached_response, Response)\n        assert cached_response.content == response.content\n        assert cached_response.status_code == response.status_code\n\n    def test_get_caching(self):\n        \"\"\"\n        Test caching of GET requests\n        \"\"\"\n        response = self.client.get('/cache')\n        cache.set('key', response)\n        cached_response = cache.get('key')\n        assert isinstance(cached_response, Response)\n        assert cached_response.content == response.content\n        assert cached_response.status_code == response.status_code\n\n\nclass TestJSONIndentationStyles:\n    def test_indented(self):\n        renderer = JSONRenderer()\n        data = {\"a\": 1, \"b\": 2}\n        assert renderer.render(data) == b'{\"a\":1,\"b\":2}'\n\n    def test_compact(self):\n        renderer = JSONRenderer()\n        data = {\"a\": 1, \"b\": 2}\n        context = {'indent': 4}\n        assert (\n            renderer.render(data, renderer_context=context) ==\n            b'{\\n    \"a\": 1,\\n    \"b\": 2\\n}'\n        )\n\n    def test_long_form(self):\n        renderer = JSONRenderer()\n        renderer.compact = False\n        data = {\"a\": 1, \"b\": 2}\n        assert renderer.render(data) == b'{\"a\": 1, \"b\": 2}'\n\n\nclass TestHiddenFieldHTMLFormRenderer(TestCase):\n    def test_hidden_field_rendering(self):\n        class TestSerializer(serializers.Serializer):\n            published = serializers.HiddenField(default=True)\n\n        serializer = TestSerializer(data={})\n        serializer.is_valid()\n        renderer = HTMLFormRenderer()\n        field = serializer['published']\n        rendered = renderer.render_field(field, {})\n        assert rendered == ''\n\n\nclass TestDateTimeFieldHTMLFormRender(TestCase):\n    \"\"\"\n    Default USE_TZ is True.\n    Default TIME_ZONE is 'America/Chicago'.\n    \"\"\"\n\n    def _assert_datetime_rendering(self, appointment, expected, datetimefield_kwargs=None):\n        datetimefield_kwargs = datetimefield_kwargs or {}\n\n        class TestSerializer(serializers.Serializer):\n            appointment = serializers.DateTimeField(**datetimefield_kwargs)\n\n        serializer = TestSerializer(data={\"appointment\": appointment})\n        serializer.is_valid()\n        renderer = HTMLFormRenderer()\n        field = serializer['appointment']\n        rendered = renderer.render_field(field, {})\n        expected_html = (\n            '<input name=\"appointment\" class=\"form-control\" '\n            f'type=\"datetime-local\" value=\"{expected}\">'\n        )\n\n        self.assertInHTML(expected_html, rendered)\n\n    def test_datetime_field_rendering_milliseconds(self):\n        self._assert_datetime_rendering(\n            datetime(2024, 12, 24, 0, 55, 30, 345678), \"2024-12-24T00:55:30.345\"\n        )\n\n    def test_datetime_field_rendering_no_seconds_and_no_milliseconds(self):\n        self._assert_datetime_rendering(\n            datetime(2024, 12, 24, 0, 55, 0, 0), \"2024-12-24T00:55:00.000\"\n        )\n\n    def test_datetime_field_rendering_with_format_as_none(self):\n        self._assert_datetime_rendering(\n            datetime(2024, 12, 24, 0, 55, 30, 345678),\n            \"2024-12-24T00:55:30.345\",\n            {\"format\": None}\n        )\n\n    def test_datetime_field_rendering_with_format(self):\n        self._assert_datetime_rendering(\n            datetime(2024, 12, 24, 0, 55, 30, 345678),\n            \"2024-12-24T00:55:00.000\",\n            {\"format\": \"%a %d %b %Y, %I:%M%p\"}\n        )\n\n    # New project templates default to 'UTC'.\n    @override_settings(TIME_ZONE='UTC')\n    def test_datetime_field_rendering_utc(self):\n        self._assert_datetime_rendering(\n            datetime(2024, 12, 24, 0, 55, 30, 345678),\n            \"2024-12-24T00:55:30.345\"\n        )\n\n    @override_settings(REST_FRAMEWORK={'DATETIME_FORMAT': '%a %d %b %Y, %I:%M%p'})\n    def test_datetime_field_rendering_with_custom_datetime_format(self):\n        self._assert_datetime_rendering(\n            datetime(2024, 12, 24, 0, 55, 30, 345678),\n            \"2024-12-24T00:55:00.000\"\n        )\n\n    @override_settings(REST_FRAMEWORK={'DATETIME_FORMAT': None})\n    def test_datetime_field_rendering_datetime_format_is_none(self):\n        self._assert_datetime_rendering(\n            datetime(2024, 12, 24, 0, 55, 30, 345678),\n            \"2024-12-24T00:55:30.345\"\n        )\n\n    # Enforce it in True because in Django versions under 4.2 was False by default.\n    @override_settings(USE_TZ=True)\n    def test_datetime_field_rendering_timezone_aware_datetime(self):\n        self._assert_datetime_rendering(\n            datetime(2024, 12, 24, 0, 55, 30, 345678, tzinfo=ZoneInfo('Asia/Tokyo')),  # +09:00\n            \"2024-12-23T09:55:30.345\"  # Rendered in -06:00\n        )\n\n\nclass TestHTMLFormRenderer(TestCase):\n    def setUp(self):\n        class TestSerializer(serializers.Serializer):\n            test_field = serializers.CharField()\n\n        self.renderer = HTMLFormRenderer()\n        self.serializer = TestSerializer(data={})\n\n    def test_render_with_default_args(self):\n        self.serializer.is_valid()\n        renderer = HTMLFormRenderer()\n\n        result = renderer.render(self.serializer.data)\n\n        self.assertIsInstance(result, SafeText)\n\n    def test_render_with_provided_args(self):\n        self.serializer.is_valid()\n        renderer = HTMLFormRenderer()\n\n        result = renderer.render(self.serializer.data, None, {})\n\n        self.assertIsInstance(result, SafeText)\n\n\nclass TestChoiceFieldHTMLFormRenderer(TestCase):\n    \"\"\"\n    Test rendering ChoiceField with HTMLFormRenderer.\n    \"\"\"\n\n    def setUp(self):\n        choices = ((1, 'Option1'), (2, 'Option2'), (12, 'Option12'))\n\n        class TestSerializer(serializers.Serializer):\n            test_field = serializers.ChoiceField(choices=choices,\n                                                 initial=2)\n\n        self.TestSerializer = TestSerializer\n        self.renderer = HTMLFormRenderer()\n\n    def test_render_initial_option(self):\n        serializer = self.TestSerializer()\n        result = self.renderer.render(serializer.data)\n\n        self.assertIsInstance(result, SafeText)\n\n        self.assertInHTML('<option value=\"2\" selected>Option2</option>',\n                          result)\n        self.assertInHTML('<option value=\"1\">Option1</option>', result)\n        self.assertInHTML('<option value=\"12\">Option12</option>', result)\n\n    def test_render_selected_option(self):\n        serializer = self.TestSerializer(data={'test_field': '12'})\n\n        serializer.is_valid()\n        result = self.renderer.render(serializer.data)\n\n        self.assertIsInstance(result, SafeText)\n\n        self.assertInHTML('<option value=\"12\" selected>Option12</option>',\n                          result)\n        self.assertInHTML('<option value=\"1\">Option1</option>', result)\n        self.assertInHTML('<option value=\"2\">Option2</option>', result)\n\n\nclass TestMultipleChoiceFieldHTMLFormRenderer(TestCase):\n    \"\"\"\n    Test rendering MultipleChoiceField with HTMLFormRenderer.\n    \"\"\"\n\n    def setUp(self):\n        self.renderer = HTMLFormRenderer()\n\n    def test_render_selected_option_with_string_option_ids(self):\n        choices = (('1', 'Option1'), ('2', 'Option2'), ('12', 'Option12'),\n                   ('}', 'OptionBrace'))\n\n        class TestSerializer(serializers.Serializer):\n            test_field = serializers.MultipleChoiceField(choices=choices)\n\n        serializer = TestSerializer(data={'test_field': ['12']})\n        serializer.is_valid()\n\n        result = self.renderer.render(serializer.data)\n\n        self.assertIsInstance(result, SafeText)\n\n        self.assertInHTML('<option value=\"12\" selected>Option12</option>',\n                          result)\n        self.assertInHTML('<option value=\"1\">Option1</option>', result)\n        self.assertInHTML('<option value=\"2\">Option2</option>', result)\n        self.assertInHTML('<option value=\"}\">OptionBrace</option>', result)\n\n    def test_render_selected_option_with_integer_option_ids(self):\n        choices = ((1, 'Option1'), (2, 'Option2'), (12, 'Option12'))\n\n        class TestSerializer(serializers.Serializer):\n            test_field = serializers.MultipleChoiceField(choices=choices)\n\n        serializer = TestSerializer(data={'test_field': ['12']})\n        serializer.is_valid()\n\n        result = self.renderer.render(serializer.data)\n\n        self.assertIsInstance(result, SafeText)\n\n        self.assertInHTML('<option value=\"12\" selected>Option12</option>',\n                          result)\n        self.assertInHTML('<option value=\"1\">Option1</option>', result)\n        self.assertInHTML('<option value=\"2\">Option2</option>', result)\n\n\nclass StaticHTMLRendererTests(TestCase):\n    \"\"\"\n    Tests specific for Static HTML Renderer\n    \"\"\"\n    def setUp(self):\n        self.renderer = StaticHTMLRenderer()\n\n    def test_static_renderer(self):\n        data = '<html><body>text</body></html>'\n        result = self.renderer.render(data)\n        assert result == data\n\n    def test_static_renderer_with_exception(self):\n        context = {\n            'response': Response(status=500, exception=True),\n            'request': Request(HttpRequest())\n        }\n        result = self.renderer.render({}, renderer_context=context)\n        assert result == '500 Internal Server Error'\n\n\nclass BrowsableAPIRendererTests(URLPatternsTestCase):\n    class ExampleViewSet(ViewSet):\n        def list(self, request):\n            return Response()\n\n        @action(detail=False, name=\"Extra list action\")\n        def list_action(self, request):\n            raise NotImplementedError\n\n    class AuthExampleViewSet(ExampleViewSet):\n        permission_classes = [permissions.IsAuthenticated]\n\n    class SimpleSerializer(serializers.Serializer):\n        name = serializers.CharField()\n\n    router = SimpleRouter()\n    router.register('examples', ExampleViewSet, basename='example')\n    router.register('auth-examples', AuthExampleViewSet, basename='auth-example')\n    urlpatterns = [path('api/', include(router.urls))]\n\n    def setUp(self):\n        self.renderer = BrowsableAPIRenderer()\n        self.renderer.accepted_media_type = ''\n        self.renderer.renderer_context = {}\n\n    def test_render_form_for_serializer(self):\n        with self.subTest('Serializer'):\n            serializer = BrowsableAPIRendererTests.SimpleSerializer(data={'name': 'Name'})\n            form = self.renderer.render_form_for_serializer(serializer)\n            assert isinstance(form, str), 'Must return form for serializer'\n\n        with self.subTest('ListSerializer'):\n            list_serializer = BrowsableAPIRendererTests.SimpleSerializer(data=[{'name': 'Name'}], many=True)\n            form = self.renderer.render_form_for_serializer(list_serializer)\n            assert form is None, 'Must not return form for list serializer'\n\n    def test_get_raw_data_form(self):\n        with self.subTest('Serializer'):\n            class DummyGenericViewsetLike(APIView):\n                def get_serializer(self, **kwargs):\n                    return BrowsableAPIRendererTests.SimpleSerializer(**kwargs)\n\n                def get(self, request):\n                    response = Response()\n                    response.view = self\n                    return response\n\n                post = get\n\n            view = DummyGenericViewsetLike.as_view()\n            _request = APIRequestFactory().get('/')\n            request = Request(_request)\n            response = view(_request)\n            view = response.view\n\n            raw_data_form = self.renderer.get_raw_data_form({'name': 'Name'}, view, 'POST', request)\n            assert raw_data_form['_content'].initial == '{\\n    \"name\": \"\"\\n}'\n\n        with self.subTest('ListSerializer'):\n            class DummyGenericViewsetLike(APIView):\n                def get_serializer(self, **kwargs):\n                    return BrowsableAPIRendererTests.SimpleSerializer(many=True, **kwargs)  # returns ListSerializer\n\n                def get(self, request):\n                    response = Response()\n                    response.view = self\n                    return response\n\n                post = get\n\n            view = DummyGenericViewsetLike.as_view()\n            _request = APIRequestFactory().get('/')\n            request = Request(_request)\n            response = view(_request)\n            view = response.view\n\n            raw_data_form = self.renderer.get_raw_data_form([{'name': 'Name'}], view, 'POST', request)\n            assert raw_data_form['_content'].initial == '[\\n    {\\n        \"name\": \"\"\\n    }\\n]'\n\n    def test_get_description_returns_empty_string_for_401_and_403_statuses(self):\n        assert self.renderer.get_description({}, status_code=401) == ''\n        assert self.renderer.get_description({}, status_code=403) == ''\n\n    def test_get_filter_form_returns_none_if_data_is_not_list_instance(self):\n        class DummyView:\n            get_queryset = None\n            filter_backends = None\n\n        result = self.renderer.get_filter_form(data='not list',\n                                               view=DummyView(), request={})\n        assert result is None\n\n    def test_extra_actions_dropdown(self):\n        resp = self.client.get('/api/examples/', HTTP_ACCEPT='text/html')\n        assert 'id=\"extra-actions-menu\"' in resp.content.decode()\n        assert '/api/examples/list_action/' in resp.content.decode()\n        assert '>Extra list action<' in resp.content.decode()\n\n    def test_extra_actions_dropdown_not_authed(self):\n        resp = self.client.get('/api/unauth-examples/', HTTP_ACCEPT='text/html')\n        assert 'id=\"extra-actions-menu\"' not in resp.content.decode()\n        assert '/api/examples/list_action/' not in resp.content.decode()\n        assert '>Extra list action<' not in resp.content.decode()\n\n\nclass AdminRendererTests(TestCase):\n\n    def setUp(self):\n        self.renderer = AdminRenderer()\n\n    def test_render_when_resource_created(self):\n        class DummyView(APIView):\n            renderer_classes = (AdminRenderer, )\n        request = Request(HttpRequest())\n        request.build_absolute_uri = lambda: 'http://example.com'\n        response = Response(status=201, headers={'Location': '/test'})\n        context = {\n            'view': DummyView(),\n            'request': request,\n            'response': response\n        }\n\n        result = self.renderer.render(data={'test': 'test'},\n                                      renderer_context=context)\n        assert result == ''\n        assert response.status_code == status.HTTP_303_SEE_OTHER\n        assert response['Location'] == 'http://example.com'\n\n    def test_render_dict(self):\n        factory = APIRequestFactory()\n\n        class DummyView(APIView):\n            renderer_classes = (AdminRenderer, )\n\n            def get(self, request):\n                return Response({'foo': 'a string'})\n        view = DummyView.as_view()\n        request = factory.get('/')\n        response = view(request)\n        response.render()\n        self.assertContains(response, '<tr><th>Foo</th><td>a string</td></tr>', html=True)\n\n    def test_render_dict_with_items_key(self):\n        factory = APIRequestFactory()\n\n        class DummyView(APIView):\n            renderer_classes = (AdminRenderer, )\n\n            def get(self, request):\n                return Response({'items': 'a string'})\n\n        view = DummyView.as_view()\n        request = factory.get('/')\n        response = view(request)\n        response.render()\n        self.assertContains(response, '<tr><th>Items</th><td>a string</td></tr>', html=True)\n\n    def test_render_dict_with_iteritems_key(self):\n        factory = APIRequestFactory()\n\n        class DummyView(APIView):\n            renderer_classes = (AdminRenderer, )\n\n            def get(self, request):\n                return Response({'iteritems': 'a string'})\n\n        view = DummyView.as_view()\n        request = factory.get('/')\n        response = view(request)\n        response.render()\n        self.assertContains(response, '<tr><th>Iteritems</th><td>a string</td></tr>', html=True)\n\n    def test_get_result_url(self):\n        factory = APIRequestFactory()\n\n        class DummyGenericViewsetLike(APIView):\n            lookup_field = 'test'\n\n            def get(self, request):\n                response = Response()\n                response.view = self\n                return response\n\n            def reverse_action(view, *args, **kwargs):\n                self.assertEqual(kwargs['kwargs']['test'], 1)\n                return '/example/'\n\n        # get the view instance instead of the view function\n        view = DummyGenericViewsetLike.as_view()\n        request = factory.get('/')\n        response = view(request)\n        view = response.view\n\n        self.assertEqual(self.renderer.get_result_url({'test': 1}, view), '/example/')\n        self.assertIsNone(self.renderer.get_result_url({}, view))\n\n    def test_get_result_url_no_result(self):\n        factory = APIRequestFactory()\n\n        class DummyView(APIView):\n            lookup_field = 'test'\n\n            def get(self, request):\n                response = Response()\n                response.view = self\n                return response\n\n        # get the view instance instead of the view function\n        view = DummyView.as_view()\n        request = factory.get('/')\n        response = view(request)\n        view = response.view\n\n        self.assertIsNone(self.renderer.get_result_url({'test': 1}, view))\n        self.assertIsNone(self.renderer.get_result_url({}, view))\n\n    def test_get_context_result_urls(self):\n        factory = APIRequestFactory()\n\n        class DummyView(APIView):\n            lookup_field = 'test'\n\n            def reverse_action(view, url_name, args=None, kwargs=None):\n                return '/%s/%d' % (url_name, kwargs['test'])\n\n        # get the view instance instead of the view function\n        view = DummyView.as_view()\n        request = factory.get('/')\n        response = view(request)\n\n        data = [\n            {'test': 1},\n            {'url': '/example', 'test': 2},\n            {'url': None, 'test': 3},\n            {},\n        ]\n        context = {\n            'view': DummyView(),\n            'request': Request(request),\n            'response': response\n        }\n\n        context = self.renderer.get_context(data, None, context)\n        results = context['results']\n\n        self.assertEqual(len(results), 4)\n        self.assertEqual(results[0]['url'], '/detail/1')\n        self.assertEqual(results[1]['url'], '/example')\n        self.assertEqual(results[2]['url'], None)\n        self.assertNotIn('url', results[3])\n"
  },
  {
    "path": "tests/test_request.py",
    "content": "\"\"\"\nTests for content parsing, and form-overloaded content parsing.\n\"\"\"\nimport copy\nimport os.path\nimport tempfile\n\nimport pytest\nfrom django.contrib.auth import authenticate, login, logout\nfrom django.contrib.auth.middleware import AuthenticationMiddleware\nfrom django.contrib.auth.models import User\nfrom django.contrib.sessions.middleware import SessionMiddleware\nfrom django.core.files.uploadedfile import SimpleUploadedFile\nfrom django.http.request import RawPostDataException\nfrom django.test import TestCase, override_settings\nfrom django.urls import path\n\nfrom rest_framework import status\nfrom rest_framework.authentication import SessionAuthentication\nfrom rest_framework.parsers import BaseParser, FormParser, MultiPartParser\nfrom rest_framework.request import Request, WrappedAttributeError\nfrom rest_framework.response import Response\nfrom rest_framework.test import APIClient, APIRequestFactory\nfrom rest_framework.views import APIView\n\nfactory = APIRequestFactory()\n\n\nclass TestInitializer(TestCase):\n    def test_request_type(self):\n        request = Request(factory.get('/'))\n\n        message = (\n            'The `request` argument must be an instance of '\n            '`django.http.HttpRequest`, not `rest_framework.request.Request`.'\n        )\n        with self.assertRaisesMessage(AssertionError, message):\n            Request(request)\n\n\nclass PlainTextParser(BaseParser):\n    media_type = 'text/plain'\n\n    def parse(self, stream, media_type=None, parser_context=None):\n        \"\"\"\n        Returns a 2-tuple of `(data, files)`.\n\n        `data` will simply be a string representing the body of the request.\n        `files` will always be `None`.\n        \"\"\"\n        return stream.read()\n\n\nclass TestContentParsing(TestCase):\n    def test_standard_behaviour_determines_no_content_GET(self):\n        \"\"\"\n        Ensure request.data returns empty QueryDict for GET request.\n        \"\"\"\n        request = Request(factory.get('/'))\n        assert request.data == {}\n\n    def test_standard_behaviour_determines_no_content_HEAD(self):\n        \"\"\"\n        Ensure request.data returns empty QueryDict for HEAD request.\n        \"\"\"\n        request = Request(factory.head('/'))\n        assert request.data == {}\n\n    def test_request_DATA_with_form_content(self):\n        \"\"\"\n        Ensure request.data returns content for POST request with form content.\n        \"\"\"\n        data = {'qwerty': 'uiop'}\n        request = Request(factory.post('/', data))\n        request.parsers = (FormParser(), MultiPartParser())\n        assert list(request.data.items()) == list(data.items())\n\n    def test_request_DATA_with_text_content(self):\n        \"\"\"\n        Ensure request.data returns content for POST request with\n        non-form content.\n        \"\"\"\n        content = b'qwerty'\n        content_type = 'text/plain'\n        request = Request(factory.post('/', content, content_type=content_type))\n        request.parsers = (PlainTextParser(),)\n        assert request.data == content\n\n    def test_request_POST_with_form_content(self):\n        \"\"\"\n        Ensure request.POST returns content for POST request with form content.\n        \"\"\"\n        data = {'qwerty': 'uiop'}\n        request = Request(factory.post('/', data))\n        request.parsers = (FormParser(), MultiPartParser())\n        assert list(request.POST.items()) == list(data.items())\n\n    def test_request_POST_with_files(self):\n        \"\"\"\n        Ensure request.POST returns no content for POST request with file content.\n        \"\"\"\n        upload = SimpleUploadedFile(\"file.txt\", b\"file_content\")\n        request = Request(factory.post('/', {'upload': upload}))\n        request.parsers = (FormParser(), MultiPartParser())\n        assert list(request.POST) == []\n        assert list(request.FILES) == ['upload']\n\n    def test_standard_behaviour_determines_form_content_PUT(self):\n        \"\"\"\n        Ensure request.data returns content for PUT request with form content.\n        \"\"\"\n        data = {'qwerty': 'uiop'}\n        request = Request(factory.put('/', data))\n        request.parsers = (FormParser(), MultiPartParser())\n        assert list(request.data.items()) == list(data.items())\n\n    def test_standard_behaviour_determines_non_form_content_PUT(self):\n        \"\"\"\n        Ensure request.data returns content for PUT request with\n        non-form content.\n        \"\"\"\n        content = b'qwerty'\n        content_type = 'text/plain'\n        request = Request(factory.put('/', content, content_type=content_type))\n        request.parsers = (PlainTextParser(), )\n        assert request.data == content\n\n    def test_calling_data_fails_when_attribute_error_is_raised(self):\n        \"\"\"\n        Ensure attribute errors raised when parsing are properly re-raised.\n        \"\"\"\n        expected_message = \"Internal error\"\n\n        class BrokenParser:\n            media_type = \"application/json\"\n\n            def parse(self, *args, **kwargs):\n                raise AttributeError(expected_message)\n\n        http_request = factory.post('/', data={}, format=\"json\")\n        request = Request(http_request)\n        request.parsers = (BrokenParser,)\n\n        with self.assertRaisesMessage(WrappedAttributeError, expected_message):\n            request.data\n\n\nclass MockView(APIView):\n    authentication_classes = (SessionAuthentication,)\n\n    def post(self, request):\n        if request.POST.get('example') is not None:\n            return Response(status=status.HTTP_200_OK)\n\n        return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR)\n\n\nclass EchoView(APIView):\n    def post(self, request):\n        response = Response(status=status.HTTP_200_OK, data=request.data)\n        response._request = request  # test client sets `request` input\n        return response\n\n\nclass FileUploadView(APIView):\n    def post(self, request):\n        filenames = [file.temporary_file_path() for file in request.FILES.values()]\n\n        for filename in filenames:\n            assert os.path.exists(filename)\n\n        return Response(status=status.HTTP_200_OK, data=filenames)\n\n\nurlpatterns = [\n    path('', MockView.as_view()),\n    path('echo/', EchoView.as_view()),\n    path('upload/', FileUploadView.as_view())\n]\n\n\n@override_settings(\n    ROOT_URLCONF='tests.test_request',\n    FILE_UPLOAD_HANDLERS=['django.core.files.uploadhandler.TemporaryFileUploadHandler'])\nclass FileUploadTests(TestCase):\n\n    def test_fileuploads_closed_at_request_end(self):\n        with tempfile.NamedTemporaryFile() as f:\n            response = self.client.post('/upload/', {'file': f})\n\n        # sanity check that file was processed\n        assert len(response.data) == 1\n\n        for file in response.data:\n            assert not os.path.exists(file)\n\n\n@override_settings(ROOT_URLCONF='tests.test_request')\nclass TestContentParsingWithAuthentication(TestCase):\n    def setUp(self):\n        self.csrf_client = APIClient(enforce_csrf_checks=True)\n        self.username = 'john'\n        self.email = 'lennon@thebeatles.com'\n        self.password = 'password'\n        self.user = User.objects.create_user(self.username, self.email, self.password)\n\n    def test_user_logged_in_authentication_has_POST_when_not_logged_in(self):\n        \"\"\"\n        Ensures request.POST exists after SessionAuthentication when user\n        doesn't log in.\n        \"\"\"\n        content = {'example': 'example'}\n\n        response = self.client.post('/', content)\n        assert status.HTTP_200_OK == response.status_code\n\n        response = self.csrf_client.post('/', content)\n        assert status.HTTP_200_OK == response.status_code\n\n\nclass TestUserSetter(TestCase):\n\n    def setUp(self):\n        # Pass request object through session middleware so session is\n        # available to login and logout functions\n        self.wrapped_request = factory.get('/')\n        self.request = Request(self.wrapped_request)\n\n        def dummy_get_response(request):  # pragma: no cover\n            return None\n\n        SessionMiddleware(dummy_get_response).process_request(self.wrapped_request)\n        AuthenticationMiddleware(dummy_get_response).process_request(self.wrapped_request)\n\n        User.objects.create_user('ringo', 'starr@thebeatles.com', 'yellow')\n        self.user = authenticate(username='ringo', password='yellow')\n\n    def test_user_can_be_set(self):\n        self.request.user = self.user\n        assert self.request.user == self.user\n\n    def test_user_can_login(self):\n        login(self.request, self.user)\n        assert self.request.user == self.user\n\n    def test_user_can_logout(self):\n        self.request.user = self.user\n        assert not self.request.user.is_anonymous\n        logout(self.request)\n        assert self.request.user.is_anonymous\n\n    def test_logged_in_user_is_set_on_wrapped_request(self):\n        login(self.request, self.user)\n        assert self.wrapped_request.user == self.user\n\n    def test_calling_user_fails_when_attribute_error_is_raised(self):\n        \"\"\"\n        This proves that when an AttributeError is raised inside of the request.user\n        property, that we can handle this and report the true, underlying error.\n        \"\"\"\n        class AuthRaisesAttributeError:\n            def authenticate(self, request):\n                self.MISSPELLED_NAME_THAT_DOESNT_EXIST\n\n        request = Request(self.wrapped_request, authenticators=(AuthRaisesAttributeError(),))\n\n        # The middleware processes the underlying Django request, sets anonymous user\n        assert self.wrapped_request.user.is_anonymous\n\n        # The DRF request object does not have a user and should run authenticators\n        expected = r\"no attribute 'MISSPELLED_NAME_THAT_DOESNT_EXIST'\"\n        with pytest.raises(WrappedAttributeError, match=expected):\n            request.user\n\n        with pytest.raises(WrappedAttributeError, match=expected):\n            hasattr(request, 'user')\n\n        with pytest.raises(WrappedAttributeError, match=expected):\n            login(request, self.user)\n\n\nclass TestAuthSetter(TestCase):\n    def test_auth_can_be_set(self):\n        request = Request(factory.get('/'))\n        request.auth = 'DUMMY'\n        assert request.auth == 'DUMMY'\n\n\nclass TestSecure(TestCase):\n\n    def test_default_secure_false(self):\n        request = Request(factory.get('/', secure=False))\n        assert request.scheme == 'http'\n\n    def test_default_secure_true(self):\n        request = Request(factory.get('/', secure=True))\n        assert request.scheme == 'https'\n\n\nclass TestHttpRequest(TestCase):\n    def test_repr(self):\n        http_request = factory.get('/path')\n        request = Request(http_request)\n\n        assert repr(request) == \"<rest_framework.request.Request: GET '/path'>\"\n\n    def test_attribute_access_proxy(self):\n        http_request = factory.get('/')\n        request = Request(http_request)\n\n        inner_sentinel = object()\n        http_request.inner_property = inner_sentinel\n        assert request.inner_property is inner_sentinel\n\n        outer_sentinel = object()\n        request.inner_property = outer_sentinel\n        assert request.inner_property is outer_sentinel\n\n    def test_exception_proxy(self):\n        # ensure the exception message is not for the underlying WSGIRequest\n        http_request = factory.get('/')\n        request = Request(http_request)\n\n        message = \"'Request' object has no attribute 'inner_property'\"\n        with self.assertRaisesMessage(AttributeError, message):\n            request.inner_property\n\n    @override_settings(ROOT_URLCONF='tests.test_request')\n    def test_duplicate_request_stream_parsing_exception(self):\n        \"\"\"\n        Check assumption that duplicate stream parsing will result in a\n        `RawPostDataException` being raised.\n        \"\"\"\n        response = APIClient().post('/echo/', data={'a': 'b'}, format='json')\n        request = response._request\n\n        # ensure that request stream was consumed by json parser\n        assert request.content_type.startswith('application/json')\n        assert response.data == {'a': 'b'}\n\n        # pass same HttpRequest to view, stream already consumed\n        with pytest.raises(RawPostDataException):\n            EchoView.as_view()(request._request)\n\n    @override_settings(ROOT_URLCONF='tests.test_request')\n    def test_duplicate_request_form_data_access(self):\n        \"\"\"\n        Form data is copied to the underlying django request for middleware\n        and file closing reasons. Duplicate processing of a request with form\n        data is 'safe' in so far as accessing `request.POST` does not trigger\n        the duplicate stream parse exception.\n        \"\"\"\n        response = APIClient().post('/echo/', data={'a': 'b'})\n        request = response._request\n\n        # ensure that request stream was consumed by form parser\n        assert request.content_type.startswith('multipart/form-data')\n        assert response.data == {'a': ['b']}\n\n        # pass same HttpRequest to view, form data set on underlying request\n        response = EchoView.as_view()(request._request)\n        request = response._request\n\n        # ensure that request stream was consumed by form parser\n        assert request.content_type.startswith('multipart/form-data')\n        assert response.data == {'a': ['b']}\n\n\nclass TestDeepcopy(TestCase):\n\n    def test_deepcopy_works(self):\n        request = Request(factory.get('/', secure=False))\n        copy.deepcopy(request)\n\n\nclass TestTyping(TestCase):\n    def test_request_is_subscriptable(self):\n        assert Request is Request[\"foo\"]\n"
  },
  {
    "path": "tests/test_requests_client.py",
    "content": "import unittest\n\nfrom django.contrib.auth import authenticate, login\nfrom django.contrib.auth.models import User\nfrom django.shortcuts import redirect\nfrom django.test import override_settings\nfrom django.urls import path\nfrom django.utils.decorators import method_decorator\nfrom django.views.decorators.csrf import csrf_protect, ensure_csrf_cookie\n\nfrom rest_framework.compat import requests\nfrom rest_framework.response import Response\nfrom rest_framework.test import APITestCase, RequestsClient\nfrom rest_framework.views import APIView\n\n\nclass Root(APIView):\n    def get(self, request):\n        return Response({\n            'method': request.method,\n            'query_params': request.query_params,\n        })\n\n    def post(self, request):\n        files = {\n            key: (value.name, value.read())\n            for key, value in request.FILES.items()\n        }\n        post = request.POST\n        json = None\n        if request.META.get('CONTENT_TYPE') == 'application/json':\n            json = request.data\n\n        return Response({\n            'method': request.method,\n            'query_params': request.query_params,\n            'POST': post,\n            'FILES': files,\n            'JSON': json\n        })\n\n\nclass HeadersView(APIView):\n    def get(self, request):\n        headers = {\n            key[5:].replace('_', '-'): value\n            for key, value in request.META.items()\n            if key.startswith('HTTP_')\n        }\n        return Response({\n            'method': request.method,\n            'headers': headers\n        })\n\n\nclass SessionView(APIView):\n    def get(self, request):\n        return Response({\n            key: value for key, value in request.session.items()\n        })\n\n    def post(self, request):\n        for key, value in request.data.items():\n            request.session[key] = value\n        return Response({\n            key: value for key, value in request.session.items()\n        })\n\n\nclass AuthView(APIView):\n    @method_decorator(ensure_csrf_cookie)\n    def get(self, request):\n        if request.user.is_authenticated:\n            username = request.user.username\n        else:\n            username = None\n        return Response({\n            'username': username\n        })\n\n    @method_decorator(csrf_protect)\n    def post(self, request):\n        username = request.data['username']\n        password = request.data['password']\n        user = authenticate(username=username, password=password)\n        if user is None:\n            return Response({'error': 'incorrect credentials'})\n        login(request, user)\n        return redirect('/auth/')\n\n\nurlpatterns = [\n    path('', Root.as_view(), name='root'),\n    path('headers/', HeadersView.as_view(), name='headers'),\n    path('session/', SessionView.as_view(), name='session'),\n    path('auth/', AuthView.as_view(), name='auth'),\n]\n\n\n@unittest.skipUnless(requests, 'requests not installed')\n@override_settings(ROOT_URLCONF='tests.test_requests_client')\nclass RequestsClientTests(APITestCase):\n    def test_get_request(self):\n        client = RequestsClient()\n        response = client.get('http://testserver/')\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {\n            'method': 'GET',\n            'query_params': {}\n        }\n        assert response.json() == expected\n\n    def test_get_request_query_params_in_url(self):\n        client = RequestsClient()\n        response = client.get('http://testserver/?key=value')\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {\n            'method': 'GET',\n            'query_params': {'key': 'value'}\n        }\n        assert response.json() == expected\n\n    def test_get_request_query_params_by_kwarg(self):\n        client = RequestsClient()\n        response = client.get('http://testserver/', params={'key': 'value'})\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {\n            'method': 'GET',\n            'query_params': {'key': 'value'}\n        }\n        assert response.json() == expected\n\n    def test_get_with_headers(self):\n        client = RequestsClient()\n        response = client.get('http://testserver/headers/', headers={'User-Agent': 'example'})\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        headers = response.json()['headers']\n        assert headers['USER-AGENT'] == 'example'\n\n    def test_get_with_session_headers(self):\n        client = RequestsClient()\n        client.headers.update({'User-Agent': 'example'})\n        response = client.get('http://testserver/headers/')\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        headers = response.json()['headers']\n        assert headers['USER-AGENT'] == 'example'\n\n    def test_post_form_request(self):\n        client = RequestsClient()\n        response = client.post('http://testserver/', data={'key': 'value'})\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {\n            'method': 'POST',\n            'query_params': {},\n            'POST': {'key': 'value'},\n            'FILES': {},\n            'JSON': None\n        }\n        assert response.json() == expected\n\n    def test_post_json_request(self):\n        client = RequestsClient()\n        response = client.post('http://testserver/', json={'key': 'value'})\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {\n            'method': 'POST',\n            'query_params': {},\n            'POST': {},\n            'FILES': {},\n            'JSON': {'key': 'value'}\n        }\n        assert response.json() == expected\n\n    def test_post_multipart_request(self):\n        client = RequestsClient()\n        files = {\n            'file': ('report.csv', 'some,data,to,send\\nanother,row,to,send\\n')\n        }\n        response = client.post('http://testserver/', files=files)\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {\n            'method': 'POST',\n            'query_params': {},\n            'FILES': {'file': ['report.csv', 'some,data,to,send\\nanother,row,to,send\\n']},\n            'POST': {},\n            'JSON': None\n        }\n        assert response.json() == expected\n\n    def test_session(self):\n        client = RequestsClient()\n        response = client.get('http://testserver/session/')\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {}\n        assert response.json() == expected\n\n        response = client.post('http://testserver/session/', json={'example': 'abc'})\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {'example': 'abc'}\n        assert response.json() == expected\n\n        response = client.get('http://testserver/session/')\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {'example': 'abc'}\n        assert response.json() == expected\n\n    def test_auth(self):\n        # Confirm session is not authenticated\n        client = RequestsClient()\n        response = client.get('http://testserver/auth/')\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {\n            'username': None\n        }\n        assert response.json() == expected\n        assert 'csrftoken' in response.cookies\n        csrftoken = response.cookies['csrftoken']\n\n        user = User.objects.create(username='tom')\n        user.set_password('password')\n        user.save()\n\n        # Perform a login\n        response = client.post('http://testserver/auth/', json={\n            'username': 'tom',\n            'password': 'password'\n        }, headers={'X-CSRFToken': csrftoken})\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {\n            'username': 'tom'\n        }\n        assert response.json() == expected\n\n        # Confirm session is authenticated\n        response = client.get('http://testserver/auth/')\n        assert response.status_code == 200\n        assert response.headers['Content-Type'] == 'application/json'\n        expected = {\n            'username': 'tom'\n        }\n        assert response.json() == expected\n"
  },
  {
    "path": "tests/test_response.py",
    "content": "from django.test import TestCase, override_settings\nfrom django.urls import include, path, re_path\n\nfrom rest_framework import generics, routers, serializers, status, viewsets\nfrom rest_framework.parsers import JSONParser\nfrom rest_framework.renderers import (\n    BaseRenderer, BrowsableAPIRenderer, JSONRenderer\n)\nfrom rest_framework.response import Response\nfrom rest_framework.views import APIView\nfrom tests.models import BasicModel\n\n\n# Serializer used to test BasicModel\nclass BasicModelSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = BasicModel\n        fields = '__all__'\n\n\nclass MockPickleRenderer(BaseRenderer):\n    media_type = 'application/pickle'\n\n\nclass MockJsonRenderer(BaseRenderer):\n    media_type = 'application/json'\n\n\nclass MockTextMediaRenderer(BaseRenderer):\n    media_type = 'text/html'\n\n\nDUMMYSTATUS = status.HTTP_200_OK\nDUMMYCONTENT = 'dummycontent'\n\n\ndef RENDERER_A_SERIALIZER(x):\n    return ('Renderer A: %s' % x).encode('ascii')\n\n\ndef RENDERER_B_SERIALIZER(x):\n    return ('Renderer B: %s' % x).encode('ascii')\n\n\nclass RendererA(BaseRenderer):\n    media_type = 'mock/renderera'\n    format = \"formata\"\n\n    def render(self, data, media_type=None, renderer_context=None):\n        return RENDERER_A_SERIALIZER(data)\n\n\nclass RendererB(BaseRenderer):\n    media_type = 'mock/rendererb'\n    format = \"formatb\"\n\n    def render(self, data, media_type=None, renderer_context=None):\n        return RENDERER_B_SERIALIZER(data)\n\n\nclass RendererC(RendererB):\n    media_type = 'mock/rendererc'\n    format = 'formatc'\n    charset = \"rendererc\"\n\n\nclass MockView(APIView):\n    renderer_classes = (RendererA, RendererB, RendererC)\n\n    def get(self, request, **kwargs):\n        return Response(DUMMYCONTENT, status=DUMMYSTATUS)\n\n\nclass MockViewSettingContentType(APIView):\n    renderer_classes = (RendererA, RendererB, RendererC)\n\n    def get(self, request, **kwargs):\n        return Response(DUMMYCONTENT, status=DUMMYSTATUS, content_type='setbyview')\n\n\nclass JSONView(APIView):\n    parser_classes = (JSONParser,)\n\n    def post(self, request, **kwargs):\n        assert request.data\n        return Response(DUMMYCONTENT)\n\n\nclass HTMLView(APIView):\n    renderer_classes = (BrowsableAPIRenderer, )\n\n    def get(self, request, **kwargs):\n        return Response('text')\n\n\nclass HTMLView1(APIView):\n    renderer_classes = (BrowsableAPIRenderer, JSONRenderer)\n\n    def get(self, request, **kwargs):\n        return Response('text')\n\n\nclass HTMLNewModelViewSet(viewsets.ModelViewSet):\n    serializer_class = BasicModelSerializer\n    queryset = BasicModel.objects.all()\n\n\nclass HTMLNewModelView(generics.ListCreateAPIView):\n    renderer_classes = (BrowsableAPIRenderer,)\n    permission_classes = []\n    serializer_class = BasicModelSerializer\n    queryset = BasicModel.objects.all()\n\n\nnew_model_viewset_router = routers.DefaultRouter()\nnew_model_viewset_router.register(r'', HTMLNewModelViewSet)\n\n\nurlpatterns = [\n    path('setbyview', MockViewSettingContentType.as_view(renderer_classes=[RendererA, RendererB, RendererC])),\n    re_path(r'^.*\\.(?P<format>.+)$', MockView.as_view(renderer_classes=[RendererA, RendererB, RendererC])),\n    path('', MockView.as_view(renderer_classes=[RendererA, RendererB, RendererC])),\n    path('html', HTMLView.as_view()),\n    path('json', JSONView.as_view()),\n    path('html1', HTMLView1.as_view()),\n    path('html_new_model', HTMLNewModelView.as_view()),\n    path('html_new_model_viewset', include(new_model_viewset_router.urls)),\n    path('restframework', include('rest_framework.urls', namespace='rest_framework'))\n]\n\n\n# TODO: Clean tests below - remove duplicates with above, better unit testing, ...\n@override_settings(ROOT_URLCONF='tests.test_response')\nclass RendererIntegrationTests(TestCase):\n    \"\"\"\n    End-to-end testing of renderers using an ResponseMixin on a generic view.\n    \"\"\"\n    def test_default_renderer_serializes_content(self):\n        \"\"\"If the Accept header is not set the default renderer should serialize the response.\"\"\"\n        resp = self.client.get('/')\n        self.assertEqual(resp['Content-Type'], RendererA.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_A_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_head_method_serializes_no_content(self):\n        \"\"\"No response must be included in HEAD requests.\"\"\"\n        resp = self.client.head('/')\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n        self.assertEqual(resp['Content-Type'], RendererA.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, b'')\n\n    def test_default_renderer_serializes_content_on_accept_any(self):\n        \"\"\"If the Accept header is set to */* the default renderer should serialize the response.\"\"\"\n        resp = self.client.get('/', HTTP_ACCEPT='*/*')\n        self.assertEqual(resp['Content-Type'], RendererA.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_A_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_specified_renderer_serializes_content_default_case(self):\n        \"\"\"If the Accept header is set the specified renderer should serialize the response.\n        (In this case we check that works for the default renderer)\"\"\"\n        resp = self.client.get('/', HTTP_ACCEPT=RendererA.media_type)\n        self.assertEqual(resp['Content-Type'], RendererA.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_A_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_specified_renderer_serializes_content_non_default_case(self):\n        \"\"\"If the Accept header is set the specified renderer should serialize the response.\n        (In this case we check that works for a non-default renderer)\"\"\"\n        resp = self.client.get('/', HTTP_ACCEPT=RendererB.media_type)\n        self.assertEqual(resp['Content-Type'], RendererB.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_B_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_specified_renderer_serializes_content_on_format_query(self):\n        \"\"\"If a 'format' query is specified, the renderer with the matching\n        format attribute should serialize the response.\"\"\"\n        resp = self.client.get('/?format=%s' % RendererB.format)\n        self.assertEqual(resp['Content-Type'], RendererB.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_B_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_specified_renderer_serializes_content_on_format_kwargs(self):\n        \"\"\"If a 'format' keyword arg is specified, the renderer with the matching\n        format attribute should serialize the response.\"\"\"\n        resp = self.client.get('/something.formatb')\n        self.assertEqual(resp['Content-Type'], RendererB.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_B_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n    def test_specified_renderer_is_used_on_format_query_with_matching_accept(self):\n        \"\"\"If both a 'format' query and a matching Accept header specified,\n        the renderer with the matching format attribute should serialize the response.\"\"\"\n        resp = self.client.get('/?format=%s' % RendererB.format,\n                               HTTP_ACCEPT=RendererB.media_type)\n        self.assertEqual(resp['Content-Type'], RendererB.media_type + '; charset=utf-8')\n        self.assertEqual(resp.content, RENDERER_B_SERIALIZER(DUMMYCONTENT))\n        self.assertEqual(resp.status_code, DUMMYSTATUS)\n\n\n@override_settings(ROOT_URLCONF='tests.test_response')\nclass UnsupportedMediaTypeTests(TestCase):\n    def test_should_allow_posting_json(self):\n        response = self.client.post('/json', data='{\"test\": 123}', content_type='application/json')\n\n        self.assertEqual(response.status_code, 200)\n\n    def test_should_not_allow_posting_xml(self):\n        response = self.client.post('/json', data='<test>123</test>', content_type='application/xml')\n\n        self.assertEqual(response.status_code, 415)\n\n    def test_should_not_allow_posting_a_form(self):\n        response = self.client.post('/json', data={'test': 123})\n\n        self.assertEqual(response.status_code, 415)\n\n\n@override_settings(ROOT_URLCONF='tests.test_response')\nclass Issue122Tests(TestCase):\n    \"\"\"\n    Tests that covers #122.\n    \"\"\"\n    def test_only_html_renderer(self):\n        \"\"\"\n        Test if no infinite recursion occurs.\n        \"\"\"\n        self.client.get('/html')\n\n    def test_html_renderer_is_first(self):\n        \"\"\"\n        Test if no infinite recursion occurs.\n        \"\"\"\n        self.client.get('/html1')\n\n\n@override_settings(ROOT_URLCONF='tests.test_response')\nclass Issue467Tests(TestCase):\n    \"\"\"\n    Tests for #467\n    \"\"\"\n    def test_form_has_label_and_help_text(self):\n        resp = self.client.get('/html_new_model')\n        self.assertEqual(resp['Content-Type'], 'text/html; charset=utf-8')\n        # self.assertContains(resp, 'Text comes here')\n        # self.assertContains(resp, 'Text description.')\n\n\n@override_settings(ROOT_URLCONF='tests.test_response')\nclass Issue807Tests(TestCase):\n    \"\"\"\n    Covers #807\n    \"\"\"\n    def test_does_not_append_charset_by_default(self):\n        \"\"\"\n        Renderers don't include a charset unless set explicitly.\n        \"\"\"\n        headers = {\"HTTP_ACCEPT\": RendererA.media_type}\n        resp = self.client.get('/', **headers)\n        expected = \"{}; charset={}\".format(RendererA.media_type, 'utf-8')\n        self.assertEqual(expected, resp['Content-Type'])\n\n    def test_if_there_is_charset_specified_on_renderer_it_gets_appended(self):\n        \"\"\"\n        If renderer class has charset attribute declared, it gets appended\n        to Response's Content-Type\n        \"\"\"\n        headers = {\"HTTP_ACCEPT\": RendererC.media_type}\n        resp = self.client.get('/', **headers)\n        expected = f\"{RendererC.media_type}; charset={RendererC.charset}\"\n        self.assertEqual(expected, resp['Content-Type'])\n\n    def test_content_type_set_explicitly_on_response(self):\n        \"\"\"\n        The content type may be set explicitly on the response.\n        \"\"\"\n        headers = {\"HTTP_ACCEPT\": RendererC.media_type}\n        resp = self.client.get('/setbyview', **headers)\n        self.assertEqual('setbyview', resp['Content-Type'])\n\n    def test_form_has_label_and_help_text(self):\n        resp = self.client.get('/html_new_model')\n        self.assertEqual(resp['Content-Type'], 'text/html; charset=utf-8')\n        # self.assertContains(resp, 'Text comes here')\n        # self.assertContains(resp, 'Text description.')\n\n\nclass TestTyping(TestCase):\n    def test_response_is_subscriptable(self):\n        assert Response is Response[\"foo\"]\n"
  },
  {
    "path": "tests/test_reverse.py",
    "content": "from django.test import TestCase, override_settings\nfrom django.urls import NoReverseMatch, path\n\nfrom rest_framework.reverse import reverse\nfrom rest_framework.test import APIRequestFactory\nfrom rest_framework.versioning import BaseVersioning\n\nfactory = APIRequestFactory()\n\n\ndef null_view(request):\n    pass\n\n\nurlpatterns = [\n    path('view', null_view, name='view'),\n]\n\n\nclass MockVersioningScheme(BaseVersioning):\n\n    def __init__(self, raise_error=False):\n        self.raise_error = raise_error\n\n    def reverse(self, *args, **kwargs):\n        if self.raise_error:\n            raise NoReverseMatch()\n\n        return 'http://scheme-reversed/view'\n\n\n@override_settings(ROOT_URLCONF='tests.test_reverse')\nclass ReverseTests(TestCase):\n    \"\"\"\n    Tests for fully qualified URLs when using `reverse`.\n    \"\"\"\n    def test_reversed_urls_are_fully_qualified(self):\n        request = factory.get('/view')\n        url = reverse('view', request=request)\n        assert url == 'http://testserver/view'\n\n    def test_reverse_with_versioning_scheme(self):\n        request = factory.get('/view')\n        request.versioning_scheme = MockVersioningScheme()\n\n        url = reverse('view', request=request)\n        assert url == 'http://scheme-reversed/view'\n\n    def test_reverse_with_versioning_scheme_fallback_to_default_on_error(self):\n        request = factory.get('/view')\n        request.versioning_scheme = MockVersioningScheme(raise_error=True)\n\n        url = reverse('view', request=request)\n        assert url == 'http://testserver/view'\n"
  },
  {
    "path": "tests/test_routers.py",
    "content": "from collections import namedtuple\n\nimport pytest\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.db import models\nfrom django.test import TestCase, override_settings\nfrom django.urls import include, path, resolve, reverse\n\nfrom rest_framework import permissions, serializers, viewsets\nfrom rest_framework.decorators import action\nfrom rest_framework.response import Response\nfrom rest_framework.routers import DefaultRouter, SimpleRouter\nfrom rest_framework.test import (\n    APIClient, APIRequestFactory, URLPatternsTestCase\n)\nfrom rest_framework.utils import json\n\nfactory = APIRequestFactory()\n\n\nclass RouterTestModel(models.Model):\n    uuid = models.CharField(max_length=20)\n    text = models.CharField(max_length=200)\n\n\nclass BasenameTestModel(models.Model):\n    uuid = models.CharField(max_length=20)\n    text = models.CharField(max_length=200)\n\n\nclass NoteSerializer(serializers.HyperlinkedModelSerializer):\n    url = serializers.HyperlinkedIdentityField(view_name='routertestmodel-detail', lookup_field='uuid')\n\n    class Meta:\n        model = RouterTestModel\n        fields = ('url', 'uuid', 'text')\n\n\nclass NoteViewSet(viewsets.ModelViewSet):\n    queryset = RouterTestModel.objects.all()\n    serializer_class = NoteSerializer\n    lookup_field = 'uuid'\n\n\nclass KWargedNoteViewSet(viewsets.ModelViewSet):\n    queryset = RouterTestModel.objects.all()\n    serializer_class = NoteSerializer\n    lookup_field = 'text__contains'\n    lookup_url_kwarg = 'text'\n\n\nclass BasenameViewSet(viewsets.ModelViewSet):\n    queryset = BasenameTestModel.objects.all()\n    serializer_class = None\n\n\nclass MockViewSet(viewsets.ModelViewSet):\n    queryset = None\n    serializer_class = None\n\n\nclass EmptyPrefixSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = RouterTestModel\n        fields = ('uuid', 'text')\n\n\nclass EmptyPrefixViewSet(viewsets.ModelViewSet):\n    queryset = [RouterTestModel(id=1, uuid='111', text='First'), RouterTestModel(id=2, uuid='222', text='Second')]\n    serializer_class = EmptyPrefixSerializer\n\n    def get_object(self, *args, **kwargs):\n        index = int(self.kwargs['pk']) - 1\n        return self.queryset[index]\n\n\nclass RegexUrlPathViewSet(viewsets.ViewSet):\n    @action(detail=False, url_path='list/(?P<kwarg>[0-9]{4})')\n    def regex_url_path_list(self, request, *args, **kwargs):\n        kwarg = self.kwargs.get('kwarg', '')\n        return Response({'kwarg': kwarg})\n\n    @action(detail=True, url_path='detail/(?P<kwarg>[0-9]{4})')\n    def regex_url_path_detail(self, request, *args, **kwargs):\n        pk = self.kwargs.get('pk', '')\n        kwarg = self.kwargs.get('kwarg', '')\n        return Response({'pk': pk, 'kwarg': kwarg})\n\n\nclass UrlPathViewSet(viewsets.ViewSet):\n    @action(detail=False, url_path='list/<int:kwarg>')\n    def url_path_list(self, request, *args, **kwargs):\n        kwarg = self.kwargs.get('kwarg', '')\n        return Response({'kwarg': kwarg})\n\n    @action(detail=True, url_path='detail/<int:kwarg>')\n    def url_path_detail(self, request, *args, **kwargs):\n        pk = self.kwargs.get('pk', '')\n        kwarg = self.kwargs.get('kwarg', '')\n        return Response({'pk': pk, 'kwarg': kwarg})\n\n    @action(detail=True, url_path='detail/<int:kwarg>/detail/<int:param>')\n    def url_path_detail_multiple_params(self, request, *args, **kwargs):\n        pk = self.kwargs.get('pk', '')\n        kwarg = self.kwargs.get('kwarg', '')\n        param = self.kwargs.get('param', '')\n        return Response({'pk': pk, 'kwarg': kwarg, 'param': param})\n\n\nnotes_router = SimpleRouter()\nnotes_router.register(r'notes', NoteViewSet)\n\nnotes_path_router = SimpleRouter(use_regex_path=False)\nnotes_path_router.register('notes', NoteViewSet)\n\nnotes_path_default_router = DefaultRouter(use_regex_path=False)\nnotes_path_default_router.register('notes', NoteViewSet)\n\nkwarged_notes_router = SimpleRouter()\nkwarged_notes_router.register(r'notes', KWargedNoteViewSet)\n\nnamespaced_router = DefaultRouter()\nnamespaced_router.register(r'example', MockViewSet, basename='example')\n\nempty_prefix_router = SimpleRouter()\nempty_prefix_router.register(r'', EmptyPrefixViewSet, basename='empty_prefix')\n\nregex_url_path_router = SimpleRouter()\nregex_url_path_router.register(r'', RegexUrlPathViewSet, basename='regex')\n\nurl_path_router = SimpleRouter(use_regex_path=False)\nurl_path_router.register('', UrlPathViewSet, basename='path')\n\n\nclass BasicViewSet(viewsets.ViewSet):\n    def list(self, request, *args, **kwargs):\n        return Response({'method': 'list'})\n\n    @action(methods=['post'], detail=True)\n    def action1(self, request, *args, **kwargs):\n        return Response({'method': 'action1'})\n\n    @action(methods=['post', 'delete'], detail=True)\n    def action2(self, request, *args, **kwargs):\n        return Response({'method': 'action2'})\n\n    @action(methods=['post'], detail=True)\n    def action3(self, request, pk, *args, **kwargs):\n        return Response({'post': pk})\n\n    @action3.mapping.delete\n    def action3_delete(self, request, pk, *args, **kwargs):\n        return Response({'delete': pk})\n\n\nclass TestSimpleRouter(URLPatternsTestCase, TestCase):\n    router = SimpleRouter()\n    router.register('basics', BasicViewSet, basename='basic')\n\n    urlpatterns = [\n        path('api/', include(router.urls)),\n    ]\n\n    def setUp(self):\n        self.router = SimpleRouter()\n\n    def test_action_routes(self):\n        # Get action routes (first two are list/detail)\n        routes = self.router.get_routes(BasicViewSet)[2:]\n\n        assert routes[0].url == '^{prefix}/{lookup}/action1{trailing_slash}$'\n        assert routes[0].mapping == {\n            'post': 'action1',\n        }\n\n        assert routes[1].url == '^{prefix}/{lookup}/action2{trailing_slash}$'\n        assert routes[1].mapping == {\n            'post': 'action2',\n            'delete': 'action2',\n        }\n\n        assert routes[2].url == '^{prefix}/{lookup}/action3{trailing_slash}$'\n        assert routes[2].mapping == {\n            'post': 'action3',\n            'delete': 'action3_delete',\n        }\n\n    def test_multiple_action_handlers(self):\n        # Standard action\n        response = self.client.post(reverse('basic-action3', args=[1]))\n        assert response.data == {'post': '1'}\n\n        # Additional handler registered with MethodMapper\n        response = self.client.delete(reverse('basic-action3', args=[1]))\n        assert response.data == {'delete': '1'}\n\n    def test_register_after_accessing_urls(self):\n        self.router.register(r'notes', NoteViewSet)\n        assert len(self.router.urls) == 2  # list and detail\n        self.router.register(r'notes_bis', NoteViewSet, basename='notes_bis')\n        assert len(self.router.urls) == 4\n\n\nclass TestRootView(URLPatternsTestCase, TestCase):\n    urlpatterns = [\n        path('non-namespaced/', include(namespaced_router.urls)),\n        path('namespaced/', include((namespaced_router.urls, 'namespaced'), namespace='namespaced')),\n    ]\n\n    def test_retrieve_namespaced_root(self):\n        response = self.client.get('/namespaced/')\n        assert response.data == {\"example\": \"http://testserver/namespaced/example/\"}\n\n    def test_retrieve_non_namespaced_root(self):\n        response = self.client.get('/non-namespaced/')\n        assert response.data == {\"example\": \"http://testserver/non-namespaced/example/\"}\n\n\nclass TestCustomLookupFields(URLPatternsTestCase, TestCase):\n    \"\"\"\n    Ensure that custom lookup fields are correctly routed.\n    \"\"\"\n    urlpatterns = [\n        path('example/', include(notes_router.urls)),\n        path('example2/', include(kwarged_notes_router.urls)),\n    ]\n\n    def setUp(self):\n        RouterTestModel.objects.create(uuid='123', text='foo bar')\n        RouterTestModel.objects.create(uuid='a b', text='baz qux')\n\n    def test_custom_lookup_field_route(self):\n        detail_route = notes_router.urls[-1]\n        assert '<uuid>' in detail_route.pattern.regex.pattern\n\n    def test_retrieve_lookup_field_list_view(self):\n        response = self.client.get('/example/notes/')\n        assert response.data == [\n            {\"url\": \"http://testserver/example/notes/123/\", \"uuid\": \"123\", \"text\": \"foo bar\"},\n            {\"url\": \"http://testserver/example/notes/a%20b/\", \"uuid\": \"a b\", \"text\": \"baz qux\"},\n        ]\n\n    def test_retrieve_lookup_field_detail_view(self):\n        response = self.client.get('/example/notes/123/')\n        assert response.data == {\"url\": \"http://testserver/example/notes/123/\", \"uuid\": \"123\", \"text\": \"foo bar\"}\n\n    def test_retrieve_lookup_field_url_encoded_detail_view_(self):\n        response = self.client.get('/example/notes/a%20b/')\n        assert response.data == {\"url\": \"http://testserver/example/notes/a%20b/\", \"uuid\": \"a b\", \"text\": \"baz qux\"}\n\n\nclass TestLookupValueRegex(TestCase):\n    \"\"\"\n    Ensure the router honors lookup_value_regex when applied\n    to the viewset.\n    \"\"\"\n    def setUp(self):\n        class NoteViewSet(viewsets.ModelViewSet):\n            queryset = RouterTestModel.objects.all()\n            lookup_field = 'uuid'\n            lookup_value_regex = '[0-9a-f]{32}'\n\n        self.router = SimpleRouter()\n        self.router.register(r'notes', NoteViewSet)\n        self.urls = self.router.urls\n\n    def test_urls_limited_by_lookup_value_regex(self):\n        expected = ['^notes/$', '^notes/(?P<uuid>[0-9a-f]{32})/$']\n        for idx in range(len(expected)):\n            assert expected[idx] == self.urls[idx].pattern.regex.pattern\n\n\n@override_settings(ROOT_URLCONF='tests.test_routers')\nclass TestLookupUrlKwargs(URLPatternsTestCase, TestCase):\n    \"\"\"\n    Ensure the router honors lookup_url_kwarg.\n\n    Setup a deep lookup_field, but map it to a simple URL kwarg.\n    \"\"\"\n    urlpatterns = [\n        path('example/', include(notes_router.urls)),\n        path('example2/', include(kwarged_notes_router.urls)),\n    ]\n\n    def setUp(self):\n        RouterTestModel.objects.create(uuid='123', text='foo bar')\n\n    def test_custom_lookup_url_kwarg_route(self):\n        detail_route = kwarged_notes_router.urls[-1]\n        assert '^notes/(?P<text>' in detail_route.pattern.regex.pattern\n\n    def test_retrieve_lookup_url_kwarg_detail_view(self):\n        response = self.client.get('/example2/notes/fo/')\n        assert response.data == {\"url\": \"http://testserver/example/notes/123/\", \"uuid\": \"123\", \"text\": \"foo bar\"}\n\n    def test_retrieve_lookup_url_encoded_kwarg_detail_view(self):\n        response = self.client.get('/example2/notes/foo%20bar/')\n        assert response.data == {\"url\": \"http://testserver/example/notes/123/\", \"uuid\": \"123\", \"text\": \"foo bar\"}\n\n\nclass TestTrailingSlashIncluded(TestCase):\n    def setUp(self):\n        class NoteViewSet(viewsets.ModelViewSet):\n            queryset = RouterTestModel.objects.all()\n\n        self.router = SimpleRouter()\n        self.router.register(r'notes', NoteViewSet)\n        self.urls = self.router.urls\n\n    def test_urls_have_trailing_slash_by_default(self):\n        expected = ['^notes/$', '^notes/(?P<pk>[^/.]+)/$']\n        for idx in range(len(expected)):\n            assert expected[idx] == self.urls[idx].pattern.regex.pattern\n\n\nclass TestTrailingSlashRemoved(TestCase):\n    def setUp(self):\n        class NoteViewSet(viewsets.ModelViewSet):\n            queryset = RouterTestModel.objects.all()\n\n        self.router = SimpleRouter(trailing_slash=False)\n        self.router.register(r'notes', NoteViewSet)\n        self.urls = self.router.urls\n\n    def test_urls_can_have_trailing_slash_removed(self):\n        expected = ['^notes$', '^notes/(?P<pk>[^/.]+)$']\n        for idx in range(len(expected)):\n            assert expected[idx] == self.urls[idx].pattern.regex.pattern\n\n\nclass TestNameableRoot(TestCase):\n    def setUp(self):\n        class NoteViewSet(viewsets.ModelViewSet):\n            queryset = RouterTestModel.objects.all()\n\n        self.router = DefaultRouter()\n        self.router.root_view_name = 'nameable-root'\n        self.router.register(r'notes', NoteViewSet)\n        self.urls = self.router.urls\n\n    def test_router_has_custom_name(self):\n        expected = 'nameable-root'\n        assert expected == self.urls[-1].name\n\n\nclass TestActionKeywordArgs(TestCase):\n    \"\"\"\n    Ensure keyword arguments passed in the `@action` decorator\n    are properly handled.  Refs #940.\n    \"\"\"\n\n    def setUp(self):\n        class TestViewSet(viewsets.ModelViewSet):\n            permission_classes = []\n\n            @action(methods=['post'], detail=True, permission_classes=[permissions.AllowAny])\n            def custom(self, request, *args, **kwargs):\n                return Response({\n                    'permission_classes': self.permission_classes\n                })\n\n        self.router = SimpleRouter()\n        self.router.register(r'test', TestViewSet, basename='test')\n        self.view = self.router.urls[-1].callback\n\n    def test_action_kwargs(self):\n        request = factory.post('/test/0/custom/')\n        response = self.view(request)\n        assert response.data == {'permission_classes': [permissions.AllowAny]}\n\n\nclass TestActionAppliedToExistingRoute(TestCase):\n    \"\"\"\n    Ensure `@action` decorator raises an except when applied\n    to an existing route\n    \"\"\"\n\n    def test_exception_raised_when_action_applied_to_existing_route(self):\n        class TestViewSet(viewsets.ModelViewSet):\n\n            @action(methods=['post'], detail=True)\n            def retrieve(self, request, *args, **kwargs):\n                return Response({\n                    'hello': 'world'\n                })\n\n        self.router = SimpleRouter()\n        self.router.register(r'test', TestViewSet, basename='test')\n\n        with pytest.raises(ImproperlyConfigured):\n            self.router.urls\n\n\nclass DynamicListAndDetailViewSet(viewsets.ViewSet):\n    def list(self, request, *args, **kwargs):\n        return Response({'method': 'list'})\n\n    @action(methods=['post'], detail=False)\n    def list_route_post(self, request, *args, **kwargs):\n        return Response({'method': 'action1'})\n\n    @action(methods=['post'], detail=True)\n    def detail_route_post(self, request, *args, **kwargs):\n        return Response({'method': 'action2'})\n\n    @action(detail=False)\n    def list_route_get(self, request, *args, **kwargs):\n        return Response({'method': 'link1'})\n\n    @action(detail=True)\n    def detail_route_get(self, request, *args, **kwargs):\n        return Response({'method': 'link2'})\n\n    @action(detail=False, url_path=\"list_custom-route\")\n    def list_custom_route_get(self, request, *args, **kwargs):\n        return Response({'method': 'link1'})\n\n    @action(detail=True, url_path=\"detail_custom-route\")\n    def detail_custom_route_get(self, request, *args, **kwargs):\n        return Response({'method': 'link2'})\n\n\nclass SubDynamicListAndDetailViewSet(DynamicListAndDetailViewSet):\n    pass\n\n\nclass TestDynamicListAndDetailRouter(TestCase):\n    def setUp(self):\n        self.router = SimpleRouter()\n\n    def _test_list_and_detail_route_decorators(self, viewset):\n        routes = self.router.get_routes(viewset)\n        decorator_routes = [r for r in routes if not (r.name.endswith('-list') or r.name.endswith('-detail'))]\n\n        MethodNamesMap = namedtuple('MethodNamesMap', 'method_name url_path')\n        # Make sure all these endpoints exist and none have been clobbered\n        for i, endpoint in enumerate([MethodNamesMap('list_custom_route_get', 'list_custom-route'),\n                                      MethodNamesMap('list_route_get', 'list_route_get'),\n                                      MethodNamesMap('list_route_post', 'list_route_post'),\n                                      MethodNamesMap('detail_custom_route_get', 'detail_custom-route'),\n                                      MethodNamesMap('detail_route_get', 'detail_route_get'),\n                                      MethodNamesMap('detail_route_post', 'detail_route_post')\n                                      ]):\n            route = decorator_routes[i]\n            # check url listing\n            method_name = endpoint.method_name\n            url_path = endpoint.url_path\n\n            if method_name.startswith('list_'):\n                assert route.url == f'^{{prefix}}/{url_path}{{trailing_slash}}$'\n            else:\n                assert route.url == f'^{{prefix}}/{{lookup}}/{url_path}{{trailing_slash}}$'\n            # check method to function mapping\n            if method_name.endswith('_post'):\n                method_map = 'post'\n            else:\n                method_map = 'get'\n            assert route.mapping[method_map] == method_name\n\n    def test_list_and_detail_route_decorators(self):\n        self._test_list_and_detail_route_decorators(DynamicListAndDetailViewSet)\n\n    def test_inherited_list_and_detail_route_decorators(self):\n        self._test_list_and_detail_route_decorators(SubDynamicListAndDetailViewSet)\n\n\nclass TestEmptyPrefix(URLPatternsTestCase, TestCase):\n    urlpatterns = [\n        path('empty-prefix/', include(empty_prefix_router.urls)),\n    ]\n\n    def test_empty_prefix_list(self):\n        response = self.client.get('/empty-prefix/')\n        assert response.status_code == 200\n        assert json.loads(response.content.decode()) == [{'uuid': '111', 'text': 'First'},\n                                                         {'uuid': '222', 'text': 'Second'}]\n\n    def test_empty_prefix_detail(self):\n        response = self.client.get('/empty-prefix/1/')\n        assert response.status_code == 200\n        assert json.loads(response.content.decode()) == {'uuid': '111', 'text': 'First'}\n\n\nclass TestRegexUrlPath(URLPatternsTestCase, TestCase):\n    urlpatterns = [\n        path('regex/', include(regex_url_path_router.urls)),\n    ]\n\n    def test_regex_url_path_list(self):\n        kwarg = '1234'\n        response = self.client.get(f'/regex/list/{kwarg}/')\n        assert response.status_code == 200\n        assert json.loads(response.content.decode()) == {'kwarg': kwarg}\n\n    def test_regex_url_path_detail(self):\n        pk = '1'\n        kwarg = '1234'\n        response = self.client.get(f'/regex/{pk}/detail/{kwarg}/')\n        assert response.status_code == 200\n        assert json.loads(response.content.decode()) == {'pk': pk, 'kwarg': kwarg}\n\n\nclass TestUrlPath(URLPatternsTestCase, TestCase):\n    client_class = APIClient\n    urlpatterns = [\n        path('path/', include(url_path_router.urls)),\n        path('default/', include(notes_path_default_router.urls)),\n        path('example/', include(notes_path_router.urls)),\n    ]\n\n    def setUp(self):\n        RouterTestModel.objects.create(uuid='123', text='foo bar')\n        RouterTestModel.objects.create(uuid='a b', text='baz qux')\n\n    def test_create(self):\n        new_note = {\n            'uuid': 'foo',\n            'text': 'example'\n        }\n        response = self.client.post('/example/notes/', data=new_note)\n        assert response.status_code == 201\n        assert response['location'] == 'http://testserver/example/notes/foo/'\n        assert response.data == {\"url\": \"http://testserver/example/notes/foo/\", \"uuid\": \"foo\", \"text\": \"example\"}\n        assert RouterTestModel.objects.filter(uuid='foo').exists()\n\n    def test_retrieve(self):\n        for url in ('/example/notes/123/', '/default/notes/123/'):\n            with self.subTest(url=url):\n                response = self.client.get(url)\n                assert response.status_code == 200\n                # only gets example path since was the last to be registered\n                assert response.data == {\"url\": \"http://testserver/example/notes/123/\", \"uuid\": \"123\", \"text\": \"foo bar\"}\n\n    def test_list(self):\n        for url in ('/example/notes/', '/default/notes/'):\n            with self.subTest(url=url):\n                response = self.client.get(url)\n                assert response.status_code == 200\n                # only gets example path since was the last to be registered\n                assert response.data == [\n                    {\"url\": \"http://testserver/example/notes/123/\", \"uuid\": \"123\", \"text\": \"foo bar\"},\n                    {\"url\": \"http://testserver/example/notes/a%20b/\", \"uuid\": \"a b\", \"text\": \"baz qux\"},\n                ]\n\n    def test_update(self):\n        updated_note = {\n            'text': 'foo bar example'\n        }\n        response = self.client.patch('/example/notes/123/', data=updated_note)\n        assert response.status_code == 200\n        assert response.data == {\"url\": \"http://testserver/example/notes/123/\", \"uuid\": \"123\", \"text\": \"foo bar example\"}\n\n    def test_delete(self):\n        response = self.client.delete('/example/notes/123/')\n        assert response.status_code == 204\n        assert not RouterTestModel.objects.filter(uuid='123').exists()\n\n    def test_list_extra_action(self):\n        kwarg = 1234\n        response = self.client.get(f'/path/list/{kwarg}/')\n        assert response.status_code == 200\n        assert json.loads(response.content.decode()) == {'kwarg': kwarg}\n\n    def test_detail_extra_action(self):\n        pk = '1'\n        kwarg = 1234\n        response = self.client.get(f'/path/{pk}/detail/{kwarg}/')\n        assert response.status_code == 200\n        assert json.loads(response.content.decode()) == {'pk': pk, 'kwarg': kwarg}\n\n    def test_detail_extra_other_action(self):\n        # this to assure that ambiguous patterns are interpreted correctly\n        # using the `path` converters this URL is recognized to match the pattern\n        # of `UrlPathViewSet.url_path_detail` when it should match\n        # `UrlPathViewSet.url_path_detail_multiple_params`\n        pk = '1'\n        kwarg = 1234\n        param = 2\n        response = self.client.get('/path/1/detail/1234/detail/2/')\n        assert response.status_code == 200\n        assert json.loads(response.content.decode()) == {'pk': pk, 'kwarg': kwarg, 'param': param}\n\n    def test_defaultrouter_root(self):\n        response = self.client.get('/default/')\n        assert response.status_code == 200\n        # only gets example path since was the last to be registered\n        assert response.data == {\"notes\": \"http://testserver/example/notes/\"}\n\n\nclass TestViewInitkwargs(URLPatternsTestCase, TestCase):\n    urlpatterns = [\n        path('example/', include(notes_router.urls)),\n    ]\n\n    def test_suffix(self):\n        match = resolve('/example/notes/')\n        initkwargs = match.func.initkwargs\n\n        assert initkwargs['suffix'] == 'List'\n\n    def test_detail(self):\n        match = resolve('/example/notes/')\n        initkwargs = match.func.initkwargs\n\n        assert not initkwargs['detail']\n\n    def test_basename(self):\n        match = resolve('/example/notes/')\n        initkwargs = match.func.initkwargs\n\n        assert initkwargs['basename'] == 'routertestmodel'\n\n\nclass BasenameTestCase:\n    def test_conflicting_autogenerated_basenames(self):\n        \"\"\"\n        Ensure 2 routers with the same model, and no basename specified\n        throws an ImproperlyConfigured exception\n        \"\"\"\n        self.router.register(r'notes', NoteViewSet)\n\n        with pytest.raises(ImproperlyConfigured):\n            self.router.register(r'notes_kwduplicate', KWargedNoteViewSet)\n\n        with pytest.raises(ImproperlyConfigured):\n            self.router.register(r'notes_duplicate', NoteViewSet)\n\n    def test_conflicting_mixed_basenames(self):\n        \"\"\"\n        Ensure 2 routers with the same model, and no basename specified on 1\n        throws an ImproperlyConfigured exception\n        \"\"\"\n        self.router.register(r'notes', NoteViewSet)\n\n        with pytest.raises(ImproperlyConfigured):\n            self.router.register(r'notes_kwduplicate', KWargedNoteViewSet, basename='routertestmodel')\n\n        with pytest.raises(ImproperlyConfigured):\n            self.router.register(r'notes_duplicate', NoteViewSet, basename='routertestmodel')\n\n    def test_nonconflicting_mixed_basenames(self):\n        \"\"\"\n        Ensure 2 routers with the same model, and a distinct basename\n        specified on the second router does not fail\n        \"\"\"\n        self.router.register(r'notes', NoteViewSet)\n        self.router.register(r'notes_kwduplicate', KWargedNoteViewSet, basename='routertestmodel_kwduplicate')\n        self.router.register(r'notes_duplicate', NoteViewSet, basename='routertestmodel_duplicate')\n\n    def test_conflicting_specified_basename(self):\n        \"\"\"\n        Ensure 2 routers with the same model, and the same basename specified\n        on both throws an ImproperlyConfigured exception\n        \"\"\"\n        self.router.register(r'notes', NoteViewSet, basename='notes')\n\n        with pytest.raises(ImproperlyConfigured):\n            self.router.register(r'notes_kwduplicate', KWargedNoteViewSet, basename='notes')\n\n        with pytest.raises(ImproperlyConfigured):\n            self.router.register(r'notes_duplicate', KWargedNoteViewSet, basename='notes')\n\n    def test_nonconflicting_specified_basename(self):\n        \"\"\"\n        Ensure 2 routers with the same model, and a distinct basename specified\n        on each does not throw an exception\n        \"\"\"\n        self.router.register(r'notes', NoteViewSet, basename='notes')\n        self.router.register(r'notes_kwduplicate', KWargedNoteViewSet, basename='notes_kwduplicate')\n        self.router.register(r'notes_duplicate', NoteViewSet, basename='notes_duplicate')\n\n    def test_nonconflicting_specified_basename_different_models(self):\n        \"\"\"\n        Ensure 2 routers with different models, and a distinct basename specified\n        on each does not throw an exception\n        \"\"\"\n        self.router.register(r'notes', NoteViewSet, basename='notes')\n        self.router.register(r'notes_basename', BasenameViewSet, basename='notes_basename')\n\n    def test_conflicting_specified_basename_different_models(self):\n        \"\"\"\n        Ensure 2 routers with different models, and a conflicting basename specified\n        throws an exception\n        \"\"\"\n        self.router.register(r'notes', NoteViewSet)\n        with pytest.raises(ImproperlyConfigured):\n            self.router.register(r'notes_basename', BasenameViewSet, basename='routertestmodel')\n\n    def test_nonconflicting_autogenerated_basename_different_models(self):\n        \"\"\"\n        Ensure 2 routers with different models, and a distinct basename specified\n        on each does not throw an exception\n        \"\"\"\n        self.router.register(r'notes', NoteViewSet)\n        self.router.register(r'notes_basename', BasenameViewSet)\n\n\nclass TestDuplicateBasenameSimpleRouter(BasenameTestCase, TestCase):\n    def setUp(self):\n        self.router = SimpleRouter(trailing_slash=False)\n\n\nclass TestDuplicateBasenameDefaultRouter(BasenameTestCase, TestCase):\n    def setUp(self):\n        self.router = DefaultRouter()\n\n\nclass TestDuplicateBasenameDefaultRouterRootViewName(BasenameTestCase, TestCase):\n    def setUp(self):\n        self.router = DefaultRouter()\n        self.router.root_view_name = 'nameable-root'\n"
  },
  {
    "path": "tests/test_serializer.py",
    "content": "import inspect\nimport pickle\nimport re\nfrom collections import ChainMap\nfrom collections.abc import Mapping\n\nimport pytest\nfrom django.db import models\nfrom django.test import TestCase\n\nfrom rest_framework import exceptions, fields, relations, serializers\nfrom rest_framework.fields import Field\n\nfrom .models import (\n    ForeignKeyTarget, ManyToManySource, ManyToManyTarget,\n    NestedForeignKeySource, NullableForeignKeySource\n)\nfrom .utils import MockObject\n\n\n# Test serializer fields imports.\n# -------------------------------\nclass TestFieldImports:\n    def is_field(self, name, value):\n        return (\n            isinstance(value, type) and\n            issubclass(value, Field) and\n            not name.startswith('_')\n        )\n\n    def test_fields(self):\n        msg = \"Expected `fields.%s` to be imported in `serializers`\"\n        field_classes = [\n            key for key, value\n            in inspect.getmembers(fields)\n            if self.is_field(key, value)\n        ]\n\n        # sanity check\n        assert 'Field' in field_classes\n        assert 'BooleanField' in field_classes\n\n        for field in field_classes:\n            assert hasattr(serializers, field), msg % field\n\n    def test_relations(self):\n        msg = \"Expected `relations.%s` to be imported in `serializers`\"\n        field_classes = [\n            key for key, value\n            in inspect.getmembers(relations)\n            if self.is_field(key, value)\n        ]\n\n        # sanity check\n        assert 'RelatedField' in field_classes\n\n        for field in field_classes:\n            assert hasattr(serializers, field), msg % field\n\n\n# Tests for core functionality.\n# -----------------------------\n\nclass TestSerializer:\n    def setup_method(self):\n        class ExampleSerializer(serializers.Serializer):\n            char = serializers.CharField()\n            integer = serializers.IntegerField()\n\n        self.Serializer = ExampleSerializer\n\n    def test_valid_serializer(self):\n        serializer = self.Serializer(data={'char': 'abc', 'integer': 123})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'char': 'abc', 'integer': 123}\n        assert serializer.data == {'char': 'abc', 'integer': 123}\n        assert serializer.errors == {}\n\n    def test_invalid_serializer(self):\n        serializer = self.Serializer(data={'char': 'abc'})\n        assert not serializer.is_valid()\n        assert serializer.validated_data == {}\n        assert serializer.data == {'char': 'abc'}\n        assert serializer.errors == {'integer': ['This field is required.']}\n\n    def test_invalid_datatype(self):\n        serializer = self.Serializer(data=[{'char': 'abc'}])\n        assert not serializer.is_valid()\n        assert serializer.validated_data == {}\n        assert serializer.data == {}\n        assert serializer.errors == {'non_field_errors': ['Invalid data. Expected a dictionary, but got list.']}\n\n    def test_partial_validation(self):\n        serializer = self.Serializer(data={'char': 'abc'}, partial=True)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'char': 'abc'}\n        assert serializer.errors == {}\n\n    def test_empty_serializer(self):\n        serializer = self.Serializer()\n        assert serializer.data == {'char': '', 'integer': None}\n\n    def test_missing_attribute_during_serialization(self):\n        class MissingAttributes:\n            pass\n        instance = MissingAttributes()\n        serializer = self.Serializer(instance)\n        with pytest.raises(AttributeError):\n            serializer.data\n\n    def test_data_access_before_save_raises_error(self):\n        def create(validated_data):\n            return validated_data\n        serializer = self.Serializer(data={'char': 'abc', 'integer': 123})\n        serializer.create = create\n        assert serializer.is_valid()\n        assert serializer.data == {'char': 'abc', 'integer': 123}\n        with pytest.raises(AssertionError):\n            serializer.save()\n\n    def test_validate_none_data(self):\n        data = None\n        serializer = self.Serializer(data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {'non_field_errors': ['No data provided']}\n\n    def test_serialize_chainmap(self):\n        data = ChainMap({'char': 'abc'}, {'integer': 123})\n        serializer = self.Serializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'char': 'abc', 'integer': 123}\n        assert serializer.errors == {}\n\n    def test_serialize_custom_mapping(self):\n        class SinglePurposeMapping(Mapping):\n            def __getitem__(self, key):\n                return 'abc' if key == 'char' else 123\n\n            def __iter__(self):\n                yield 'char'\n                yield 'integer'\n\n            def __len__(self):\n                return 2\n\n        serializer = self.Serializer(data=SinglePurposeMapping())\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'char': 'abc', 'integer': 123}\n        assert serializer.errors == {}\n\n    def test_custom_to_internal_value(self):\n        \"\"\"\n        to_internal_value() is expected to return a dict, but subclasses may\n        return application specific type.\n        \"\"\"\n        class Point:\n            def __init__(self, srid, x, y):\n                self.srid = srid\n                self.coords = (x, y)\n\n        # Declares a serializer that converts data into an object\n        class NestedPointSerializer(serializers.Serializer):\n            longitude = serializers.FloatField(source='x')\n            latitude = serializers.FloatField(source='y')\n\n            def to_internal_value(self, data):\n                kwargs = super().to_internal_value(data)\n                return Point(srid=4326, **kwargs)\n\n        serializer = NestedPointSerializer(data={'longitude': 6.958307, 'latitude': 50.941357})\n        assert serializer.is_valid()\n        assert isinstance(serializer.validated_data, Point)\n        assert serializer.validated_data.srid == 4326\n        assert serializer.validated_data.coords[0] == 6.958307\n        assert serializer.validated_data.coords[1] == 50.941357\n        assert serializer.errors == {}\n\n    def test_iterable_validators(self):\n        \"\"\"\n        Ensure `validators` parameter is compatible with reasonable iterables.\n        \"\"\"\n        data = {'char': 'abc', 'integer': 123}\n\n        for validators in ([], (), set()):\n            class ExampleSerializer(serializers.Serializer):\n                char = serializers.CharField(validators=validators)\n                integer = serializers.IntegerField()\n\n            serializer = ExampleSerializer(data=data)\n            assert serializer.is_valid()\n            assert serializer.validated_data == data\n            assert serializer.errors == {}\n\n        def raise_exception(value):\n            raise exceptions.ValidationError('Raised error')\n\n        for validators in ([raise_exception], (raise_exception,), {raise_exception}):\n            class ExampleSerializer(serializers.Serializer):\n                char = serializers.CharField(validators=validators)\n                integer = serializers.IntegerField()\n\n            serializer = ExampleSerializer(data=data)\n            assert not serializer.is_valid()\n            assert serializer.data == data\n            assert serializer.validated_data == {}\n            assert serializer.errors == {'char': [\n                exceptions.ErrorDetail(string='Raised error', code='invalid')\n            ]}\n\n    def test_serializer_is_subscriptable(self):\n        assert serializers.Serializer is serializers.Serializer[\"foo\"]\n\n\nclass TestValidateMethod:\n    def test_non_field_error_validate_method(self):\n        class ExampleSerializer(serializers.Serializer):\n            char = serializers.CharField()\n            integer = serializers.IntegerField()\n\n            def validate(self, attrs):\n                raise serializers.ValidationError('Non field error')\n\n        serializer = ExampleSerializer(data={'char': 'abc', 'integer': 123})\n        assert not serializer.is_valid()\n        assert serializer.errors == {'non_field_errors': ['Non field error']}\n\n    def test_field_error_validate_method(self):\n        class ExampleSerializer(serializers.Serializer):\n            char = serializers.CharField()\n            integer = serializers.IntegerField()\n\n            def validate(self, attrs):\n                raise serializers.ValidationError({'char': 'Field error'})\n\n        serializer = ExampleSerializer(data={'char': 'abc', 'integer': 123})\n        assert not serializer.is_valid()\n        assert serializer.errors == {'char': ['Field error']}\n\n\nclass TestBaseSerializer:\n    def setup_method(self):\n        class ExampleSerializer(serializers.BaseSerializer):\n            def to_representation(self, obj):\n                return {\n                    'id': obj['id'],\n                    'email': obj['name'] + '@' + obj['domain']\n                }\n\n            def to_internal_value(self, data):\n                name, domain = str(data['email']).split('@')\n                return {\n                    'id': int(data['id']),\n                    'name': name,\n                    'domain': domain,\n                }\n\n        self.Serializer = ExampleSerializer\n\n    def test_abstract_methods_raise_proper_errors(self):\n        serializer = serializers.BaseSerializer()\n        with pytest.raises(NotImplementedError):\n            serializer.to_internal_value(None)\n        with pytest.raises(NotImplementedError):\n            serializer.to_representation(None)\n        with pytest.raises(NotImplementedError):\n            serializer.update(None, None)\n        with pytest.raises(NotImplementedError):\n            serializer.create(None)\n\n    def test_access_to_data_attribute_before_validation_raises_error(self):\n        serializer = serializers.BaseSerializer(data={'foo': 'bar'})\n        with pytest.raises(AssertionError):\n            serializer.data\n\n    def test_access_to_errors_attribute_before_validation_raises_error(self):\n        serializer = serializers.BaseSerializer(data={'foo': 'bar'})\n        with pytest.raises(AssertionError):\n            serializer.errors\n\n    def test_access_to_validated_data_attribute_before_validation_raises_error(self):\n        serializer = serializers.BaseSerializer(data={'foo': 'bar'})\n        with pytest.raises(AssertionError):\n            serializer.validated_data\n\n    def test_serialize_instance(self):\n        instance = {'id': 1, 'name': 'tom', 'domain': 'example.com'}\n        serializer = self.Serializer(instance)\n        assert serializer.data == {'id': 1, 'email': 'tom@example.com'}\n\n    def test_serialize_list(self):\n        instances = [\n            {'id': 1, 'name': 'tom', 'domain': 'example.com'},\n            {'id': 2, 'name': 'ann', 'domain': 'example.com'},\n        ]\n        serializer = self.Serializer(instances, many=True)\n        assert serializer.data == [\n            {'id': 1, 'email': 'tom@example.com'},\n            {'id': 2, 'email': 'ann@example.com'}\n        ]\n\n    def test_validate_data(self):\n        data = {'id': 1, 'email': 'tom@example.com'}\n        serializer = self.Serializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'id': 1,\n            'name': 'tom',\n            'domain': 'example.com'\n        }\n\n    def test_validate_list(self):\n        data = [\n            {'id': 1, 'email': 'tom@example.com'},\n            {'id': 2, 'email': 'ann@example.com'},\n        ]\n        serializer = self.Serializer(data=data, many=True)\n        assert serializer.is_valid()\n        assert serializer.validated_data == [\n            {'id': 1, 'name': 'tom', 'domain': 'example.com'},\n            {'id': 2, 'name': 'ann', 'domain': 'example.com'}\n        ]\n\n\nclass TestStarredSource:\n    \"\"\"\n    Tests for `source='*'` argument, which is often used for complex field or\n    nested representations.\n\n    For example:\n\n        nested_field = NestedField(source='*')\n    \"\"\"\n    data = {\n        'nested1': {'a': 1, 'b': 2},\n        'nested2': {'c': 3, 'd': 4}\n    }\n\n    def setup_method(self):\n        class NestedSerializer1(serializers.Serializer):\n            a = serializers.IntegerField()\n            b = serializers.IntegerField()\n\n        class NestedSerializer2(serializers.Serializer):\n            c = serializers.IntegerField()\n            d = serializers.IntegerField()\n\n        class NestedBaseSerializer(serializers.Serializer):\n            nested1 = NestedSerializer1(source='*')\n            nested2 = NestedSerializer2(source='*')\n\n        # nullable nested serializer testing\n        class NullableNestedSerializer(serializers.Serializer):\n            nested = NestedSerializer1(source='*', allow_null=True)\n\n        # nullable custom field testing\n        class CustomField(serializers.Field):\n            def to_representation(self, instance):\n                return getattr(instance, 'foo', None)\n\n            def to_internal_value(self, data):\n                return {'foo': data}\n\n        class NullableFieldSerializer(serializers.Serializer):\n            field = CustomField(source='*', allow_null=True)\n\n        self.Serializer = NestedBaseSerializer\n        self.NullableNestedSerializer = NullableNestedSerializer\n        self.NullableFieldSerializer = NullableFieldSerializer\n\n    def test_nested_validate(self):\n        \"\"\"\n        A nested representation is validated into a flat internal object.\n        \"\"\"\n        serializer = self.Serializer(data=self.data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'a': 1,\n            'b': 2,\n            'c': 3,\n            'd': 4\n        }\n\n    def test_nested_null_validate(self):\n        serializer = self.NullableNestedSerializer(data={'nested': None})\n\n        # validation should fail (but not error) since nested fields are required\n        assert not serializer.is_valid()\n\n    def test_nested_serialize(self):\n        \"\"\"\n        An object can be serialized into a nested representation.\n        \"\"\"\n        instance = {'a': 1, 'b': 2, 'c': 3, 'd': 4}\n        serializer = self.Serializer(instance)\n        assert serializer.data == self.data\n\n    def test_field_validate(self):\n        serializer = self.NullableFieldSerializer(data={'field': 'bar'})\n\n        # validation should pass since no internal validation\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'foo': 'bar'}\n\n    def test_field_null_validate(self):\n        serializer = self.NullableFieldSerializer(data={'field': None})\n\n        # validation should pass since no internal validation\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'foo': None}\n\n\nclass TestIncorrectlyConfigured:\n    def test_incorrect_field_name(self):\n        class ExampleSerializer(serializers.Serializer):\n            incorrect_name = serializers.IntegerField()\n\n        class ExampleObject:\n            def __init__(self):\n                self.correct_name = 123\n\n        instance = ExampleObject()\n        serializer = ExampleSerializer(instance)\n        with pytest.raises(AttributeError) as exc_info:\n            serializer.data\n        msg = str(exc_info.value)\n        assert msg.startswith(\n            \"Got AttributeError when attempting to get a value for field `incorrect_name` on serializer `ExampleSerializer`.\\n\"\n            \"The serializer field might be named incorrectly and not match any attribute or key on the `ExampleObject` instance.\\n\"\n            \"Original exception text was:\"\n        )\n\n\nclass TestNotRequiredOutput:\n    def test_not_required_output_for_dict(self):\n        \"\"\"\n        'required=False' should allow a dictionary key to be missing in output.\n        \"\"\"\n        class ExampleSerializer(serializers.Serializer):\n            omitted = serializers.CharField(required=False)\n            included = serializers.CharField()\n\n        serializer = ExampleSerializer(data={'included': 'abc'})\n        serializer.is_valid()\n        assert serializer.data == {'included': 'abc'}\n\n    def test_not_required_output_for_object(self):\n        \"\"\"\n        'required=False' should allow an object attribute to be missing in output.\n        \"\"\"\n        class ExampleSerializer(serializers.Serializer):\n            omitted = serializers.CharField(required=False)\n            included = serializers.CharField()\n\n            def create(self, validated_data):\n                return MockObject(**validated_data)\n\n        serializer = ExampleSerializer(data={'included': 'abc'})\n        serializer.is_valid()\n        serializer.save()\n        assert serializer.data == {'included': 'abc'}\n\n\nclass TestDefaultOutput:\n    def setup_method(self):\n        class ExampleSerializer(serializers.Serializer):\n            has_default = serializers.CharField(default='x')\n            has_default_callable = serializers.CharField(default=lambda: 'y')\n            no_default = serializers.CharField()\n        self.Serializer = ExampleSerializer\n\n    def test_default_used_for_dict(self):\n        \"\"\"\n        'default=\"something\"' should be used if dictionary key is missing from input.\n        \"\"\"\n        serializer = self.Serializer({'no_default': 'abc'})\n        assert serializer.data == {'has_default': 'x', 'has_default_callable': 'y', 'no_default': 'abc'}\n\n    def test_default_used_for_object(self):\n        \"\"\"\n        'default=\"something\"' should be used if object attribute is missing from input.\n        \"\"\"\n        instance = MockObject(no_default='abc')\n        serializer = self.Serializer(instance)\n        assert serializer.data == {'has_default': 'x', 'has_default_callable': 'y', 'no_default': 'abc'}\n\n    def test_default_not_used_when_in_dict(self):\n        \"\"\"\n        'default=\"something\"' should not be used if dictionary key is present in input.\n        \"\"\"\n        serializer = self.Serializer({'has_default': 'def', 'has_default_callable': 'ghi', 'no_default': 'abc'})\n        assert serializer.data == {'has_default': 'def', 'has_default_callable': 'ghi', 'no_default': 'abc'}\n\n    def test_default_not_used_when_in_object(self):\n        \"\"\"\n        'default=\"something\"' should not be used if object attribute is present in input.\n        \"\"\"\n        instance = MockObject(has_default='def', has_default_callable='ghi', no_default='abc')\n        serializer = self.Serializer(instance)\n        assert serializer.data == {'has_default': 'def', 'has_default_callable': 'ghi', 'no_default': 'abc'}\n\n    def test_default_for_dotted_source(self):\n        \"\"\"\n        'default=\"something\"' should be used when a traversed attribute is missing from input.\n        \"\"\"\n        class Serializer(serializers.Serializer):\n            traversed = serializers.CharField(default='x', source='traversed.attr')\n\n        assert Serializer({}).data == {'traversed': 'x'}\n        assert Serializer({'traversed': {}}).data == {'traversed': 'x'}\n        assert Serializer({'traversed': None}).data == {'traversed': 'x'}\n\n        assert Serializer({'traversed': {'attr': 'abc'}}).data == {'traversed': 'abc'}\n\n    def test_default_for_multiple_dotted_source(self):\n        class Serializer(serializers.Serializer):\n            c = serializers.CharField(default='x', source='a.b.c')\n\n        assert Serializer({}).data == {'c': 'x'}\n        assert Serializer({'a': {}}).data == {'c': 'x'}\n        assert Serializer({'a': None}).data == {'c': 'x'}\n        assert Serializer({'a': {'b': {}}}).data == {'c': 'x'}\n        assert Serializer({'a': {'b': None}}).data == {'c': 'x'}\n\n        assert Serializer({'a': {'b': {'c': 'abc'}}}).data == {'c': 'abc'}\n\n        # Same test using model objects to exercise both paths in\n        # rest_framework.fields.get_attribute() (#5880)\n        class ModelSerializer(serializers.Serializer):\n            target = serializers.CharField(default='x', source='target.target.name')\n\n        a = NestedForeignKeySource(name=\"Root Object\", target=None)\n        assert ModelSerializer(a).data == {'target': 'x'}\n\n        b = NullableForeignKeySource(name=\"Intermediary Object\", target=None)\n        a.target = b\n        assert ModelSerializer(a).data == {'target': 'x'}\n\n        c = ForeignKeyTarget(name=\"Target Object\")\n        b.target = c\n        assert ModelSerializer(a).data == {'target': 'Target Object'}\n\n    def test_default_for_nested_serializer(self):\n        class NestedSerializer(serializers.Serializer):\n            a = serializers.CharField(default='1')\n            c = serializers.CharField(default='2', source='b.c')\n\n        class Serializer(serializers.Serializer):\n            nested = NestedSerializer()\n\n        assert Serializer({'nested': None}).data == {'nested': None}\n        assert Serializer({'nested': {}}).data == {'nested': {'a': '1', 'c': '2'}}\n        assert Serializer({'nested': {'a': '3', 'b': {}}}).data == {'nested': {'a': '3', 'c': '2'}}\n        assert Serializer({'nested': {'a': '3', 'b': {'c': '4'}}}).data == {'nested': {'a': '3', 'c': '4'}}\n\n    def test_default_for_allow_null(self):\n        \"\"\"\n        Without an explicit default, allow_null implies default=None when serializing. #5518 #5708\n        \"\"\"\n        class Serializer(serializers.Serializer):\n            foo = serializers.CharField()\n            bar = serializers.CharField(source='foo.bar', allow_null=True)\n            optional = serializers.CharField(required=False, allow_null=True)\n\n        # allow_null=True should imply default=None when serializing:\n        assert Serializer({'foo': None}).data == {'foo': None, 'bar': None, 'optional': None, }\n\n\nclass TestCacheSerializerData:\n    def test_cache_serializer_data(self):\n        \"\"\"\n        Caching serializer data with pickle will drop the serializer info,\n        but does preserve the data itself.\n        \"\"\"\n        class ExampleSerializer(serializers.Serializer):\n            field1 = serializers.CharField()\n            field2 = serializers.CharField()\n\n        serializer = ExampleSerializer({'field1': 'a', 'field2': 'b'})\n        pickled = pickle.dumps(serializer.data)\n        data = pickle.loads(pickled)\n        assert data == {'field1': 'a', 'field2': 'b'}\n\n\nclass TestDefaultInclusions:\n    def setup_method(self):\n        class ExampleSerializer(serializers.Serializer):\n            char = serializers.CharField(default='abc')\n            integer = serializers.IntegerField()\n        self.Serializer = ExampleSerializer\n\n    def test_default_should_included_on_create(self):\n        serializer = self.Serializer(data={'integer': 456})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'char': 'abc', 'integer': 456}\n        assert serializer.errors == {}\n\n    def test_default_should_be_included_on_update(self):\n        instance = MockObject(char='def', integer=123)\n        serializer = self.Serializer(instance, data={'integer': 456})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'char': 'abc', 'integer': 456}\n        assert serializer.errors == {}\n\n    def test_default_should_not_be_included_on_partial_update(self):\n        instance = MockObject(char='def', integer=123)\n        serializer = self.Serializer(instance, data={'integer': 456}, partial=True)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'integer': 456}\n        assert serializer.errors == {}\n\n\nclass TestSerializerValidationWithCompiledRegexField:\n    def setup_method(self):\n        class ExampleSerializer(serializers.Serializer):\n            name = serializers.RegexField(re.compile(r'\\d'), required=True)\n        self.Serializer = ExampleSerializer\n\n    def test_validation_success(self):\n        serializer = self.Serializer(data={'name': '2'})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'name': '2'}\n        assert serializer.errors == {}\n\n\nclass Test2555Regression:\n    def test_serializer_context(self):\n        class NestedSerializer(serializers.Serializer):\n            def __init__(self, *args, **kwargs):\n                super().__init__(*args, **kwargs)\n                # .context should not cache\n                self.context\n\n        class ParentSerializer(serializers.Serializer):\n            nested = NestedSerializer()\n\n        serializer = ParentSerializer(data={}, context={'foo': 'bar'})\n        assert serializer.context == {'foo': 'bar'}\n        assert serializer.fields['nested'].context == {'foo': 'bar'}\n\n\nclass Test4606Regression:\n    def setup_method(self):\n        class ExampleSerializer(serializers.Serializer):\n            name = serializers.CharField(required=True)\n            choices = serializers.CharField(required=True)\n        self.Serializer = ExampleSerializer\n\n    def test_4606_regression(self):\n        serializer = self.Serializer(data=[{\"name\": \"liz\"}], many=True)\n        with pytest.raises(serializers.ValidationError):\n            serializer.is_valid(raise_exception=True)\n\n\nclass TestDeclaredFieldInheritance:\n    def test_declared_field_disabling(self):\n        class Parent(serializers.Serializer):\n            f1 = serializers.CharField()\n            f2 = serializers.CharField()\n\n        class Child(Parent):\n            f1 = None\n\n        class Grandchild(Child):\n            pass\n\n        assert len(Parent._declared_fields) == 2\n        assert len(Child._declared_fields) == 1\n        assert len(Grandchild._declared_fields) == 1\n\n    def test_meta_field_disabling(self):\n        # Declaratively setting a field on a child class will *not* prevent\n        # the ModelSerializer from generating a default field.\n        class MyModel(models.Model):\n            f1 = models.CharField(max_length=10)\n            f2 = models.CharField(max_length=10)\n\n        class Parent(serializers.ModelSerializer):\n            class Meta:\n                model = MyModel\n                fields = ['f1', 'f2']\n\n        class Child(Parent):\n            f1 = None\n\n        class Grandchild(Child):\n            pass\n\n        assert len(Parent().get_fields()) == 2\n        assert len(Child().get_fields()) == 2\n        assert len(Grandchild().get_fields()) == 2\n\n    def test_multiple_inheritance(self):\n        class A(serializers.Serializer):\n            field = serializers.CharField()\n\n        class B(serializers.Serializer):\n            field = serializers.IntegerField()\n\n        class TestSerializer(A, B):\n            pass\n\n        fields = {\n            name: type(f) for name, f\n            in TestSerializer()._declared_fields.items()\n        }\n        assert fields == {\n            'field': serializers.CharField,\n        }\n\n    def test_field_ordering(self):\n        class Base(serializers.Serializer):\n            f1 = serializers.CharField()\n            f2 = serializers.CharField()\n\n        class A(Base):\n            f3 = serializers.IntegerField()\n\n        class B(serializers.Serializer):\n            f3 = serializers.CharField()\n            f4 = serializers.CharField()\n\n        class TestSerializer(A, B):\n            f2 = serializers.IntegerField()\n            f5 = serializers.CharField()\n\n        fields = {\n            name: type(f) for name, f\n            in TestSerializer()._declared_fields.items()\n        }\n\n        # `IntegerField`s should be the 'winners' in field name conflicts\n        # - `TestSerializer.f2` should override `Base.F2`\n        # - `A.f3` should override `B.f3`\n        assert fields == {\n            'f1': serializers.CharField,\n            'f2': serializers.IntegerField,\n            'f3': serializers.IntegerField,\n            'f4': serializers.CharField,\n            'f5': serializers.CharField,\n        }\n\n\nclass Test8301Regression:\n    def test_ReturnDict_merging(self):\n        # Serializer.data returns ReturnDict, this is essentially a test for that.\n\n        class TestSerializer(serializers.Serializer):\n            char = serializers.CharField()\n\n        s = TestSerializer(data={'char': 'x'})\n        assert s.is_valid()\n        assert s.data | {} == {'char': 'x'}\n        assert s.data | {'other': 'y'} == {'char': 'x', 'other': 'y'}\n        assert {} | s.data == {'char': 'x'}\n        assert {'other': 'y'} | s.data == {'char': 'x', 'other': 'y'}\n\n        assert (s.data | {}).__class__ == s.data.__class__\n        assert ({} | s.data).__class__ == s.data.__class__\n\n\nclass TestSetValueMethod:\n    # Serializer.set_value() modifies the first parameter in-place.\n\n    s = serializers.Serializer()\n\n    def test_no_keys(self):\n        ret = {'a': 1}\n        self.s.set_value(ret, [], {'b': 2})\n        assert ret == {'a': 1, 'b': 2}\n\n    def test_one_key(self):\n        ret = {'a': 1}\n        self.s.set_value(ret, ['x'], 2)\n        assert ret == {'a': 1, 'x': 2}\n\n    def test_nested_key(self):\n        ret = {'a': 1}\n        self.s.set_value(ret, ['x', 'y'], 2)\n        assert ret == {'a': 1, 'x': {'y': 2}}\n\n\nclass TestWarningManyToMany(TestCase):\n    def test_warning_many_to_many(self):\n        \"\"\"Tests that using a PrimaryKeyRelatedField for a ManyToMany field breaks with default=None.\"\"\"\n        class ManyToManySourceSerializer(serializers.ModelSerializer):\n            targets = serializers.PrimaryKeyRelatedField(\n                many=True,\n                queryset=ManyToManyTarget.objects.all(),\n                default=None\n            )\n\n            class Meta:\n                model = ManyToManySource\n                fields = '__all__'\n\n        # Instantiates serializer without 'value' field to force using the default=None for the ManyToMany relation\n        serializer = ManyToManySourceSerializer(data={\n            \"name\": \"Invalid Example\",\n        })\n\n        error_msg = \"The field 'targets' on serializer 'ManyToManySourceSerializer' is a ManyToMany field and cannot have a default value of None.\"\n\n        # Calls to get_fields() should raise a ValueError\n        with pytest.raises(ValueError) as exc_info:\n            serializer.get_fields()\n        assert str(exc_info.value) == error_msg\n\n        # Calls to is_valid() should behave the same\n        with pytest.raises(ValueError) as exc_info:\n            serializer.is_valid(raise_exception=True)\n        assert str(exc_info.value) == error_msg\n"
  },
  {
    "path": "tests/test_serializer_bulk_update.py",
    "content": "\"\"\"\nTests to cover bulk create and update using serializers.\n\"\"\"\nfrom django.test import TestCase\n\nfrom rest_framework import serializers\n\n\nclass BulkCreateSerializerTests(TestCase):\n    \"\"\"\n    Creating multiple instances using serializers.\n    \"\"\"\n\n    def setUp(self):\n        class BookSerializer(serializers.Serializer):\n            id = serializers.IntegerField()\n            title = serializers.CharField(max_length=100)\n            author = serializers.CharField(max_length=100)\n\n        self.BookSerializer = BookSerializer\n\n    def test_bulk_create_success(self):\n        \"\"\"\n        Correct bulk update serialization should return the input data.\n        \"\"\"\n\n        data = [\n            {\n                'id': 0,\n                'title': 'The electric kool-aid acid test',\n                'author': 'Tom Wolfe'\n            }, {\n                'id': 1,\n                'title': 'If this is a man',\n                'author': 'Primo Levi'\n            }, {\n                'id': 2,\n                'title': 'The wind-up bird chronicle',\n                'author': 'Haruki Murakami'\n            }\n        ]\n\n        serializer = self.BookSerializer(data=data, many=True)\n        assert serializer.is_valid() is True\n        assert serializer.validated_data == data\n        assert serializer.errors == []\n\n    def test_bulk_create_errors(self):\n        \"\"\"\n        Incorrect bulk create serialization should return errors.\n        \"\"\"\n\n        data = [\n            {\n                'id': 0,\n                'title': 'The electric kool-aid acid test',\n                'author': 'Tom Wolfe'\n            }, {\n                'id': 1,\n                'title': 'If this is a man',\n                'author': 'Primo Levi'\n            }, {\n                'id': 'foo',\n                'title': 'The wind-up bird chronicle',\n                'author': 'Haruki Murakami'\n            }\n        ]\n        expected_errors = [\n            {},\n            {},\n            {'id': ['A valid integer is required.']}\n        ]\n\n        serializer = self.BookSerializer(data=data, many=True)\n        assert serializer.is_valid() is False\n        assert serializer.errors == expected_errors\n        assert serializer.validated_data == []\n\n    def test_invalid_list_datatype(self):\n        \"\"\"\n        Data containing list of incorrect data type should return errors.\n        \"\"\"\n        data = ['foo', 'bar', 'baz']\n        serializer = self.BookSerializer(data=data, many=True)\n        assert serializer.is_valid() is False\n\n        message = 'Invalid data. Expected a dictionary, but got str.'\n        expected_errors = [\n            {'non_field_errors': [message]},\n            {'non_field_errors': [message]},\n            {'non_field_errors': [message]}\n        ]\n\n        assert serializer.errors == expected_errors\n\n    def test_invalid_single_datatype(self):\n        \"\"\"\n        Data containing a single incorrect data type should return errors.\n        \"\"\"\n        data = 123\n        serializer = self.BookSerializer(data=data, many=True)\n        assert serializer.is_valid() is False\n\n        expected_errors = {'non_field_errors': ['Expected a list of items but got type \"int\".']}\n\n        assert serializer.errors == expected_errors\n\n    def test_invalid_single_object(self):\n        \"\"\"\n        Data containing only a single object, instead of a list of objects\n        should return errors.\n        \"\"\"\n        data = {\n            'id': 0,\n            'title': 'The electric kool-aid acid test',\n            'author': 'Tom Wolfe'\n        }\n        serializer = self.BookSerializer(data=data, many=True)\n        assert serializer.is_valid() is False\n\n        expected_errors = {'non_field_errors': ['Expected a list of items but got type \"dict\".']}\n\n        assert serializer.errors == expected_errors\n"
  },
  {
    "path": "tests/test_serializer_lists.py",
    "content": "import pytest\nfrom django.http import QueryDict\nfrom django.utils.datastructures import MultiValueDict\n\nfrom rest_framework import serializers\nfrom rest_framework.exceptions import ErrorDetail\nfrom tests.models import (\n    CustomManagerModel, NullableOneToOneSource, OneToOneTarget\n)\n\n\nclass BasicObject:\n    \"\"\"\n    A mock object for testing serializer save behavior.\n    \"\"\"\n    def __init__(self, **kwargs):\n        self._data = kwargs\n        for key, value in kwargs.items():\n            setattr(self, key, value)\n\n    def __eq__(self, other):\n        if self._data.keys() != other._data.keys():\n            return False\n        for key in self._data:\n            if self._data[key] != other._data[key]:\n                return False\n        return True\n\n\nclass TestListSerializer:\n    \"\"\"\n    Tests for using a ListSerializer as a top-level serializer.\n    Note that this is in contrast to using ListSerializer as a field.\n    \"\"\"\n\n    def setup_method(self):\n        class IntegerListSerializer(serializers.ListSerializer):\n            child = serializers.IntegerField()\n        self.Serializer = IntegerListSerializer\n\n    def test_validate(self):\n        \"\"\"\n        Validating a list of items should return a list of validated items.\n        \"\"\"\n        input_data = [\"123\", \"456\"]\n        expected_output = [123, 456]\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == expected_output\n\n    def test_validate_html_input(self):\n        \"\"\"\n        HTML input should be able to mock list structures using [x] style ids.\n        \"\"\"\n        input_data = MultiValueDict({\"[0]\": [\"123\"], \"[1]\": [\"456\"]})\n        expected_output = [123, 456]\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == expected_output\n\n    def test_list_serializer_is_subscriptable(self):\n        assert serializers.ListSerializer is serializers.ListSerializer[\"foo\"]\n\n\nclass TestListSerializerContainingNestedSerializer:\n    \"\"\"\n    Tests for using a ListSerializer containing another serializer.\n    \"\"\"\n\n    def setup_method(self):\n        class TestSerializer(serializers.Serializer):\n            integer = serializers.IntegerField()\n            boolean = serializers.BooleanField()\n\n            def create(self, validated_data):\n                return BasicObject(**validated_data)\n\n        class ObjectListSerializer(serializers.ListSerializer):\n            child = TestSerializer()\n\n        self.Serializer = ObjectListSerializer\n\n    def test_validate(self):\n        \"\"\"\n        Validating a list of dictionaries should return a list of\n        validated dictionaries.\n        \"\"\"\n        input_data = [\n            {\"integer\": \"123\", \"boolean\": \"true\"},\n            {\"integer\": \"456\", \"boolean\": \"false\"}\n        ]\n        expected_output = [\n            {\"integer\": 123, \"boolean\": True},\n            {\"integer\": 456, \"boolean\": False}\n        ]\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == expected_output\n\n    def test_create(self):\n        \"\"\"\n        Creating from a list of dictionaries should return a list of objects.\n        \"\"\"\n        input_data = [\n            {\"integer\": \"123\", \"boolean\": \"true\"},\n            {\"integer\": \"456\", \"boolean\": \"false\"}\n        ]\n        expected_output = [\n            BasicObject(integer=123, boolean=True),\n            BasicObject(integer=456, boolean=False),\n        ]\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.save() == expected_output\n\n    def test_serialize(self):\n        \"\"\"\n        Serialization of a list of objects should return a list of dictionaries.\n        \"\"\"\n        input_objects = [\n            BasicObject(integer=123, boolean=True),\n            BasicObject(integer=456, boolean=False)\n        ]\n        expected_output = [\n            {\"integer\": 123, \"boolean\": True},\n            {\"integer\": 456, \"boolean\": False}\n        ]\n        serializer = self.Serializer(input_objects)\n        assert serializer.data == expected_output\n\n    def test_validate_html_input(self):\n        \"\"\"\n        HTML input should be able to mock list structures using [x]\n        style prefixes.\n        \"\"\"\n        input_data = MultiValueDict({\n            \"[0]integer\": [\"123\"],\n            \"[0]boolean\": [\"true\"],\n            \"[1]integer\": [\"456\"],\n            \"[1]boolean\": [\"false\"]\n        })\n        expected_output = [\n            {\"integer\": 123, \"boolean\": True},\n            {\"integer\": 456, \"boolean\": False}\n        ]\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == expected_output\n\n    def test_update_allow_custom_child_validation(self):\n        \"\"\"\n        Update a list of objects thanks custom run_child_validation implementation.\n        \"\"\"\n\n        class TestUpdateSerializer(serializers.Serializer):\n            integer = serializers.IntegerField()\n            boolean = serializers.BooleanField()\n\n            def update(self, instance, validated_data):\n                instance._data.update(validated_data)\n                return instance\n\n            def validate(self, data):\n                # self.instance is set to current BasicObject instance\n                assert isinstance(self.instance, BasicObject)\n                # self.initial_data is current dictionary\n                assert isinstance(self.initial_data, dict)\n                assert self.initial_data[\"pk\"] == self.instance.pk\n                return super().validate(data)\n\n        class ListUpdateSerializer(serializers.ListSerializer):\n            child = TestUpdateSerializer()\n\n            def run_child_validation(self, data):\n                # find related instance in self.instance list\n                child_instance = next(o for o in self.instance if o.pk == data[\"pk\"])\n                # set instance and initial_data for child serializer\n                self.child.instance = child_instance\n                self.child.initial_data = data\n                return super().run_child_validation(data)\n\n            def update(self, instance, validated_data):\n                return [\n                    self.child.update(instance, attrs)\n                    for instance, attrs in zip(self.instance, validated_data)\n                ]\n\n        instance = [\n            BasicObject(pk=1, integer=11, private_field=\"a\"),\n            BasicObject(pk=2, integer=22, private_field=\"b\"),\n        ]\n        input_data = [\n            {\"pk\": 1, \"integer\": \"123\", \"boolean\": \"true\"},\n            {\"pk\": 2, \"integer\": \"456\", \"boolean\": \"false\"},\n        ]\n        expected_output = [\n            BasicObject(pk=1, integer=123, boolean=True, private_field=\"a\"),\n            BasicObject(pk=2, integer=456, boolean=False, private_field=\"b\"),\n        ]\n        serializer = ListUpdateSerializer(instance, data=input_data)\n        assert serializer.is_valid()\n        updated_instances = serializer.save()\n        assert updated_instances == expected_output\n\n\nclass TestNestedListSerializer:\n    \"\"\"\n    Tests for using a ListSerializer as a field.\n    \"\"\"\n\n    def setup_method(self):\n        class TestSerializer(serializers.Serializer):\n            integers = serializers.ListSerializer(child=serializers.IntegerField())\n            booleans = serializers.ListSerializer(child=serializers.BooleanField())\n\n            def create(self, validated_data):\n                return BasicObject(**validated_data)\n\n        self.Serializer = TestSerializer\n\n    def test_validate(self):\n        \"\"\"\n        Validating a list of items should return a list of validated items.\n        \"\"\"\n        input_data = {\n            \"integers\": [\"123\", \"456\"],\n            \"booleans\": [\"true\", \"false\"]\n        }\n        expected_output = {\n            \"integers\": [123, 456],\n            \"booleans\": [True, False]\n        }\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == expected_output\n\n    def test_create(self):\n        \"\"\"\n        Creation with a list of items return an object with an attribute that\n        is a list of items.\n        \"\"\"\n        input_data = {\n            \"integers\": [\"123\", \"456\"],\n            \"booleans\": [\"true\", \"false\"]\n        }\n        expected_output = BasicObject(\n            integers=[123, 456],\n            booleans=[True, False]\n        )\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.save() == expected_output\n\n    def test_serialize(self):\n        \"\"\"\n        Serialization of a list of items should return a list of items.\n        \"\"\"\n        input_object = BasicObject(\n            integers=[123, 456],\n            booleans=[True, False]\n        )\n        expected_output = {\n            \"integers\": [123, 456],\n            \"booleans\": [True, False]\n        }\n        serializer = self.Serializer(input_object)\n        assert serializer.data == expected_output\n\n    def test_validate_html_input(self):\n        \"\"\"\n        HTML input should be able to mock list structures using [x]\n        style prefixes.\n        \"\"\"\n        input_data = MultiValueDict({\n            \"integers[0]\": [\"123\"],\n            \"integers[1]\": [\"456\"],\n            \"booleans[0]\": [\"true\"],\n            \"booleans[1]\": [\"false\"]\n        })\n        expected_output = {\n            \"integers\": [123, 456],\n            \"booleans\": [True, False]\n        }\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == expected_output\n\n\nclass TestNestedListSerializerAllowEmpty:\n    \"\"\"Tests the behavior of allow_empty=False when a ListSerializer is used as a field.\"\"\"\n\n    @pytest.mark.parametrize('partial', (False, True))\n    def test_allow_empty_true(self, partial):\n        \"\"\"\n        If allow_empty is True, empty lists should be allowed regardless of the value\n        of partial on the parent serializer.\n        \"\"\"\n        class ChildSerializer(serializers.Serializer):\n            id = serializers.IntegerField()\n\n        class ParentSerializer(serializers.Serializer):\n            ids = ChildSerializer(many=True, allow_empty=True)\n\n        serializer = ParentSerializer(data={'ids': []}, partial=partial)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'ids': [],\n        }\n\n    @pytest.mark.parametrize('partial', (False, True))\n    def test_allow_empty_false(self, partial):\n        \"\"\"\n        If allow_empty is False, empty lists should fail validation regardless of the value\n        of partial on the parent serializer.\n        \"\"\"\n        class ChildSerializer(serializers.Serializer):\n            id = serializers.IntegerField()\n\n        class ParentSerializer(serializers.Serializer):\n            ids = ChildSerializer(many=True, allow_empty=False)\n\n        serializer = ParentSerializer(data={'ids': []}, partial=partial)\n        assert not serializer.is_valid()\n        assert serializer.errors == {\n            'ids': {\n                'non_field_errors': [\n                    ErrorDetail(string='This list may not be empty.', code='empty')],\n            }\n        }\n\n\nclass TestNestedListOfListsSerializer:\n    def setup_method(self):\n        class TestSerializer(serializers.Serializer):\n            integers = serializers.ListSerializer(\n                child=serializers.ListSerializer(\n                    child=serializers.IntegerField()\n                )\n            )\n            booleans = serializers.ListSerializer(\n                child=serializers.ListSerializer(\n                    child=serializers.BooleanField()\n                )\n            )\n\n        self.Serializer = TestSerializer\n\n    def test_validate(self):\n        input_data = {\n            'integers': [['123', '456'], ['789', '0']],\n            'booleans': [['true', 'true'], ['false', 'true']]\n        }\n        expected_output = {\n            \"integers\": [[123, 456], [789, 0]],\n            \"booleans\": [[True, True], [False, True]]\n        }\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == expected_output\n\n    def test_validate_html_input(self):\n        \"\"\"\n        HTML input should be able to mock lists of lists using [x][y]\n        style prefixes.\n        \"\"\"\n        input_data = MultiValueDict({\n            \"integers[0][0]\": [\"123\"],\n            \"integers[0][1]\": [\"456\"],\n            \"integers[1][0]\": [\"789\"],\n            \"integers[1][1]\": [\"000\"],\n            \"booleans[0][0]\": [\"true\"],\n            \"booleans[0][1]\": [\"true\"],\n            \"booleans[1][0]\": [\"false\"],\n            \"booleans[1][1]\": [\"true\"]\n        })\n        expected_output = {\n            \"integers\": [[123, 456], [789, 0]],\n            \"booleans\": [[True, True], [False, True]]\n        }\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == expected_output\n\n\nclass TestListSerializerClass:\n    \"\"\"Tests for a custom list_serializer_class.\"\"\"\n    def test_list_serializer_class_validate(self):\n        class CustomListSerializer(serializers.ListSerializer):\n            def validate(self, attrs):\n                raise serializers.ValidationError('Non field error')\n\n        class TestSerializer(serializers.Serializer):\n            class Meta:\n                list_serializer_class = CustomListSerializer\n\n        serializer = TestSerializer(data=[], many=True)\n        assert not serializer.is_valid()\n        assert serializer.errors == {'non_field_errors': ['Non field error']}\n\n\nclass TestSerializerPartialUsage:\n    \"\"\"\n    When not submitting key for list fields or multiple choice, partial\n    serialization should result in an empty state (key not there), not\n    an empty list.\n\n    Regression test for Github issue #2761.\n    \"\"\"\n    def test_partial_listfield(self):\n        class ListSerializer(serializers.Serializer):\n            listdata = serializers.ListField()\n        serializer = ListSerializer(data=MultiValueDict(), partial=True)\n        result = serializer.to_internal_value(data={})\n        assert \"listdata\" not in result\n        assert serializer.is_valid()\n        assert serializer.validated_data == {}\n        assert serializer.errors == {}\n\n    def test_partial_multiplechoice(self):\n        class MultipleChoiceSerializer(serializers.Serializer):\n            multiplechoice = serializers.MultipleChoiceField(choices=[1, 2, 3])\n        serializer = MultipleChoiceSerializer(data=MultiValueDict(), partial=True)\n        result = serializer.to_internal_value(data={})\n        assert \"multiplechoice\" not in result\n        assert serializer.is_valid()\n        assert serializer.validated_data == {}\n        assert serializer.errors == {}\n\n    def test_allow_empty_true(self):\n        class ListSerializer(serializers.Serializer):\n            update_field = serializers.IntegerField()\n            store_field = serializers.IntegerField()\n\n        instance = [\n            {'update_field': 11, 'store_field': 12},\n            {'update_field': 21, 'store_field': 22},\n        ]\n\n        serializer = ListSerializer(instance, data=[], partial=True, many=True)\n        assert serializer.is_valid()\n        assert serializer.validated_data == []\n        assert serializer.errors == []\n\n    def test_update_allow_empty_true(self):\n        class ListSerializer(serializers.Serializer):\n            update_field = serializers.IntegerField()\n            store_field = serializers.IntegerField()\n\n        instance = [\n            {'update_field': 11, 'store_field': 12},\n            {'update_field': 21, 'store_field': 22},\n        ]\n        input_data = [{'update_field': 31}, {'update_field': 41}]\n        updated_data_list = [\n            {'update_field': 31, 'store_field': 12},\n            {'update_field': 41, 'store_field': 22},\n        ]\n\n        serializer = ListSerializer(\n            instance, data=input_data, partial=True, many=True)\n        assert serializer.is_valid()\n\n        for index, data in enumerate(serializer.validated_data):\n            for key, value in data.items():\n                assert value == updated_data_list[index][key]\n\n        assert serializer.errors == []\n\n    def test_allow_empty_false(self):\n        class ListSerializer(serializers.Serializer):\n            update_field = serializers.IntegerField()\n            store_field = serializers.IntegerField()\n\n        instance = [\n            {'update_field': 11, 'store_field': 12},\n            {'update_field': 21, 'store_field': 22},\n        ]\n\n        serializer = ListSerializer(\n            instance, data=[], allow_empty=False, partial=True, many=True)\n        assert not serializer.is_valid()\n        assert serializer.validated_data == []\n        assert len(serializer.errors) == 1\n        assert serializer.errors['non_field_errors'][0] == 'This list may not be empty.'\n\n    def test_update_allow_empty_false(self):\n        class ListSerializer(serializers.Serializer):\n            update_field = serializers.IntegerField()\n            store_field = serializers.IntegerField()\n\n        instance = [\n            {'update_field': 11, 'store_field': 12},\n            {'update_field': 21, 'store_field': 22},\n        ]\n        input_data = [{'update_field': 31}, {'update_field': 41}]\n        updated_data_list = [\n            {'update_field': 31, 'store_field': 12},\n            {'update_field': 41, 'store_field': 22},\n        ]\n\n        serializer = ListSerializer(\n            instance, data=input_data, allow_empty=False, partial=True, many=True)\n        assert serializer.is_valid()\n\n        for index, data in enumerate(serializer.validated_data):\n            for key, value in data.items():\n                assert value == updated_data_list[index][key]\n\n        assert serializer.errors == []\n\n    def test_as_field_allow_empty_true(self):\n        class ListSerializer(serializers.Serializer):\n            update_field = serializers.IntegerField()\n            store_field = serializers.IntegerField()\n\n        class Serializer(serializers.Serializer):\n            extra_field = serializers.IntegerField()\n            list_field = ListSerializer(many=True)\n\n        instance = {\n            'extra_field': 1,\n            'list_field': [\n                {'update_field': 11, 'store_field': 12},\n                {'update_field': 21, 'store_field': 22},\n            ]\n        }\n\n        serializer = Serializer(instance, data={}, partial=True)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {}\n        assert serializer.errors == {}\n\n    def test_update_as_field_allow_empty_true(self):\n        class ListSerializer(serializers.Serializer):\n            update_field = serializers.IntegerField()\n            store_field = serializers.IntegerField()\n\n        class Serializer(serializers.Serializer):\n            extra_field = serializers.IntegerField()\n            list_field = ListSerializer(many=True)\n\n        instance = {\n            'extra_field': 1,\n            'list_field': [\n                {'update_field': 11, 'store_field': 12},\n                {'update_field': 21, 'store_field': 22},\n            ]\n        }\n        input_data_1 = {'extra_field': 2}\n        input_data_2 = {\n            'list_field': [\n                {'update_field': 31},\n                {'update_field': 41},\n            ]\n        }\n\n        # data_1\n        serializer = Serializer(instance, data=input_data_1, partial=True)\n        assert serializer.is_valid()\n        assert len(serializer.validated_data) == 1\n        assert serializer.validated_data['extra_field'] == 2\n        assert serializer.errors == {}\n\n        # data_2\n        serializer = Serializer(instance, data=input_data_2, partial=True)\n        assert serializer.is_valid()\n\n        updated_data_list = [\n            {'update_field': 31, 'store_field': 12},\n            {'update_field': 41, 'store_field': 22},\n        ]\n        for index, data in enumerate(serializer.validated_data['list_field']):\n            for key, value in data.items():\n                assert value == updated_data_list[index][key]\n\n        assert serializer.errors == {}\n\n    def test_as_field_allow_empty_false(self):\n        class ListSerializer(serializers.Serializer):\n            update_field = serializers.IntegerField()\n            store_field = serializers.IntegerField()\n\n        class Serializer(serializers.Serializer):\n            extra_field = serializers.IntegerField()\n            list_field = ListSerializer(many=True, allow_empty=False)\n\n        instance = {\n            'extra_field': 1,\n            'list_field': [\n                {'update_field': 11, 'store_field': 12},\n                {'update_field': 21, 'store_field': 22},\n            ]\n        }\n\n        serializer = Serializer(instance, data={}, partial=True)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {}\n        assert serializer.errors == {}\n\n    def test_update_as_field_allow_empty_false(self):\n        class ListSerializer(serializers.Serializer):\n            update_field = serializers.IntegerField()\n            store_field = serializers.IntegerField()\n\n        class Serializer(serializers.Serializer):\n            extra_field = serializers.IntegerField()\n            list_field = ListSerializer(many=True, allow_empty=False)\n\n        instance = {\n            'extra_field': 1,\n            'list_field': [\n                {'update_field': 11, 'store_field': 12},\n                {'update_field': 21, 'store_field': 22},\n            ]\n        }\n        input_data_1 = {'extra_field': 2}\n        input_data_2 = {\n            'list_field': [\n                {'update_field': 31},\n                {'update_field': 41},\n            ]\n        }\n        updated_data_list = [\n            {'update_field': 31, 'store_field': 12},\n            {'update_field': 41, 'store_field': 22},\n        ]\n\n        # data_1\n        serializer = Serializer(instance, data=input_data_1, partial=True)\n        assert serializer.is_valid()\n        assert serializer.errors == {}\n\n        # data_2\n        serializer = Serializer(instance, data=input_data_2, partial=True)\n        assert serializer.is_valid()\n\n        for index, data in enumerate(serializer.validated_data['list_field']):\n            for key, value in data.items():\n                assert value == updated_data_list[index][key]\n\n        assert serializer.errors == {}\n\n\nclass TestEmptyListSerializer:\n    \"\"\"\n    Tests the behavior of ListSerializers when there is no data passed to it\n    \"\"\"\n\n    def setup_method(self):\n        class ExampleListSerializer(serializers.ListSerializer):\n            child = serializers.IntegerField()\n\n        self.Serializer = ExampleListSerializer\n\n    def test_nested_serializer_with_list_json(self):\n        # pass an empty array to the serializer\n        input_data = []\n\n        serializer = self.Serializer(data=input_data)\n\n        assert serializer.is_valid()\n        assert serializer.validated_data == []\n\n    def test_nested_serializer_with_list_multipart(self):\n        # pass an \"empty\" QueryDict to the serializer (should be the same as an empty array)\n        input_data = QueryDict('')\n        serializer = self.Serializer(data=input_data)\n\n        assert serializer.is_valid()\n        assert serializer.validated_data == []\n\n\nclass TestMaxMinLengthListSerializer:\n    \"\"\"\n    Tests the behavior of ListSerializers when max_length and min_length are used\n    \"\"\"\n\n    def setup_method(self):\n        class IntegerSerializer(serializers.Serializer):\n            some_int = serializers.IntegerField()\n\n        class MaxLengthSerializer(serializers.Serializer):\n            many_int = IntegerSerializer(many=True, max_length=5)\n\n        class MinLengthSerializer(serializers.Serializer):\n            many_int = IntegerSerializer(many=True, min_length=3)\n\n        class MaxMinLengthSerializer(serializers.Serializer):\n            many_int = IntegerSerializer(many=True, min_length=3, max_length=5)\n\n        self.MaxLengthSerializer = MaxLengthSerializer\n        self.MinLengthSerializer = MinLengthSerializer\n        self.MaxMinLengthSerializer = MaxMinLengthSerializer\n\n    def test_min_max_length_two_items(self):\n        input_data = {'many_int': [{'some_int': i} for i in range(2)]}\n\n        max_serializer = self.MaxLengthSerializer(data=input_data)\n        min_serializer = self.MinLengthSerializer(data=input_data)\n        max_min_serializer = self.MaxMinLengthSerializer(data=input_data)\n\n        assert max_serializer.is_valid()\n        assert max_serializer.validated_data == input_data\n\n        assert not min_serializer.is_valid()\n\n        assert not max_min_serializer.is_valid()\n\n    def test_min_max_length_four_items(self):\n        input_data = {'many_int': [{'some_int': i} for i in range(4)]}\n\n        max_serializer = self.MaxLengthSerializer(data=input_data)\n        min_serializer = self.MinLengthSerializer(data=input_data)\n        max_min_serializer = self.MaxMinLengthSerializer(data=input_data)\n\n        assert max_serializer.is_valid()\n        assert max_serializer.validated_data == input_data\n\n        assert min_serializer.is_valid()\n        assert min_serializer.validated_data == input_data\n\n        assert max_min_serializer.is_valid()\n        assert min_serializer.validated_data == input_data\n\n    def test_min_max_length_six_items(self):\n        input_data = {'many_int': [{'some_int': i} for i in range(6)]}\n\n        max_serializer = self.MaxLengthSerializer(data=input_data)\n        min_serializer = self.MinLengthSerializer(data=input_data)\n        max_min_serializer = self.MaxMinLengthSerializer(data=input_data)\n\n        assert not max_serializer.is_valid()\n\n        assert min_serializer.is_valid()\n        assert min_serializer.validated_data == input_data\n\n        assert not max_min_serializer.is_valid()\n\n\n@pytest.mark.django_db()\nclass TestToRepresentationManagerCheck:\n    \"\"\"\n    https://github.com/encode/django-rest-framework/issues/8726\n    \"\"\"\n\n    def setup_method(self):\n        class CustomManagerModelSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = CustomManagerModel\n                fields = '__all__'\n\n        class OneToOneTargetSerializer(serializers.ModelSerializer):\n            my_model = CustomManagerModelSerializer(many=True, source=\"custommanagermodel_set\")\n\n            class Meta:\n                model = OneToOneTarget\n                fields = '__all__'\n                depth = 3\n\n        class NullableOneToOneSourceSerializer(serializers.ModelSerializer):\n            target = OneToOneTargetSerializer()\n\n            class Meta:\n                model = NullableOneToOneSource\n                fields = '__all__'\n\n        self.serializer = NullableOneToOneSourceSerializer\n\n    def test(self):\n        o2o_target = OneToOneTarget.objects.create(name='OneToOneTarget')\n        NullableOneToOneSource.objects.create(\n            name='NullableOneToOneSource',\n            target=o2o_target\n        )\n        queryset = NullableOneToOneSource.objects.all()\n        serializer = self.serializer(queryset, many=True)\n        assert serializer.data\n"
  },
  {
    "path": "tests/test_serializer_nested.py",
    "content": "import pytest\nfrom django.db import models\nfrom django.http import QueryDict\nfrom django.test import TestCase\n\nfrom rest_framework import serializers\nfrom rest_framework.compat import postgres_fields\nfrom rest_framework.serializers import raise_errors_on_nested_writes\n\n\nclass TestNestedSerializer:\n    def setup_method(self):\n        class NestedSerializer(serializers.Serializer):\n            one = serializers.IntegerField(max_value=10)\n            two = serializers.IntegerField(max_value=10)\n\n        class TestSerializer(serializers.Serializer):\n            nested = NestedSerializer()\n\n        self.Serializer = TestSerializer\n\n    def test_nested_validate(self):\n        input_data = {\n            'nested': {\n                'one': '1',\n                'two': '2',\n            }\n        }\n        expected_data = {\n            'nested': {\n                'one': 1,\n                'two': 2,\n            }\n        }\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == expected_data\n\n    def test_nested_serialize_empty(self):\n        expected_data = {\n            'nested': {\n                'one': None,\n                'two': None\n            }\n        }\n        serializer = self.Serializer()\n        assert serializer.data == expected_data\n\n    def test_nested_serialize_no_data(self):\n        data = None\n        serializer = self.Serializer(data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {'non_field_errors': ['No data provided']}\n\n\nclass TestNotRequiredNestedSerializer:\n    def setup_method(self):\n        class NestedSerializer(serializers.Serializer):\n            one = serializers.IntegerField(max_value=10)\n\n        class TestSerializer(serializers.Serializer):\n            nested = NestedSerializer(required=False)\n\n        self.Serializer = TestSerializer\n\n    def test_json_validate(self):\n        input_data = {}\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n\n        input_data = {'nested': {'one': '1'}}\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n\n    def test_multipart_validate(self):\n        input_data = QueryDict('')\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n\n        input_data = QueryDict('nested[one]=1')\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n\n\nclass TestNestedSerializerWithMany:\n    def setup_method(self):\n        class NestedSerializer(serializers.Serializer):\n            example = serializers.IntegerField(max_value=10)\n\n        class TestSerializer(serializers.Serializer):\n            allow_null = NestedSerializer(many=True, allow_null=True)\n            not_allow_null = NestedSerializer(many=True)\n            allow_empty = NestedSerializer(many=True, allow_empty=True)\n            not_allow_empty = NestedSerializer(many=True, allow_empty=False)\n\n        self.Serializer = TestSerializer\n\n    def test_null_allowed_if_allow_null_is_set(self):\n        input_data = {\n            'allow_null': None,\n            'not_allow_null': [{'example': '2'}, {'example': '3'}],\n            'allow_empty': [{'example': '2'}],\n            'not_allow_empty': [{'example': '2'}],\n        }\n        expected_data = {\n            'allow_null': None,\n            'not_allow_null': [{'example': 2}, {'example': 3}],\n            'allow_empty': [{'example': 2}],\n            'not_allow_empty': [{'example': 2}],\n        }\n        serializer = self.Serializer(data=input_data)\n\n        assert serializer.is_valid(), serializer.errors\n        assert serializer.validated_data == expected_data\n\n    def test_null_is_not_allowed_if_allow_null_is_not_set(self):\n        input_data = {\n            'allow_null': None,\n            'not_allow_null': None,\n            'allow_empty': [{'example': '2'}],\n            'not_allow_empty': [{'example': '2'}],\n        }\n        serializer = self.Serializer(data=input_data)\n\n        assert not serializer.is_valid()\n\n        expected_errors = {'not_allow_null': [serializer.error_messages['null']]}\n        assert serializer.errors == expected_errors\n\n    def test_run_the_field_validation_even_if_the_field_is_null(self):\n        class TestSerializer(self.Serializer):\n            validation_was_run = False\n\n            def validate_allow_null(self, value):\n                TestSerializer.validation_was_run = True\n                return value\n\n        input_data = {\n            'allow_null': None,\n            'not_allow_null': [{'example': 2}],\n            'allow_empty': [{'example': 2}],\n            'not_allow_empty': [{'example': 2}],\n        }\n        serializer = TestSerializer(data=input_data)\n\n        assert serializer.is_valid()\n        assert serializer.validated_data == input_data\n        assert TestSerializer.validation_was_run\n\n    def test_empty_allowed_if_allow_empty_is_set(self):\n        input_data = {\n            'allow_null': [{'example': '2'}],\n            'not_allow_null': [{'example': '2'}],\n            'allow_empty': [],\n            'not_allow_empty': [{'example': '2'}],\n        }\n        expected_data = {\n            'allow_null': [{'example': 2}],\n            'not_allow_null': [{'example': 2}],\n            'allow_empty': [],\n            'not_allow_empty': [{'example': 2}],\n        }\n        serializer = self.Serializer(data=input_data)\n\n        assert serializer.is_valid(), serializer.errors\n        assert serializer.validated_data == expected_data\n\n    def test_empty_not_allowed_if_allow_empty_is_set_to_false(self):\n        input_data = {\n            'allow_null': [{'example': '2'}],\n            'not_allow_null': [{'example': '2'}],\n            'allow_empty': [],\n            'not_allow_empty': [],\n        }\n        serializer = self.Serializer(data=input_data)\n\n        assert not serializer.is_valid()\n\n        expected_errors = {'not_allow_empty': {'non_field_errors': [serializers.ListSerializer.default_error_messages['empty']]}}\n        assert serializer.errors == expected_errors\n\n\nclass TestNestedSerializerWithList:\n    def setup_method(self):\n        class NestedSerializer(serializers.Serializer):\n            example = serializers.MultipleChoiceField(choices=[1, 2, 3])\n\n        class TestSerializer(serializers.Serializer):\n            nested = NestedSerializer()\n\n        self.Serializer = TestSerializer\n\n    def test_nested_serializer_with_list_json(self):\n        input_data = {\n            'nested': {\n                'example': [1, 2],\n            }\n        }\n        serializer = self.Serializer(data=input_data)\n\n        assert serializer.is_valid()\n        assert serializer.validated_data['nested']['example'] == [1, 2]\n\n    def test_nested_serializer_with_list_multipart(self):\n        input_data = QueryDict('nested.example=1&nested.example=2')\n        serializer = self.Serializer(data=input_data)\n\n        assert serializer.is_valid()\n        assert serializer.validated_data['nested']['example'] == [1, 2]\n\n\nclass TestNotRequiredNestedSerializerWithMany:\n    def setup_method(self):\n        class NestedSerializer(serializers.Serializer):\n            one = serializers.IntegerField(max_value=10)\n\n        class TestSerializer(serializers.Serializer):\n            nested = NestedSerializer(required=False, many=True)\n\n        self.Serializer = TestSerializer\n\n    def test_json_validate(self):\n        input_data = {}\n        serializer = self.Serializer(data=input_data)\n\n        # request is empty, therefore 'nested' should not be in serializer.data\n        assert serializer.is_valid()\n        assert 'nested' not in serializer.validated_data\n\n        input_data = {'nested': [{'one': '1'}, {'one': 2}]}\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert 'nested' in serializer.validated_data\n\n    def test_multipart_validate(self):\n        # leave querydict empty\n        input_data = QueryDict('')\n        serializer = self.Serializer(data=input_data)\n\n        # the querydict is empty, therefore 'nested' should not be in serializer.data\n        assert serializer.is_valid()\n        assert 'nested' not in serializer.validated_data\n\n        input_data = QueryDict('nested[0]one=1&nested[1]one=2')\n\n        serializer = self.Serializer(data=input_data)\n        assert serializer.is_valid()\n        assert 'nested' in serializer.validated_data\n\n\nclass NestedWriteProfile(models.Model):\n    address = models.CharField(max_length=100)\n\n\nclass NestedWritePerson(models.Model):\n    profile = models.ForeignKey(NestedWriteProfile, on_delete=models.CASCADE)\n\n\nclass TestNestedWriteErrors(TestCase):\n    # tests for rests_framework.serializers.raise_errors_on_nested_writes\n    def test_nested_serializer_error(self):\n        class ProfileSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = NestedWriteProfile\n                fields = ['address']\n\n        class NestedProfileSerializer(serializers.ModelSerializer):\n            profile = ProfileSerializer()\n\n            class Meta:\n                model = NestedWritePerson\n                fields = ['profile']\n\n        serializer = NestedProfileSerializer(data={'profile': {'address': '52 festive road'}})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'profile': {'address': '52 festive road'}}\n        with pytest.raises(AssertionError) as exc_info:\n            serializer.save()\n\n        assert str(exc_info.value) == (\n            'The `.create()` method does not support writable nested fields by '\n            'default.\\nWrite an explicit `.create()` method for serializer '\n            '`tests.test_serializer_nested.NestedProfileSerializer`, or set '\n            '`read_only=True` on nested serializer fields.'\n        )\n\n    def test_dotted_source_field_error(self):\n        class DottedAddressSerializer(serializers.ModelSerializer):\n            address = serializers.CharField(source='profile.address')\n\n            class Meta:\n                model = NestedWritePerson\n                fields = ['address']\n\n        serializer = DottedAddressSerializer(data={'address': '52 festive road'})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'profile': {'address': '52 festive road'}}\n        with pytest.raises(AssertionError) as exc_info:\n            serializer.save()\n\n        assert str(exc_info.value) == (\n            'The `.create()` method does not support writable dotted-source '\n            'fields by default.\\nWrite an explicit `.create()` method for '\n            'serializer `tests.test_serializer_nested.DottedAddressSerializer`, '\n            'or set `read_only=True` on dotted-source serializer fields.'\n        )\n\n\nif postgres_fields:\n    class NonRelationalPersonModel(models.Model):\n        \"\"\"Model declaring a postgres JSONField\"\"\"\n        data = postgres_fields.JSONField()\n\n        class Meta:\n            required_db_features = {'supports_json_field'}\n\n\n@pytest.mark.skipif(not postgres_fields, reason='psycopg is not installed')\nclass TestNestedNonRelationalFieldWrite:\n    \"\"\"\n    Test that raise_errors_on_nested_writes does not raise `AssertionError` when the\n    model field is not a relation.\n    \"\"\"\n\n    def test_nested_serializer_create_and_update(self):\n\n        class NonRelationalPersonDataSerializer(serializers.Serializer):\n            occupation = serializers.CharField()\n\n        class NonRelationalPersonSerializer(serializers.ModelSerializer):\n            data = NonRelationalPersonDataSerializer()\n\n            class Meta:\n                model = NonRelationalPersonModel\n                fields = ['data']\n\n        serializer = NonRelationalPersonSerializer(data={'data': {'occupation': 'developer'}})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'data': {'occupation': 'developer'}}\n        raise_errors_on_nested_writes('create', serializer, serializer.validated_data)\n        raise_errors_on_nested_writes('update', serializer, serializer.validated_data)\n\n    def test_dotted_source_field_create_and_update(self):\n\n        class DottedNonRelationalPersonSerializer(serializers.ModelSerializer):\n            occupation = serializers.CharField(source='data.occupation')\n\n            class Meta:\n                model = NonRelationalPersonModel\n                fields = ['occupation']\n\n        serializer = DottedNonRelationalPersonSerializer(data={'occupation': 'developer'})\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'data': {'occupation': 'developer'}}\n        raise_errors_on_nested_writes('create', serializer, serializer.validated_data)\n        raise_errors_on_nested_writes('update', serializer, serializer.validated_data)\n"
  },
  {
    "path": "tests/test_settings.py",
    "content": "from django.test import TestCase, override_settings\n\nfrom rest_framework.settings import APISettings, api_settings\n\n\nclass TestSettings(TestCase):\n    def test_import_error_message_maintained(self):\n        \"\"\"\n        Make sure import errors are captured and raised sensibly.\n        \"\"\"\n        settings = APISettings({\n            'DEFAULT_RENDERER_CLASSES': [\n                'tests.invalid_module.InvalidClassName'\n            ]\n        })\n        with self.assertRaises(ImportError):\n            settings.DEFAULT_RENDERER_CLASSES\n\n    def test_warning_raised_on_removed_setting(self):\n        \"\"\"\n        Make sure user is alerted with an error when a removed setting\n        is set.\n        \"\"\"\n        with self.assertRaises(RuntimeError):\n            APISettings({\n                'MAX_PAGINATE_BY': 100\n            })\n\n    def test_compatibility_with_override_settings(self):\n        \"\"\"\n        Ref #5658 & #2466: Documented usage of api_settings\n        is bound at import time:\n\n            from rest_framework.settings import api_settings\n\n        setting_changed signal hook must ensure bound instance\n        is refreshed.\n        \"\"\"\n        assert api_settings.PAGE_SIZE is None, \"Checking a known default should be None\"\n\n        with override_settings(REST_FRAMEWORK={'PAGE_SIZE': 10}):\n            assert api_settings.PAGE_SIZE == 10, \"Setting should have been updated\"\n\n        assert api_settings.PAGE_SIZE is None, \"Setting should have been restored\"\n\n    def test_pagination_settings(self):\n        \"\"\"\n        Integration tests for pagination system check.\n        \"\"\"\n        from rest_framework.checks import pagination_system_check\n\n        def get_pagination_error(error_id: str):\n            errors = pagination_system_check(app_configs=None)\n            return next((error for error in errors if error.id == error_id), None)\n\n        self.assertIsNone(api_settings.PAGE_SIZE)\n        self.assertIsNone(api_settings.DEFAULT_PAGINATION_CLASS)\n\n        pagination_error = get_pagination_error('rest_framework.W001')\n        self.assertIsNone(pagination_error)\n\n        with override_settings(REST_FRAMEWORK={'PAGE_SIZE': 10}):\n            pagination_error = get_pagination_error('rest_framework.W001')\n            self.assertIsNotNone(pagination_error)\n\n        default_pagination_class = 'rest_framework.pagination.PageNumberPagination'\n        with override_settings(REST_FRAMEWORK={'PAGE_SIZE': 10, 'DEFAULT_PAGINATION_CLASS': default_pagination_class}):\n            pagination_error = get_pagination_error('rest_framework.W001')\n            self.assertIsNone(pagination_error)\n\n\nclass TestSettingTypes(TestCase):\n    def test_settings_consistently_coerced_to_list(self):\n        settings = APISettings({\n            'DEFAULT_THROTTLE_CLASSES': ('rest_framework.throttling.BaseThrottle',)\n        })\n        self.assertTrue(isinstance(settings.DEFAULT_THROTTLE_CLASSES, list))\n\n        settings = APISettings({\n            'DEFAULT_THROTTLE_CLASSES': ()\n        })\n        self.assertTrue(isinstance(settings.DEFAULT_THROTTLE_CLASSES, list))\n"
  },
  {
    "path": "tests/test_status.py",
    "content": "from django.test import TestCase\n\nfrom rest_framework.status import (\n    is_client_error, is_informational, is_redirect, is_server_error, is_success\n)\n\n\nclass TestStatus(TestCase):\n    def test_status_categories(self):\n        assert not is_informational(99)\n        assert is_informational(100)\n        assert is_informational(199)\n        assert not is_informational(200)\n\n        assert not is_success(199)\n        assert is_success(200)\n        assert is_success(299)\n        assert not is_success(300)\n\n        assert not is_redirect(299)\n        assert is_redirect(300)\n        assert is_redirect(399)\n        assert not is_redirect(400)\n\n        assert not is_client_error(399)\n        assert is_client_error(400)\n        assert is_client_error(499)\n        assert not is_client_error(500)\n\n        assert not is_server_error(499)\n        assert is_server_error(500)\n        assert is_server_error(599)\n        assert not is_server_error(600)\n"
  },
  {
    "path": "tests/test_templates.py",
    "content": "import re\n\nfrom django.shortcuts import render\n\n\ndef test_base_template_with_context():\n    context = {'request': True, 'csrf_token': 'TOKEN'}\n    result = render({}, 'rest_framework/base.html', context=context)\n    assert re.search(r'\"csrfToken\": \"TOKEN\"', result.content.decode())\n\n\ndef test_base_template_with_no_context():\n    # base.html should be renderable with no context,\n    # so it can be easily extended.\n    result = render({}, 'rest_framework/base.html')\n    # note that this response will not include a valid CSRF token\n    assert re.search(r'\"csrfToken\": \"\"', result.content.decode())\n"
  },
  {
    "path": "tests/test_templatetags.py",
    "content": "from django.template import Context, Template\nfrom django.test import TestCase, override_settings\nfrom django.utils.html import urlize\n\nfrom rest_framework.relations import Hyperlink\nfrom rest_framework.templatetags import rest_framework\nfrom rest_framework.templatetags.rest_framework import (\n    add_nested_class, add_query_param, as_string, format_value,\n    get_pagination_html\n)\nfrom rest_framework.test import APIRequestFactory\n\nfactory = APIRequestFactory()\n\n\ndef format_html(html):\n    \"\"\"\n    Helper function that formats HTML in order for easier comparison\n    :param html: raw HTML text to be formatted\n    :return: Cleaned HTML with no newlines or spaces\n    \"\"\"\n    return html.replace('\\n', '').replace(' ', '')\n\n\nclass TemplateTagTests(TestCase):\n\n    def test_add_query_param_with_non_latin_character(self):\n        # Ensure we don't double-escape non-latin characters\n        # that are present in the querystring.\n        # See #1314.\n        request = factory.get(\"/\", {'q': '查询'})\n        json_url = add_query_param(request, \"format\", \"json\")\n        self.assertIn(\"q=%E6%9F%A5%E8%AF%A2\", json_url)\n        self.assertIn(\"format=json\", json_url)\n\n    def test_format_value_boolean_or_none(self):\n        \"\"\"\n        Tests format_value with booleans and None\n        \"\"\"\n        self.assertEqual(format_value(True), '<code>true</code>')\n        self.assertEqual(format_value(False), '<code>false</code>')\n        self.assertEqual(format_value(None), '<code>null</code>')\n\n    def test_format_value_hyperlink(self):\n        \"\"\"\n        Tests format_value with a URL\n        \"\"\"\n        url = 'http://url.com'\n        name = 'name_of_url'\n        hyperlink = Hyperlink(url, name)\n        self.assertEqual(format_value(hyperlink), '<a href=%s>%s</a>' % (url, name))\n\n    def test_format_value_list(self):\n        \"\"\"\n        Tests format_value with a list of strings\n        \"\"\"\n        list_items = ['item1', 'item2', 'item3']\n        self.assertEqual(format_value(list_items), '\\n item1, item2, item3\\n')\n        self.assertEqual(format_value([]), '\\n\\n')\n\n    def test_format_value_dict(self):\n        \"\"\"\n        Tests format_value with a dict\n        \"\"\"\n        test_dict = {'a': 'b'}\n        expected_dict_format = \"\"\"\n        <table class=\"table table-striped\">\n            <tbody>\n                <tr>\n                    <th>a</th>\n                    <td>b</td>\n                </tr>\n            </tbody>\n        </table>\"\"\"\n        self.assertEqual(\n            format_html(format_value(test_dict)),\n            format_html(expected_dict_format)\n        )\n\n    def test_format_value_table(self):\n        \"\"\"\n        Tests format_value with a list of lists/dicts\n        \"\"\"\n        list_of_lists = [['list1'], ['list2'], ['list3']]\n        expected_list_format = \"\"\"\n        <tableclass=\"tabletable-striped\">\n            <tbody>\n               <tr>\n                  <th>0</th>\n                  <td>list1</td>\n               </tr>\n               <tr>\n                  <th>1</th>\n                  <td>list2</td>\n               </tr>\n               <tr>\n                  <th>2</th>\n                  <td>list3</td>\n               </tr>\n            </tbody>\n            </table>\"\"\"\n        self.assertEqual(\n            format_html(format_value(list_of_lists)),\n            format_html(expected_list_format)\n        )\n\n        expected_dict_format = \"\"\"\n        <tableclass=\"tabletable-striped\">\n            <tbody>\n                <tr>\n                    <th>0</th>\n                    <td>\n                        <tableclass=\"tabletable-striped\">\n                            <tbody>\n                                <tr>\n                                    <th>item1</th>\n                                    <td>value1</td>\n                                </tr>\n                            </tbody>\n                        </table>\n                    </td>\n                </tr>\n                <tr>\n                    <th>1</th>\n                    <td>\n                        <tableclass=\"tabletable-striped\">\n                            <tbody>\n                                <tr>\n                                    <th>item2</th>\n                                    <td>value2</td>\n                                </tr>\n                            </tbody>\n                        </table>\n                    </td>\n                </tr>\n                <tr>\n                    <th>2</th>\n                    <td>\n                        <tableclass=\"tabletable-striped\">\n                            <tbody>\n                                <tr>\n                                    <th>item3</th>\n                                    <td>value3</td>\n                                </tr>\n                            </tbody>\n                        </table>\n                    </td>\n                </tr>\n            </tbody>\n        </table>\"\"\"\n\n        list_of_dicts = [{'item1': 'value1'}, {'item2': 'value2'}, {'item3': 'value3'}]\n        self.assertEqual(\n            format_html(format_value(list_of_dicts)),\n            format_html(expected_dict_format)\n        )\n\n    def test_format_value_simple_string(self):\n        \"\"\"\n        Tests format_value with a simple string\n        \"\"\"\n        simple_string = 'this is an example of a string'\n        self.assertEqual(format_value(simple_string), simple_string)\n\n    def test_format_value_string_hyperlink(self):\n        \"\"\"\n        Tests format_value with a url\n        \"\"\"\n        url = 'http://www.example.com'\n        self.assertEqual(format_value(url), '<a href=\"http://www.example.com\">http://www.example.com</a>')\n\n    def test_format_value_string_email(self):\n        \"\"\"\n        Tests format_value with an email address\n        \"\"\"\n        email = 'something@somewhere.com'\n        self.assertEqual(format_value(email), '<a href=\"mailto:something@somewhere.com\">something@somewhere.com</a>')\n\n    def test_format_value_string_newlines(self):\n        \"\"\"\n        Tests format_value with a string with newline characters\n        :return:\n        \"\"\"\n        text = 'Dear user, \\n this is a message \\n from,\\nsomeone'\n        self.assertEqual(format_value(text), '<pre>Dear user, \\n this is a message \\n from,\\nsomeone</pre>')\n\n    def test_format_value_object(self):\n        \"\"\"\n        Tests that format_value with a object returns the object's __str__ method\n        \"\"\"\n        obj = object()\n        self.assertEqual(format_value(obj), obj.__str__())\n\n    def test_add_nested_class(self):\n        \"\"\"\n        Tests that add_nested_class returns the proper class\n        \"\"\"\n        positive_cases = [\n            [['item']],\n            [{'item1': 'value1'}],\n            {'item1': 'value1'}\n        ]\n\n        negative_cases = [\n            ['list'],\n            '',\n            None,\n            True,\n            False\n        ]\n\n        for case in positive_cases:\n            self.assertEqual(add_nested_class(case), 'class=nested')\n\n        for case in negative_cases:\n            self.assertEqual(add_nested_class(case), '')\n\n    def test_as_string_with_none(self):\n        result = as_string(None)\n        assert result == ''\n\n    def test_get_pagination_html(self):\n        class MockPager:\n            def __init__(self):\n                self.called = False\n\n            def to_html(self):\n                self.called = True\n\n        pager = MockPager()\n        get_pagination_html(pager)\n        assert pager.called is True\n\n\nclass Issue1386Tests(TestCase):\n    \"\"\"\n    Covers #1386\n    \"\"\"\n\n    @override_settings(URLIZE_ASSUME_HTTPS=True)\n    def test_issue_1386(self):\n        \"\"\"\n        Test function urlize with different args\n        \"\"\"\n        correct_urls = [\n            \"asdf.com\",\n            \"asdf.net\",\n            \"www.as_df.org\",\n            \"as.d8f.ghj8.gov\",\n        ]\n        for i in correct_urls:\n            res = urlize(i)\n            self.assertNotEqual(res, i)\n            self.assertIn(i, res)\n\n        incorrect_urls = [\n            \"mailto://asdf@fdf.com\",\n            \"asdf.netnet\",\n        ]\n        for i in incorrect_urls:\n            res = urlize(i)\n            self.assertEqual(i, res)\n\n        # example from issue #1386, this shouldn't raise an exception\n        urlize(\"asdf:[/p]zxcv.com\")\n\n    def test_smart_urlquote_wrapper_handles_value_error(self):\n        def mock_smart_urlquote(url):\n            raise ValueError\n\n        old = rest_framework.smart_urlquote\n        rest_framework.smart_urlquote = mock_smart_urlquote\n        assert rest_framework.smart_urlquote_wrapper('test') is None\n        rest_framework.smart_urlquote = old\n\n\nclass URLizerTests(TestCase):\n    \"\"\"\n    Test if JSON URLs are transformed into links well\n    \"\"\"\n    def _urlize_dict_check(self, data):\n        \"\"\"\n        For all items in dict test assert that the value is urlized key\n        \"\"\"\n        for original, urlized in data.items():\n            assert urlize(original, nofollow=False) == urlized\n\n    def test_json_with_url(self):\n        \"\"\"\n        Test if JSON URLs are transformed into links well\n        \"\"\"\n        data = {}\n        data['\"url\": \"http://api/users/1/\", '] = \\\n            '\"url\": \"<a href=\"http://api/users/1/\">http://api/users/1/</a>\", '\n        data['\"foo_set\": [\\n    \"http://api/foos/1/\"\\n], '] = \\\n            '\"foo_set\": [\\n    \"<a href=\"http://api/foos/1/\">http://api/foos/1/</a>\"\\n], '\n        self._urlize_dict_check(data)\n\n    def test_template_render_with_autoescape(self):\n        \"\"\"\n        Test that HTML is correctly escaped in Browsable API views.\n        \"\"\"\n        template = Template(\"{% load rest_framework %}{{ content|urlize }}\")\n        rendered = template.render(Context({'content': '<script>alert()</script> http://example.com'}))\n        assert rendered == '&lt;script&gt;alert()&lt;/script&gt;' \\\n                           ' <a href=\"http://example.com\" rel=\"nofollow\">http://example.com</a>'\n\n    def test_template_render_with_noautoescape(self):\n        \"\"\"\n        Test if the autoescape value is getting passed to urlize filter.\n        \"\"\"\n        template = Template(\"{% load rest_framework %}\"\n                            \"{% autoescape off %}{{ content|urlize }}\"\n                            \"{% endautoescape %}\")\n        rendered = template.render(Context({'content': '<b> \"http://example.com\" </b>'}))\n        assert rendered == '<b> \"<a href=\"http://example.com\" rel=\"nofollow\">http://example.com</a>\" </b>'\n"
  },
  {
    "path": "tests/test_testing.py",
    "content": "import itertools\nfrom io import BytesIO\nfrom unittest.mock import patch\n\nfrom django.contrib.auth.models import User\nfrom django.http import HttpResponseRedirect\nfrom django.shortcuts import redirect\nfrom django.test import TestCase, override_settings\nfrom django.urls import path\n\nfrom rest_framework import fields, parsers, renderers, serializers, status\nfrom rest_framework.authtoken.models import Token\nfrom rest_framework.decorators import (\n    api_view, parser_classes, renderer_classes\n)\nfrom rest_framework.response import Response\nfrom rest_framework.test import (\n    APIClient, APIRequestFactory, URLPatternsTestCase, force_authenticate\n)\nfrom rest_framework.views import APIView\n\n\n@api_view(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'])\ndef view(request):\n    data = {'auth': request.META.get('HTTP_AUTHORIZATION', b'')}\n    if request.user:\n        data['user'] = request.user.username\n    if request.auth:\n        data['token'] = request.auth.key\n    return Response(data)\n\n\n@api_view(['GET', 'POST'])\ndef session_view(request):\n    active_session = request.session.get('active_session', False)\n    request.session['active_session'] = True\n    return Response({\n        'active_session': active_session\n    })\n\n\n@api_view(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'])\ndef redirect_view(request):\n    return redirect('/view/')\n\n\n@api_view(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'])\ndef redirect_307_308_view(request, code):\n    return HttpResponseRedirect('/view/', status=code)\n\n\nclass BasicSerializer(serializers.Serializer):\n    flag = fields.BooleanField(default=lambda: True)\n\n\n@api_view(['POST'])\n@parser_classes((parsers.JSONParser,))\ndef post_json_view(request):\n    return Response(request.data)\n\n\n@api_view(['DELETE'])\n@renderer_classes((renderers.JSONRenderer, ))\ndef delete_json_view(request):\n    return Response(status=status.HTTP_204_NO_CONTENT)\n\n\n@api_view(['POST'])\ndef post_view(request):\n    serializer = BasicSerializer(data=request.data)\n    serializer.is_valid(raise_exception=True)\n    return Response(serializer.validated_data)\n\n\nurlpatterns = [\n    path('view/', view),\n    path('session-view/', session_view),\n    path('redirect-view/', redirect_view),\n    path('redirect-view/<int:code>/', redirect_307_308_view),\n    path('post-json-view/', post_json_view),\n    path('delete-json-view/', delete_json_view),\n    path('post-view/', post_view),\n]\n\n\n@override_settings(ROOT_URLCONF='tests.test_testing')\nclass TestAPITestClient(TestCase):\n    def setUp(self):\n        self.client = APIClient()\n\n    def test_credentials(self):\n        \"\"\"\n        Setting `.credentials()` adds the required headers to each request.\n        \"\"\"\n        self.client.credentials(HTTP_AUTHORIZATION='example')\n        for _ in range(0, 3):\n            response = self.client.get('/view/')\n            assert response.data['auth'] == 'example'\n\n    def test_force_authenticate_with_user(self):\n        \"\"\"\n        Setting `.force_authenticate()` with a user forcibly authenticates each\n        request with that user.\n        \"\"\"\n        user = User.objects.create_user('example', 'example@example.com')\n\n        self.client.force_authenticate(user=user)\n        response = self.client.get('/view/')\n\n        assert response.data['user'] == 'example'\n        assert 'token' not in response.data\n\n    def test_force_authenticate_with_token(self):\n        \"\"\"\n        Setting `.force_authenticate()` with a token forcibly authenticates each\n        request with that token.\n        \"\"\"\n        user = User.objects.create_user('example', 'example@example.com')\n        token = Token.objects.create(key='xyz', user=user)\n\n        self.client.force_authenticate(token=token)\n        response = self.client.get('/view/')\n\n        assert response.data['token'] == 'xyz'\n        assert 'user' not in response.data\n\n    def test_force_authenticate_with_user_and_token(self):\n        \"\"\"\n        Setting `.force_authenticate()` with a user and token forcibly\n        authenticates each request with that user and token.\n        \"\"\"\n        user = User.objects.create_user('example', 'example@example.com')\n        token = Token.objects.create(key='xyz', user=user)\n\n        self.client.force_authenticate(user=user, token=token)\n        response = self.client.get('/view/')\n\n        assert response.data['user'] == 'example'\n        assert response.data['token'] == 'xyz'\n\n    def test_force_authenticate_with_sessions(self):\n        \"\"\"\n        Setting `.force_authenticate()` forcibly authenticates each request.\n        \"\"\"\n        user = User.objects.create_user('example', 'example@example.com')\n        self.client.force_authenticate(user)\n\n        # First request does not yet have an active session\n        response = self.client.get('/session-view/')\n        assert response.data['active_session'] is False\n\n        # Subsequent requests have an active session\n        response = self.client.get('/session-view/')\n        assert response.data['active_session'] is True\n\n        # Force authenticating with `None` user and token should also logout\n        # the user session.\n        self.client.force_authenticate(user=None, token=None)\n        response = self.client.get('/session-view/')\n        assert response.data['active_session'] is False\n\n    def test_csrf_exempt_by_default(self):\n        \"\"\"\n        By default, the test client is CSRF exempt.\n        \"\"\"\n        User.objects.create_user('example', 'example@example.com', 'password')\n        self.client.login(username='example', password='password')\n        response = self.client.post('/view/')\n        assert response.status_code == 200\n\n    def test_explicitly_enforce_csrf_checks(self):\n        \"\"\"\n        The test client can enforce CSRF checks.\n        \"\"\"\n        client = APIClient(enforce_csrf_checks=True)\n        User.objects.create_user('example', 'example@example.com', 'password')\n        client.login(username='example', password='password')\n        response = client.post('/view/')\n        expected = {'detail': 'CSRF Failed: CSRF cookie not set.'}\n        assert response.status_code == 403\n        assert response.data == expected\n\n    def test_can_logout(self):\n        \"\"\"\n        `logout()` resets stored credentials\n        \"\"\"\n        self.client.credentials(HTTP_AUTHORIZATION='example')\n        response = self.client.get('/view/')\n        assert response.data['auth'] == 'example'\n        self.client.logout()\n        response = self.client.get('/view/')\n        assert response.data['auth'] == b''\n\n    def test_logout_resets_force_authenticate(self):\n        \"\"\"\n        `logout()` resets any `force_authenticate`\n        \"\"\"\n        user = User.objects.create_user('example', 'example@example.com', 'password')\n        self.client.force_authenticate(user)\n        response = self.client.get('/view/')\n        assert response.data['user'] == 'example'\n        self.client.logout()\n        response = self.client.get('/view/')\n        assert response.data['user'] == ''\n\n    def test_follow_redirect(self):\n        \"\"\"\n        Follow redirect by setting follow argument.\n        \"\"\"\n        for method in ('get', 'post', 'put', 'patch', 'delete', 'options'):\n            with self.subTest(method=method):\n                req_method = getattr(self.client, method)\n                response = req_method('/redirect-view/')\n                assert response.status_code == 302\n                response = req_method('/redirect-view/', follow=True)\n                assert response.redirect_chain is not None\n                assert response.status_code == 200\n\n    def test_follow_307_308_preserve_kwargs(self, *mocked_methods):\n        \"\"\"\n        Follow redirect by setting follow argument, and make sure the following\n        method called with appropriate kwargs.\n        \"\"\"\n        methods = ('get', 'post', 'put', 'patch', 'delete', 'options')\n        codes = (307, 308)\n        for method, code in itertools.product(methods, codes):\n            subtest_ctx = self.subTest(method=method, code=code)\n            patch_ctx = patch.object(self.client, method, side_effect=getattr(self.client, method))\n            with subtest_ctx, patch_ctx as req_method:\n                kwargs = {'data': {'example': 'test'}, 'format': 'json'}\n                response = req_method('/redirect-view/%s/' % code, follow=True, **kwargs)\n                assert response.redirect_chain is not None\n                assert response.status_code == 200\n                for _, call_args, call_kwargs in req_method.mock_calls:\n                    assert all(call_kwargs[k] == kwargs[k] for k in kwargs if k in call_kwargs)\n\n    def test_invalid_multipart_data(self):\n        \"\"\"\n        MultiPart encoding cannot support nested data, so raise a helpful\n        error if the user attempts to do so.\n        \"\"\"\n        self.assertRaises(\n            AssertionError, self.client.post,\n            path='/view/', data={'valid': 123, 'invalid': {'a': 123}}\n        )\n\n    def test_empty_post_uses_default_boolean_value(self):\n        response = self.client.post(\n            '/post-view/',\n            data=None,\n            content_type='application/json'\n        )\n        assert response.status_code == 200\n        assert response.data == {\"flag\": True}\n\n    def test_post_encodes_data_based_on_json_content_type(self):\n        data = {'data': True}\n        response = self.client.post(\n            '/post-json-view/',\n            data=data,\n            content_type='application/json'\n        )\n\n        assert response.status_code == 200\n        assert response.data == data\n\n    def test_delete_based_on_format(self):\n        response = self.client.delete('/delete-json-view/', format='json')\n        assert response.status_code == status.HTTP_204_NO_CONTENT\n        assert response.data is None\n\n\nclass TestAPIRequestFactory(TestCase):\n    def test_csrf_exempt_by_default(self):\n        \"\"\"\n        By default, the test client is CSRF exempt.\n        \"\"\"\n        user = User.objects.create_user('example', 'example@example.com', 'password')\n        factory = APIRequestFactory()\n        request = factory.post('/view/')\n        request.user = user\n        response = view(request)\n        assert response.status_code == 200\n\n    def test_explicitly_enforce_csrf_checks(self):\n        \"\"\"\n        The test client can enforce CSRF checks.\n        \"\"\"\n        user = User.objects.create_user('example', 'example@example.com', 'password')\n        factory = APIRequestFactory(enforce_csrf_checks=True)\n        request = factory.post('/view/')\n        request.user = user\n        response = view(request)\n        expected = {'detail': 'CSRF Failed: CSRF cookie not set.'}\n        assert response.status_code == 403\n        assert response.data == expected\n\n    def test_transform_factory_django_request_to_drf_request(self):\n        \"\"\"\n        ref: GH-3608, GH-4440 & GH-6488.\n        \"\"\"\n\n        factory = APIRequestFactory()\n\n        class DummyView(APIView):  # Your custom view.\n            ...\n\n        request = factory.get('/', {'demo': 'test'})\n        drf_request = DummyView().initialize_request(request)\n        assert drf_request.query_params == {'demo': ['test']}\n\n        assert hasattr(drf_request, 'accepted_media_type') is False\n        DummyView().initial(drf_request)\n        assert drf_request.accepted_media_type == 'application/json'\n\n        request = factory.post('/', {'example': 'test'})\n        drf_request = DummyView().initialize_request(request)\n        assert drf_request.data.get('example') == 'test'\n\n    def test_invalid_format(self):\n        \"\"\"\n        Attempting to use a format that is not configured will raise an\n        assertion error.\n        \"\"\"\n        factory = APIRequestFactory()\n        self.assertRaises(\n            AssertionError, factory.post,\n            path='/view/', data={'example': 1}, format='xml'\n        )\n\n    def test_force_authenticate(self):\n        \"\"\"\n        Setting `force_authenticate()` forcibly authenticates the request.\n        \"\"\"\n        user = User.objects.create_user('example', 'example@example.com')\n        factory = APIRequestFactory()\n        request = factory.get('/view')\n        force_authenticate(request, user=user)\n        response = view(request)\n        assert response.data['user'] == 'example'\n\n    def test_upload_file(self):\n        # This is a 1x1 black png\n        simple_png = BytesIO(b'\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHDR\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x01\\x08\\x06\\x00\\x00\\x00\\x1f\\x15\\xc4\\x89\\x00\\x00\\x00\\rIDATx\\x9cc````\\x00\\x00\\x00\\x05\\x00\\x01\\xa5\\xf6E@\\x00\\x00\\x00\\x00IEND\\xaeB`\\x82')\n        simple_png.name = 'test.png'\n        factory = APIRequestFactory()\n        factory.post('/', data={'image': simple_png})\n\n    def test_request_factory_url_arguments(self):\n        \"\"\"\n        This is a non regression test against #1461\n        \"\"\"\n        factory = APIRequestFactory()\n        request = factory.get('/view/?demo=test')\n        assert dict(request.GET) == {'demo': ['test']}\n        request = factory.get('/view/', {'demo': 'test'})\n        assert dict(request.GET) == {'demo': ['test']}\n\n    def test_request_factory_url_arguments_with_unicode(self):\n        factory = APIRequestFactory()\n        request = factory.get('/view/?demo=testé')\n        assert dict(request.GET) == {'demo': ['testé']}\n        request = factory.get('/view/', {'demo': 'testé'})\n        assert dict(request.GET) == {'demo': ['testé']}\n\n    def test_empty_request_content_type(self):\n        factory = APIRequestFactory()\n        request = factory.post(\n            '/post-view/',\n            data=None,\n            content_type='application/json',\n        )\n        assert request.META['CONTENT_TYPE'] == 'application/json'\n\n\nclass TestUrlPatternTestCase(URLPatternsTestCase):\n    urlpatterns = [\n        path('', view),\n    ]\n\n    @classmethod\n    def setUpClass(cls):\n        assert urlpatterns is not cls.urlpatterns\n        super().setUpClass()\n        assert urlpatterns is cls.urlpatterns\n\n    @classmethod\n    def doClassCleanups(cls):\n        assert urlpatterns is cls.urlpatterns\n        super().doClassCleanups()\n        assert urlpatterns is not cls.urlpatterns\n\n    def test_urlpatterns(self):\n        assert self.client.get('/').status_code == 200\n\n\nclass TestExistingPatterns(TestCase):\n    def test_urlpatterns(self):\n        # sanity test to ensure that this test module does not have a '/' route\n        assert self.client.get('/').status_code == 404\n"
  },
  {
    "path": "tests/test_throttling.py",
    "content": "\"\"\"\nTests for the throttling implementations in the permissions module.\n\"\"\"\n\nimport pytest\nfrom django.contrib.auth.models import User\nfrom django.core.cache import cache\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.http import HttpRequest\nfrom django.test import TestCase\n\nfrom rest_framework.request import Request\nfrom rest_framework.response import Response\nfrom rest_framework.settings import api_settings\nfrom rest_framework.test import APIRequestFactory, force_authenticate\nfrom rest_framework.throttling import (\n    AnonRateThrottle, BaseThrottle, ScopedRateThrottle, SimpleRateThrottle,\n    UserRateThrottle\n)\nfrom rest_framework.views import APIView\n\n\nclass User3SecRateThrottle(UserRateThrottle):\n    rate = '3/sec'\n    scope = 'seconds'\n\n\nclass User3MinRateThrottle(UserRateThrottle):\n    rate = '3/min'\n    scope = 'minutes'\n\n\nclass User6MinRateThrottle(UserRateThrottle):\n    rate = '6/min'\n    scope = 'minutes'\n\n\nclass NonTimeThrottle(BaseThrottle):\n    def allow_request(self, request, view):\n        if not hasattr(self.__class__, 'called'):\n            self.__class__.called = True\n            return True\n        return False\n\n\nclass MockView_DoubleThrottling(APIView):\n    throttle_classes = (User3SecRateThrottle, User6MinRateThrottle,)\n\n    def get(self, request):\n        return Response('foo')\n\n\nclass MockView(APIView):\n    throttle_classes = (User3SecRateThrottle,)\n\n    def get(self, request):\n        return Response('foo')\n\n\nclass MockView_MinuteThrottling(APIView):\n    throttle_classes = (User3MinRateThrottle,)\n\n    def get(self, request):\n        return Response('foo')\n\n\nclass MockView_NonTimeThrottling(APIView):\n    throttle_classes = (NonTimeThrottle,)\n\n    def get(self, request):\n        return Response('foo')\n\n\nclass ThrottlingTests(TestCase):\n    def setUp(self):\n        \"\"\"\n        Reset the cache so that no throttles will be active\n        \"\"\"\n        cache.clear()\n        self.factory = APIRequestFactory()\n\n    def test_requests_are_throttled(self):\n        \"\"\"\n        Ensure request rate is limited\n        \"\"\"\n        request = self.factory.get('/')\n        for dummy in range(4):\n            response = MockView.as_view()(request)\n        assert response.status_code == 429\n\n    def set_throttle_timer(self, view, value):\n        \"\"\"\n        Explicitly set the timer, overriding time.time()\n        \"\"\"\n        for cls in view.throttle_classes:\n            cls.timer = lambda self: value\n\n    def test_request_throttling_expires(self):\n        \"\"\"\n        Ensure request rate is limited for a limited duration only\n        \"\"\"\n        self.set_throttle_timer(MockView, 0)\n\n        request = self.factory.get('/')\n        for dummy in range(4):\n            response = MockView.as_view()(request)\n        assert response.status_code == 429\n\n        # Advance the timer by one second\n        self.set_throttle_timer(MockView, 1)\n\n        response = MockView.as_view()(request)\n        assert response.status_code == 200\n\n    def ensure_is_throttled(self, view, expect):\n        request = self.factory.get('/')\n        request.user = User.objects.create(username='a')\n        for dummy in range(3):\n            view.as_view()(request)\n        request.user = User.objects.create(username='b')\n        response = view.as_view()(request)\n        assert response.status_code == expect\n\n    def test_request_throttling_is_per_user(self):\n        \"\"\"\n        Ensure request rate is only limited per user, not globally for\n        PerUserThrottles\n        \"\"\"\n        self.ensure_is_throttled(MockView, 200)\n\n    def test_request_throttling_multiple_throttles(self):\n        \"\"\"\n        Ensure all throttle classes see each request even when the request is\n        already being throttled\n        \"\"\"\n        self.set_throttle_timer(MockView_DoubleThrottling, 0)\n        request = self.factory.get('/')\n        for dummy in range(4):\n            response = MockView_DoubleThrottling.as_view()(request)\n        assert response.status_code == 429\n        assert int(response['retry-after']) == 1\n\n        # At this point our client made 4 requests (one was throttled) in a\n        # second. If we advance the timer by one additional second, the client\n        # should be allowed to make 2 more before being throttled by the 2nd\n        # throttle class, which has a limit of 6 per minute.\n        self.set_throttle_timer(MockView_DoubleThrottling, 1)\n        for dummy in range(2):\n            response = MockView_DoubleThrottling.as_view()(request)\n            assert response.status_code == 200\n\n        response = MockView_DoubleThrottling.as_view()(request)\n        assert response.status_code == 429\n        assert int(response['retry-after']) == 59\n\n        # Just to make sure check again after two more seconds.\n        self.set_throttle_timer(MockView_DoubleThrottling, 2)\n        response = MockView_DoubleThrottling.as_view()(request)\n        assert response.status_code == 429\n        assert int(response['retry-after']) == 58\n\n    def test_throttle_rate_change_negative(self):\n        self.set_throttle_timer(MockView_DoubleThrottling, 0)\n        request = self.factory.get('/')\n        for dummy in range(24):\n            response = MockView_DoubleThrottling.as_view()(request)\n        assert response.status_code == 429\n        assert int(response['retry-after']) == 60\n\n        previous_rate = User3SecRateThrottle.rate\n        try:\n            User3SecRateThrottle.rate = '1/sec'\n\n            for dummy in range(24):\n                response = MockView_DoubleThrottling.as_view()(request)\n\n            assert response.status_code == 429\n            assert int(response['retry-after']) == 60\n        finally:\n            # reset\n            User3SecRateThrottle.rate = previous_rate\n\n    def ensure_response_header_contains_proper_throttle_field(self, view, expected_headers):\n        \"\"\"\n        Ensure the response returns an Retry-After field with status and next attributes\n        set properly.\n        \"\"\"\n        request = self.factory.get('/')\n        for timer, expect in expected_headers:\n            self.set_throttle_timer(view, timer)\n            response = view.as_view()(request)\n            if expect is not None:\n                assert response['Retry-After'] == expect\n            else:\n                assert 'Retry-After' not in response\n\n    def test_seconds_fields(self):\n        \"\"\"\n        Ensure for second based throttles.\n        \"\"\"\n        self.ensure_response_header_contains_proper_throttle_field(\n            MockView, (\n                (0, None),\n                (0, None),\n                (0, None),\n                (0, '1')\n            )\n        )\n\n    def test_minutes_fields(self):\n        \"\"\"\n        Ensure for minute based throttles.\n        \"\"\"\n        self.ensure_response_header_contains_proper_throttle_field(\n            MockView_MinuteThrottling, (\n                (0, None),\n                (0, None),\n                (0, None),\n                (0, '60')\n            )\n        )\n\n    def test_next_rate_remains_constant_if_followed(self):\n        \"\"\"\n        If a client follows the recommended next request rate,\n        the throttling rate should stay constant.\n        \"\"\"\n        self.ensure_response_header_contains_proper_throttle_field(\n            MockView_MinuteThrottling, (\n                (0, None),\n                (20, None),\n                (40, None),\n                (60, None),\n                (80, None)\n            )\n        )\n\n    def test_non_time_throttle(self):\n        \"\"\"\n        Ensure for second based throttles.\n        \"\"\"\n        request = self.factory.get('/')\n\n        self.assertFalse(hasattr(MockView_NonTimeThrottling.throttle_classes[0], 'called'))\n\n        response = MockView_NonTimeThrottling.as_view()(request)\n        self.assertFalse('Retry-After' in response)\n\n        self.assertTrue(MockView_NonTimeThrottling.throttle_classes[0].called)\n\n        response = MockView_NonTimeThrottling.as_view()(request)\n        self.assertFalse('Retry-After' in response)\n\n\nclass ScopedRateThrottleTests(TestCase):\n    \"\"\"\n    Tests for ScopedRateThrottle.\n    \"\"\"\n\n    def setUp(self):\n        self.throttle = ScopedRateThrottle()\n\n        class XYScopedRateThrottle(ScopedRateThrottle):\n            TIMER_SECONDS = 0\n            THROTTLE_RATES = {'x': '3/min', 'y': '1/min'}\n\n            def timer(self):\n                return self.TIMER_SECONDS\n\n        class XView(APIView):\n            throttle_classes = (XYScopedRateThrottle,)\n            throttle_scope = 'x'\n\n            def get(self, request):\n                return Response('x')\n\n        class YView(APIView):\n            throttle_classes = (XYScopedRateThrottle,)\n            throttle_scope = 'y'\n\n            def get(self, request):\n                return Response('y')\n\n        class UnscopedView(APIView):\n            throttle_classes = (XYScopedRateThrottle,)\n\n            def get(self, request):\n                return Response('y')\n\n        self.throttle_class = XYScopedRateThrottle\n        self.factory = APIRequestFactory()\n        self.x_view = XView.as_view()\n        self.y_view = YView.as_view()\n        self.unscoped_view = UnscopedView.as_view()\n\n    def increment_timer(self, seconds=1):\n        self.throttle_class.TIMER_SECONDS += seconds\n\n    def test_scoped_rate_throttle(self):\n        request = self.factory.get('/')\n\n        # Should be able to hit x view 3 times per minute.\n        response = self.x_view(request)\n        assert response.status_code == 200\n\n        self.increment_timer()\n        response = self.x_view(request)\n        assert response.status_code == 200\n\n        self.increment_timer()\n        response = self.x_view(request)\n        assert response.status_code == 200\n        self.increment_timer()\n        response = self.x_view(request)\n        assert response.status_code == 429\n\n        # Should be able to hit y view 1 time per minute.\n        self.increment_timer()\n        response = self.y_view(request)\n        assert response.status_code == 200\n\n        self.increment_timer()\n        response = self.y_view(request)\n        assert response.status_code == 429\n\n        # Ensure throttles properly reset by advancing the rest of the minute\n        self.increment_timer(55)\n\n        # Should still be able to hit x view 3 times per minute.\n        response = self.x_view(request)\n        assert response.status_code == 200\n\n        self.increment_timer()\n        response = self.x_view(request)\n        assert response.status_code == 200\n\n        self.increment_timer()\n        response = self.x_view(request)\n        assert response.status_code == 200\n\n        self.increment_timer()\n        response = self.x_view(request)\n        assert response.status_code == 429\n\n        # Should still be able to hit y view 1 time per minute.\n        self.increment_timer()\n        response = self.y_view(request)\n        assert response.status_code == 200\n\n        self.increment_timer()\n        response = self.y_view(request)\n        assert response.status_code == 429\n\n    def test_unscoped_view_not_throttled(self):\n        request = self.factory.get('/')\n\n        for idx in range(10):\n            self.increment_timer()\n            response = self.unscoped_view(request)\n            assert response.status_code == 200\n\n    def test_get_cache_key_returns_correct_key_if_user_is_authenticated(self):\n        class DummyView:\n            throttle_scope = 'user'\n\n        request = Request(HttpRequest())\n        user = User.objects.create(username='test')\n        force_authenticate(request, user)\n        request.user = user\n        self.throttle.allow_request(request, DummyView())\n        cache_key = self.throttle.get_cache_key(request, view=DummyView())\n        assert cache_key == 'throttle_user_%s' % user.pk\n\n\nclass XffTestingBase(TestCase):\n    def setUp(self):\n\n        class Throttle(ScopedRateThrottle):\n            THROTTLE_RATES = {'test_limit': '1/day'}\n            TIMER_SECONDS = 0\n\n            def timer(self):\n                return self.TIMER_SECONDS\n\n        class View(APIView):\n            throttle_classes = (Throttle,)\n            throttle_scope = 'test_limit'\n\n            def get(self, request):\n                return Response('test_limit')\n\n        cache.clear()\n        self.throttle = Throttle()\n        self.view = View.as_view()\n        self.request = APIRequestFactory().get('/some_uri')\n        self.request.META['REMOTE_ADDR'] = '3.3.3.3'\n        self.request.META['HTTP_X_FORWARDED_FOR'] = '0.0.0.0, 1.1.1.1, 2.2.2.2'\n\n    def config_proxy(self, num_proxies):\n        setattr(api_settings, 'NUM_PROXIES', num_proxies)\n\n\nclass IdWithXffBasicTests(XffTestingBase):\n    def test_accepts_request_under_limit(self):\n        self.config_proxy(0)\n        assert self.view(self.request).status_code == 200\n\n    def test_denies_request_over_limit(self):\n        self.config_proxy(0)\n        self.view(self.request)\n        assert self.view(self.request).status_code == 429\n\n\nclass XffSpoofingTests(XffTestingBase):\n    def test_xff_spoofing_doesnt_change_machine_id_with_one_app_proxy(self):\n        self.config_proxy(1)\n        self.view(self.request)\n        self.request.META['HTTP_X_FORWARDED_FOR'] = '4.4.4.4, 5.5.5.5, 2.2.2.2'\n        assert self.view(self.request).status_code == 429\n\n    def test_xff_spoofing_doesnt_change_machine_id_with_two_app_proxies(self):\n        self.config_proxy(2)\n        self.view(self.request)\n        self.request.META['HTTP_X_FORWARDED_FOR'] = '4.4.4.4, 1.1.1.1, 2.2.2.2'\n        assert self.view(self.request).status_code == 429\n\n\nclass XffUniqueMachinesTest(XffTestingBase):\n    def test_unique_clients_are_counted_independently_with_one_proxy(self):\n        self.config_proxy(1)\n        self.view(self.request)\n        self.request.META['HTTP_X_FORWARDED_FOR'] = '0.0.0.0, 1.1.1.1, 7.7.7.7'\n        assert self.view(self.request).status_code == 200\n\n    def test_unique_clients_are_counted_independently_with_two_proxies(self):\n        self.config_proxy(2)\n        self.view(self.request)\n        self.request.META['HTTP_X_FORWARDED_FOR'] = '0.0.0.0, 7.7.7.7, 2.2.2.2'\n        assert self.view(self.request).status_code == 200\n\n\nclass BaseThrottleTests(TestCase):\n\n    def test_allow_request_raises_not_implemented_error(self):\n        with pytest.raises(NotImplementedError):\n            BaseThrottle().allow_request(request={}, view={})\n\n\nclass SimpleRateThrottleTests(TestCase):\n\n    def setUp(self):\n        SimpleRateThrottle.scope = 'anon'\n\n    def test_get_rate_raises_error_if_scope_is_missing(self):\n        throttle = SimpleRateThrottle()\n        with pytest.raises(ImproperlyConfigured):\n            throttle.scope = None\n            throttle.get_rate()\n\n    def test_throttle_raises_error_if_rate_is_missing(self):\n        SimpleRateThrottle.scope = 'invalid scope'\n        with pytest.raises(ImproperlyConfigured):\n            SimpleRateThrottle()\n\n    def test_parse_rate_returns_tuple_with_none_if_rate_not_provided(self):\n        rate = SimpleRateThrottle().parse_rate(None)\n        assert rate == (None, None)\n\n    def test_allow_request_returns_true_if_rate_is_none(self):\n        assert SimpleRateThrottle().allow_request(request={}, view={}) is True\n\n    def test_get_cache_key_raises_not_implemented_error(self):\n        with pytest.raises(NotImplementedError):\n            SimpleRateThrottle().get_cache_key({}, {})\n\n    def test_allow_request_returns_true_if_key_is_none(self):\n        throttle = SimpleRateThrottle()\n        throttle.rate = 'some rate'\n        throttle.get_cache_key = lambda *args: None\n        assert throttle.allow_request(request={}, view={}) is True\n\n    def test_wait_returns_correct_waiting_time_without_history(self):\n        throttle = SimpleRateThrottle()\n        throttle.num_requests = 1\n        throttle.duration = 60\n        throttle.history = []\n        waiting_time = throttle.wait()\n        assert isinstance(waiting_time, float)\n        assert waiting_time == 30.0\n\n    def test_wait_returns_none_if_there_are_no_available_requests(self):\n        throttle = SimpleRateThrottle()\n        throttle.num_requests = 1\n        throttle.duration = 60\n        throttle.now = throttle.timer()\n        throttle.history = [throttle.timer() for _ in range(3)]\n        assert throttle.wait() is None\n\n\nclass AnonRateThrottleTests(TestCase):\n\n    def setUp(self):\n        self.throttle = AnonRateThrottle()\n\n    def test_authenticated_user_not_affected(self):\n        request = Request(HttpRequest())\n        user = User.objects.create(username='test')\n        force_authenticate(request, user)\n        request.user = user\n        assert self.throttle.get_cache_key(request, view={}) is None\n\n    def test_get_cache_key_returns_correct_value(self):\n        request = Request(HttpRequest())\n        cache_key = self.throttle.get_cache_key(request, view={})\n        assert cache_key == 'throttle_anon_None'\n"
  },
  {
    "path": "tests/test_urlpatterns.py",
    "content": "from collections import namedtuple\n\nfrom django.test import TestCase\nfrom django.urls import Resolver404, URLResolver, include, path, re_path\nfrom django.urls.resolvers import RegexPattern\n\nfrom rest_framework.test import APIRequestFactory\nfrom rest_framework.urlpatterns import format_suffix_patterns\n\n# A container class for test paths for the test case\nURLTestPath = namedtuple('URLTestPath', ['path', 'args', 'kwargs'])\n\n\ndef dummy_view(request, *args, **kwargs):\n    pass\n\n\nclass FormatSuffixTests(TestCase):\n    \"\"\"\n    Tests `format_suffix_patterns` against different URLPatterns to ensure the\n    URLs still resolve properly, including any captured parameters.\n    \"\"\"\n    def _resolve_urlpatterns(self, urlpatterns, test_paths, allowed=None):\n        factory = APIRequestFactory()\n        try:\n            urlpatterns = format_suffix_patterns(urlpatterns, allowed=allowed)\n        except Exception:\n            self.fail(\"Failed to apply `format_suffix_patterns` on  the supplied urlpatterns\")\n        resolver = URLResolver(RegexPattern(r'^/'), urlpatterns)\n        for test_path in test_paths:\n            try:\n                test_path, expected_resolved = test_path\n            except (TypeError, ValueError):\n                expected_resolved = True\n\n            request = factory.get(test_path.path)\n            try:\n                callback, callback_args, callback_kwargs = resolver.resolve(request.path_info)\n            except Resolver404:\n                callback, callback_args, callback_kwargs = (None, None, None)\n                if expected_resolved:\n                    raise\n            except Exception:\n                self.fail(\"Failed to resolve URL: %s\" % request.path_info)\n\n            if not expected_resolved:\n                assert callback is None\n                continue\n\n            assert callback_args == test_path.args\n            assert callback_kwargs == test_path.kwargs\n\n    def _test_trailing_slash(self, urlpatterns):\n        test_paths = [\n            (URLTestPath('/test.api', (), {'format': 'api'}), True),\n            (URLTestPath('/test/.api', (), {'format': 'api'}), False),\n            (URLTestPath('/test.api/', (), {'format': 'api'}), True),\n        ]\n        self._resolve_urlpatterns(urlpatterns, test_paths)\n\n    def test_trailing_slash(self):\n        urlpatterns = [\n            path('test/', dummy_view),\n        ]\n        self._test_trailing_slash(urlpatterns)\n\n    def test_trailing_slash_django2(self):\n        urlpatterns = [\n            path('test/', dummy_view),\n        ]\n        self._test_trailing_slash(urlpatterns)\n\n    def _test_format_suffix(self, urlpatterns):\n        test_paths = [\n            URLTestPath('/test', (), {}),\n            URLTestPath('/test.api', (), {'format': 'api'}),\n            URLTestPath('/test.asdf', (), {'format': 'asdf'}),\n        ]\n        self._resolve_urlpatterns(urlpatterns, test_paths)\n\n    def test_format_suffix(self):\n        urlpatterns = [\n            path('test', dummy_view),\n        ]\n        self._test_format_suffix(urlpatterns)\n\n    def test_format_suffix_django2(self):\n        urlpatterns = [\n            path('test', dummy_view),\n        ]\n        self._test_format_suffix(urlpatterns)\n\n    def test_format_suffix_django2_args(self):\n        urlpatterns = [\n            path('convtest/<int:pk>', dummy_view),\n            re_path(r'^retest/(?P<pk>[0-9]+)$', dummy_view),\n        ]\n        test_paths = [\n            URLTestPath('/convtest/42', (), {'pk': 42}),\n            URLTestPath('/convtest/42.api', (), {'pk': 42, 'format': 'api'}),\n            URLTestPath('/convtest/42.asdf', (), {'pk': 42, 'format': 'asdf'}),\n            URLTestPath('/retest/42', (), {'pk': '42'}),\n            URLTestPath('/retest/42.api', (), {'pk': '42', 'format': 'api'}),\n            URLTestPath('/retest/42.asdf', (), {'pk': '42', 'format': 'asdf'}),\n        ]\n        self._resolve_urlpatterns(urlpatterns, test_paths)\n\n    def _test_default_args(self, urlpatterns):\n        test_paths = [\n            URLTestPath('/test', (), {'foo': 'bar', }),\n            URLTestPath('/test.api', (), {'foo': 'bar', 'format': 'api'}),\n            URLTestPath('/test.asdf', (), {'foo': 'bar', 'format': 'asdf'}),\n        ]\n        self._resolve_urlpatterns(urlpatterns, test_paths)\n\n    def test_default_args(self):\n        urlpatterns = [\n            path('test', dummy_view, {'foo': 'bar'}),\n        ]\n        self._test_default_args(urlpatterns)\n\n    def test_default_args_django2(self):\n        urlpatterns = [\n            path('test', dummy_view, {'foo': 'bar'}),\n        ]\n        self._test_default_args(urlpatterns)\n\n    def _test_included_urls(self, urlpatterns):\n        test_paths = [\n            URLTestPath('/test/path', (), {'foo': 'bar', }),\n            URLTestPath('/test/path.api', (), {'foo': 'bar', 'format': 'api'}),\n            URLTestPath('/test/path.asdf', (), {'foo': 'bar', 'format': 'asdf'}),\n        ]\n        self._resolve_urlpatterns(urlpatterns, test_paths)\n\n    def test_included_urls(self):\n        nested_patterns = [\n            path('path', dummy_view)\n        ]\n        urlpatterns = [\n            path('test/', include(nested_patterns), {'foo': 'bar'}),\n        ]\n        self._test_included_urls(urlpatterns)\n\n    def test_included_urls_mixed(self):\n        nested_patterns = [\n            path('path/<int:child>', dummy_view),\n            re_path(r'^re_path/(?P<child>[0-9]+)$', dummy_view)\n        ]\n        urlpatterns = [\n            re_path(r'^pre_path/(?P<parent>[0-9]+)/', include(nested_patterns), {'foo': 'bar'}),\n            path('ppath/<int:parent>/', include(nested_patterns), {'foo': 'bar'}),\n        ]\n        test_paths = [\n            # parent re_path() nesting child path()\n            URLTestPath('/pre_path/87/path/42', (), {'parent': '87', 'child': 42, 'foo': 'bar', }),\n            URLTestPath('/pre_path/87/path/42.api', (), {'parent': '87', 'child': 42, 'foo': 'bar', 'format': 'api'}),\n            URLTestPath('/pre_path/87/path/42.asdf', (), {'parent': '87', 'child': 42, 'foo': 'bar', 'format': 'asdf'}),\n\n            # parent path() nesting child re_path()\n            URLTestPath('/ppath/87/re_path/42', (), {'parent': 87, 'child': '42', 'foo': 'bar', }),\n            URLTestPath('/ppath/87/re_path/42.api', (), {'parent': 87, 'child': '42', 'foo': 'bar', 'format': 'api'}),\n            URLTestPath('/ppath/87/re_path/42.asdf', (), {'parent': 87, 'child': '42', 'foo': 'bar', 'format': 'asdf'}),\n\n            # parent path() nesting child path()\n            URLTestPath('/ppath/87/path/42', (), {'parent': 87, 'child': 42, 'foo': 'bar', }),\n            URLTestPath('/ppath/87/path/42.api', (), {'parent': 87, 'child': 42, 'foo': 'bar', 'format': 'api'}),\n            URLTestPath('/ppath/87/path/42.asdf', (), {'parent': 87, 'child': 42, 'foo': 'bar', 'format': 'asdf'}),\n\n            # parent re_path() nesting child re_path()\n            URLTestPath('/pre_path/87/re_path/42', (), {'parent': '87', 'child': '42', 'foo': 'bar', }),\n            URLTestPath('/pre_path/87/re_path/42.api', (), {'parent': '87', 'child': '42', 'foo': 'bar', 'format': 'api'}),\n            URLTestPath('/pre_path/87/re_path/42.asdf', (), {'parent': '87', 'child': '42', 'foo': 'bar', 'format': 'asdf'}),\n        ]\n        self._resolve_urlpatterns(urlpatterns, test_paths)\n\n    def _test_allowed_formats(self, urlpatterns):\n        allowed_formats = ['good', 'ugly']\n        test_paths = [\n            (URLTestPath('/test.good/', (), {'format': 'good'}), True),\n            (URLTestPath('/test.bad', (), {}), False),\n            (URLTestPath('/test.ugly', (), {'format': 'ugly'}), True),\n        ]\n        self._resolve_urlpatterns(urlpatterns, test_paths, allowed=allowed_formats)\n\n    def test_allowed_formats_re_path(self):\n        urlpatterns = [\n            re_path(r'^test$', dummy_view),\n        ]\n        self._test_allowed_formats(urlpatterns)\n\n    def test_allowed_formats_path(self):\n        urlpatterns = [\n            path('test', dummy_view),\n        ]\n        self._test_allowed_formats(urlpatterns)\n"
  },
  {
    "path": "tests/test_utils.py",
    "content": "from unittest import mock\n\nfrom django.test import TestCase, override_settings\nfrom django.urls import path\n\nfrom rest_framework.decorators import action\nfrom rest_framework.routers import SimpleRouter\nfrom rest_framework.serializers import ModelSerializer\nfrom rest_framework.utils import json\nfrom rest_framework.utils.breadcrumbs import get_breadcrumbs\nfrom rest_framework.utils.formatting import lazy_format\nfrom rest_framework.utils.model_meta import FieldInfo, RelationInfo\nfrom rest_framework.utils.urls import remove_query_param, replace_query_param\nfrom rest_framework.views import APIView\nfrom rest_framework.viewsets import ModelViewSet\nfrom tests.models import BasicModel\n\n\nclass Root(APIView):\n    pass\n\n\nclass ResourceRoot(APIView):\n    pass\n\n\nclass ResourceInstance(APIView):\n    pass\n\n\nclass NestedResourceRoot(APIView):\n    pass\n\n\nclass NestedResourceInstance(APIView):\n    pass\n\n\nclass CustomNameResourceInstance(APIView):\n    def get_view_name(self):\n        return \"Foo\"\n\n\nclass ResourceViewSet(ModelViewSet):\n    serializer_class = ModelSerializer\n    queryset = BasicModel.objects.all()\n\n    @action(detail=False)\n    def list_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n    @action(detail=True)\n    def detail_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n    @action(detail=True, name='Custom Name')\n    def named_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n    @action(detail=True, suffix='Custom Suffix')\n    def suffixed_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n\nrouter = SimpleRouter()\nrouter.register(r'resources', ResourceViewSet)\nurlpatterns = [\n    path('', Root.as_view()),\n    path('resource/', ResourceRoot.as_view()),\n    path('resource/customname', CustomNameResourceInstance.as_view()),\n    path('resource/<int:key>', ResourceInstance.as_view()),\n    path('resource/<int:key>/', NestedResourceRoot.as_view()),\n    path('resource/<int:key>/<str:other>', NestedResourceInstance.as_view()),\n]\nurlpatterns += router.urls\n\n\n@override_settings(ROOT_URLCONF='tests.test_utils')\nclass BreadcrumbTests(TestCase):\n    \"\"\"\n    Tests the breadcrumb functionality used by the HTML renderer.\n    \"\"\"\n    def test_root_breadcrumbs(self):\n        url = '/'\n        assert get_breadcrumbs(url) == [('Root', '/')]\n\n    def test_resource_root_breadcrumbs(self):\n        url = '/resource/'\n        assert get_breadcrumbs(url) == [\n            ('Root', '/'), ('Resource Root', '/resource/')\n        ]\n\n    def test_resource_instance_breadcrumbs(self):\n        url = '/resource/123'\n        assert get_breadcrumbs(url) == [\n            ('Root', '/'),\n            ('Resource Root', '/resource/'),\n            ('Resource Instance', '/resource/123')\n        ]\n\n    def test_resource_instance_customname_breadcrumbs(self):\n        url = '/resource/customname'\n        assert get_breadcrumbs(url) == [\n            ('Root', '/'),\n            ('Resource Root', '/resource/'),\n            ('Foo', '/resource/customname')\n        ]\n\n    def test_nested_resource_breadcrumbs(self):\n        url = '/resource/123/'\n        assert get_breadcrumbs(url) == [\n            ('Root', '/'),\n            ('Resource Root', '/resource/'),\n            ('Resource Instance', '/resource/123'),\n            ('Nested Resource Root', '/resource/123/')\n        ]\n\n    def test_nested_resource_instance_breadcrumbs(self):\n        url = '/resource/123/abc'\n        assert get_breadcrumbs(url) == [\n            ('Root', '/'),\n            ('Resource Root', '/resource/'),\n            ('Resource Instance', '/resource/123'),\n            ('Nested Resource Root', '/resource/123/'),\n            ('Nested Resource Instance', '/resource/123/abc')\n        ]\n\n    def test_broken_url_breadcrumbs_handled_gracefully(self):\n        url = '/foobar'\n        assert get_breadcrumbs(url) == [('Root', '/')]\n\n    def test_modelviewset_resource_instance_breadcrumbs(self):\n        url = '/resources/1/'\n        assert get_breadcrumbs(url) == [\n            ('Root', '/'),\n            ('Resource List', '/resources/'),\n            ('Resource Instance', '/resources/1/')\n        ]\n\n    def test_modelviewset_list_action_breadcrumbs(self):\n        url = '/resources/list_action/'\n        assert get_breadcrumbs(url) == [\n            ('Root', '/'),\n            ('Resource List', '/resources/'),\n            ('List action', '/resources/list_action/'),\n        ]\n\n    def test_modelviewset_detail_action_breadcrumbs(self):\n        url = '/resources/1/detail_action/'\n        assert get_breadcrumbs(url) == [\n            ('Root', '/'),\n            ('Resource List', '/resources/'),\n            ('Resource Instance', '/resources/1/'),\n            ('Detail action', '/resources/1/detail_action/'),\n        ]\n\n    def test_modelviewset_action_name_kwarg(self):\n        url = '/resources/1/named_action/'\n        assert get_breadcrumbs(url) == [\n            ('Root', '/'),\n            ('Resource List', '/resources/'),\n            ('Resource Instance', '/resources/1/'),\n            ('Custom Name', '/resources/1/named_action/'),\n        ]\n\n    def test_modelviewset_action_suffix_kwarg(self):\n        url = '/resources/1/suffixed_action/'\n        assert get_breadcrumbs(url) == [\n            ('Root', '/'),\n            ('Resource List', '/resources/'),\n            ('Resource Instance', '/resources/1/'),\n            ('Resource Custom Suffix', '/resources/1/suffixed_action/'),\n        ]\n\n\nclass JsonFloatTests(TestCase):\n    \"\"\"\n    Internally, wrapped json functions should adhere to strict float handling\n    \"\"\"\n\n    def test_dumps(self):\n        with self.assertRaises(ValueError):\n            json.dumps(float('inf'))\n\n        with self.assertRaises(ValueError):\n            json.dumps(float('nan'))\n\n    def test_loads(self):\n        with self.assertRaises(ValueError):\n            json.loads(\"Infinity\")\n\n        with self.assertRaises(ValueError):\n            json.loads(\"NaN\")\n\n\n@override_settings(REST_FRAMEWORK={'STRICT_JSON': False})\nclass NonStrictJsonFloatTests(JsonFloatTests):\n    \"\"\"\n    'STRICT_JSON = False' should not somehow affect internal json behavior\n    \"\"\"\n\n\nclass UrlsReplaceQueryParamTests(TestCase):\n    \"\"\"\n    Tests the replace_query_param functionality.\n    \"\"\"\n    def test_valid_unicode_preserved(self):\n        # Encoded string: '查询'\n        q = '/?q=%E6%9F%A5%E8%AF%A2'\n        new_key = 'page'\n        new_value = 2\n        value = '%E6%9F%A5%E8%AF%A2'\n\n        assert new_key in replace_query_param(q, new_key, new_value)\n        assert value in replace_query_param(q, new_key, new_value)\n\n    def test_valid_unicode_replaced(self):\n        q = '/?page=1'\n        value = '1'\n        new_key = 'q'\n        new_value = '%E6%9F%A5%E8%AF%A2'\n\n        assert new_key in replace_query_param(q, new_key, new_value)\n        assert value in replace_query_param(q, new_key, new_value)\n\n    def test_invalid_unicode(self):\n        # Encoded string: '��<script>alert(313)</script>=1'\n        q = '/e/?%FF%FE%3C%73%63%72%69%70%74%3E%61%6C%65%72%74%28%33%31%33%29%3C%2F%73%63%72%69%70%74%3E=1'\n        key = 'from'\n        value = 'login'\n\n        assert key in replace_query_param(q, key, value)\n\n\nclass UrlsRemoveQueryParamTests(TestCase):\n    \"\"\"\n    Tests the remove_query_param functionality.\n    \"\"\"\n    def test_valid_unicode_removed(self):\n        q = '/?page=2345&q=%E6%9F%A5%E8%AF%A2'\n        key = 'page'\n        value = '2345'\n        removed_key = 'q'\n\n        assert key in remove_query_param(q, removed_key)\n        assert value in remove_query_param(q, removed_key)\n        assert '%' not in remove_query_param(q, removed_key)\n\n    def test_invalid_unicode(self):\n        q = '/?from=login&page=2&%FF%FE%3C%73%63%72%69%70%74%3E%61%6C%65%72%74%28%33%31%33%29%3C%2F%73%63%72%69%70%74%3E=1'\n        key = 'from'\n        removed_key = 'page'\n\n        assert key in remove_query_param(q, removed_key)\n\n\nclass LazyFormatTests(TestCase):\n    def test_it_formats_correctly(self):\n        formatted = lazy_format('Does {} work? {answer}: %s', 'it', answer='Yes')\n        assert str(formatted) == 'Does it work? Yes: %s'\n        assert formatted % 'it does' == 'Does it work? Yes: it does'\n\n    def test_it_formats_lazily(self):\n        message = mock.Mock(wraps='message')\n        formatted = lazy_format(message)\n        assert message.format.call_count == 0\n        str(formatted)\n        assert message.format.call_count == 1\n        str(formatted)\n        assert message.format.call_count == 1\n\n\nclass ModelMetaNamedTupleNames(TestCase):\n    def test_named_tuple_names(self):\n        assert FieldInfo.__name__ == 'FieldInfo'\n        assert RelationInfo.__name__ == 'RelationInfo'\n"
  },
  {
    "path": "tests/test_validation.py",
    "content": "import re\n\nfrom django.core.validators import MaxValueValidator, RegexValidator\nfrom django.db import models\nfrom django.test import TestCase\n\nfrom rest_framework import generics, serializers, status\nfrom rest_framework.test import APIRequestFactory\n\nfactory = APIRequestFactory()\n\n\n# Regression for #666\n\nclass ValidationModel(models.Model):\n    blank_validated_field = models.CharField(max_length=255)\n\n\nclass ValidationModelSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = ValidationModel\n        fields = ('blank_validated_field',)\n        read_only_fields = ('blank_validated_field',)\n\n\nclass UpdateValidationModel(generics.RetrieveUpdateDestroyAPIView):\n    queryset = ValidationModel.objects.all()\n    serializer_class = ValidationModelSerializer\n\n\n# Regression for #653\n\nclass ShouldValidateModel(models.Model):\n    should_validate_field = models.CharField(max_length=255)\n\n\nclass ShouldValidateModelSerializer(serializers.ModelSerializer):\n    renamed = serializers.CharField(source='should_validate_field', required=False)\n\n    def validate_renamed(self, value):\n        if len(value) < 3:\n            raise serializers.ValidationError('Minimum 3 characters.')\n        return value\n\n    class Meta:\n        model = ShouldValidateModel\n        fields = ('renamed',)\n\n\nclass TestNestedValidationError(TestCase):\n    def test_nested_validation_error_detail(self):\n        \"\"\"\n        Ensure nested validation error detail is rendered correctly.\n        \"\"\"\n        e = serializers.ValidationError({\n            'nested': {\n                'field': ['error'],\n            }\n        })\n\n        assert serializers.as_serializer_error(e) == {\n            'nested': {\n                'field': ['error'],\n            }\n        }\n\n\nclass TestPreSaveValidationExclusionsSerializer(TestCase):\n    def test_renamed_fields_are_model_validated(self):\n        \"\"\"\n        Ensure fields with 'source' applied do get still get model validation.\n        \"\"\"\n        # We've set `required=False` on the serializer, but the model\n        # does not have `blank=True`, so this serializer should not validate.\n        serializer = ShouldValidateModelSerializer(data={'renamed': ''})\n        assert serializer.is_valid() is False\n        assert 'renamed' in serializer.errors\n        assert 'should_validate_field' not in serializer.errors\n\n\nclass TestCustomValidationMethods(TestCase):\n    def test_custom_validation_method_is_executed(self):\n        serializer = ShouldValidateModelSerializer(data={'renamed': 'fo'})\n        assert not serializer.is_valid()\n        assert 'renamed' in serializer.errors\n\n    def test_custom_validation_method_passing(self):\n        serializer = ShouldValidateModelSerializer(data={'renamed': 'foo'})\n        assert serializer.is_valid()\n\n\nclass ValidationSerializer(serializers.Serializer):\n    foo = serializers.CharField()\n\n    def validate_foo(self, attrs, source):\n        raise serializers.ValidationError(\"foo invalid\")\n\n    def validate(self, attrs):\n        raise serializers.ValidationError(\"serializer invalid\")\n\n\nclass TestAvoidValidation(TestCase):\n    \"\"\"\n    If serializer was initialized with invalid data (None or non dict-like), it\n    should avoid validation layer (validate_<field> and validate methods)\n    \"\"\"\n    def test_serializer_errors_has_only_invalid_data_error(self):\n        serializer = ValidationSerializer(data='invalid data')\n        assert not serializer.is_valid()\n        assert serializer.errors == {\n            'non_field_errors': [\n                'Invalid data. Expected a dictionary, but got str.',\n            ]\n        }\n\n\n# regression tests for issue: 1493\n\nclass ValidationMaxValueValidatorModel(models.Model):\n    number_value = models.PositiveIntegerField(validators=[MaxValueValidator(100)])\n\n\nclass ValidationMaxValueValidatorModelSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = ValidationMaxValueValidatorModel\n        fields = '__all__'\n\n\nclass UpdateMaxValueValidationModel(generics.RetrieveUpdateDestroyAPIView):\n    queryset = ValidationMaxValueValidatorModel.objects.all()\n    serializer_class = ValidationMaxValueValidatorModelSerializer\n\n\nclass TestMaxValueValidatorValidation(TestCase):\n\n    def test_max_value_validation_serializer_success(self):\n        serializer = ValidationMaxValueValidatorModelSerializer(data={'number_value': 99})\n        assert serializer.is_valid()\n\n    def test_max_value_validation_serializer_fails(self):\n        serializer = ValidationMaxValueValidatorModelSerializer(data={'number_value': 101})\n        assert not serializer.is_valid()\n        assert serializer.errors == {\n            'number_value': [\n                'Ensure this value is less than or equal to 100.'\n            ]\n        }\n\n    def test_max_value_validation_success(self):\n        obj = ValidationMaxValueValidatorModel.objects.create(number_value=100)\n        request = factory.patch(f'/{obj.pk}', {'number_value': 98}, format='json')\n        view = UpdateMaxValueValidationModel().as_view()\n        response = view(request, pk=obj.pk).render()\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_max_value_validation_fail(self):\n        obj = ValidationMaxValueValidatorModel.objects.create(number_value=100)\n        request = factory.patch(f'/{obj.pk}', {'number_value': 101}, format='json')\n        view = UpdateMaxValueValidationModel().as_view()\n        response = view(request, pk=obj.pk).render()\n        assert response.content == b'{\"number_value\":[\"Ensure this value is less than or equal to 100.\"]}'\n        assert response.status_code == status.HTTP_400_BAD_REQUEST\n\n\n# regression tests for issue: 1533\n\nclass TestChoiceFieldChoicesValidate(TestCase):\n    CHOICES = [\n        (0, 'Small'),\n        (1, 'Medium'),\n        (2, 'Large'),\n    ]\n\n    SINGLE_CHOICES = [0, 1, 2]\n\n    CHOICES_NESTED = [\n        ('Category', (\n            (1, 'First'),\n            (2, 'Second'),\n            (3, 'Third'),\n        )),\n        (4, 'Fourth'),\n    ]\n\n    MIXED_CHOICES = [\n        ('Category', (\n            (1, 'First'),\n            (2, 'Second'),\n        )),\n        3,\n        (4, 'Fourth'),\n    ]\n\n    def test_choices(self):\n        \"\"\"\n        Make sure a value for choices works as expected.\n        \"\"\"\n        f = serializers.ChoiceField(choices=self.CHOICES)\n        value = self.CHOICES[0][0]\n        try:\n            f.to_internal_value(value)\n        except serializers.ValidationError:\n            self.fail(\"Value %s does not validate\" % str(value))\n\n    def test_single_choices(self):\n        \"\"\"\n        Make sure a single value for choices works as expected.\n        \"\"\"\n        f = serializers.ChoiceField(choices=self.SINGLE_CHOICES)\n        value = self.SINGLE_CHOICES[0]\n        try:\n            f.to_internal_value(value)\n        except serializers.ValidationError:\n            self.fail(\"Value %s does not validate\" % str(value))\n\n    def test_nested_choices(self):\n        \"\"\"\n        Make sure a nested value for choices works as expected.\n        \"\"\"\n        f = serializers.ChoiceField(choices=self.CHOICES_NESTED)\n        value = self.CHOICES_NESTED[0][1][0][0]\n        try:\n            f.to_internal_value(value)\n        except serializers.ValidationError:\n            self.fail(\"Value %s does not validate\" % str(value))\n\n    def test_mixed_choices(self):\n        \"\"\"\n        Make sure mixed values for choices works as expected.\n        \"\"\"\n        f = serializers.ChoiceField(choices=self.MIXED_CHOICES)\n        value = self.MIXED_CHOICES[1]\n        try:\n            f.to_internal_value(value)\n        except serializers.ValidationError:\n            self.fail(\"Value %s does not validate\" % str(value))\n\n\nclass RegexSerializer(serializers.Serializer):\n    pin = serializers.CharField(\n        validators=[RegexValidator(regex=re.compile('^[0-9]{4,6}$'),\n                                   message='A PIN is 4-6 digits')])\n\n\nexpected_repr = \"\"\"\nRegexSerializer():\n    pin = CharField(validators=[<django.core.validators.RegexValidator object>])\n\"\"\".strip()\n\n\nclass TestRegexSerializer(TestCase):\n    def test_regex_repr(self):\n        serializer_repr = repr(RegexSerializer())\n        assert serializer_repr == expected_repr\n"
  },
  {
    "path": "tests/test_validation_error.py",
    "content": "from django.test import TestCase\n\nfrom rest_framework import serializers, status\nfrom rest_framework.decorators import api_view\nfrom rest_framework.exceptions import ValidationError\nfrom rest_framework.response import Response\nfrom rest_framework.settings import api_settings\nfrom rest_framework.test import APIRequestFactory\nfrom rest_framework.views import APIView\n\nfactory = APIRequestFactory()\n\n\nclass ExampleSerializer(serializers.Serializer):\n    char = serializers.CharField()\n    integer = serializers.IntegerField()\n\n\nclass ErrorView(APIView):\n    def get(self, request, *args, **kwargs):\n        ExampleSerializer(data={}).is_valid(raise_exception=True)\n\n\n@api_view(['GET'])\ndef error_view(request):\n    ExampleSerializer(data={}).is_valid(raise_exception=True)\n\n\nclass TestValidationErrorWithFullDetails(TestCase):\n    def setUp(self):\n        self.DEFAULT_HANDLER = api_settings.EXCEPTION_HANDLER\n\n        def exception_handler(exc, request):\n            data = exc.get_full_details()\n            return Response(data, status=status.HTTP_400_BAD_REQUEST)\n\n        api_settings.EXCEPTION_HANDLER = exception_handler\n\n        self.expected_response_data = {\n            'char': [{\n                'message': 'This field is required.',\n                'code': 'required',\n            }],\n            'integer': [{\n                'message': 'This field is required.',\n                'code': 'required'\n            }],\n        }\n\n    def tearDown(self):\n        api_settings.EXCEPTION_HANDLER = self.DEFAULT_HANDLER\n\n    def test_class_based_view_exception_handler(self):\n        view = ErrorView.as_view()\n\n        request = factory.get('/', content_type='application/json')\n        response = view(request)\n        assert response.status_code == status.HTTP_400_BAD_REQUEST\n        assert response.data == self.expected_response_data\n\n    def test_function_based_view_exception_handler(self):\n        view = error_view\n\n        request = factory.get('/', content_type='application/json')\n        response = view(request)\n        assert response.status_code == status.HTTP_400_BAD_REQUEST\n        assert response.data == self.expected_response_data\n\n\nclass TestValidationErrorWithCodes(TestCase):\n    def setUp(self):\n        self.DEFAULT_HANDLER = api_settings.EXCEPTION_HANDLER\n\n        def exception_handler(exc, request):\n            data = exc.get_codes()\n            return Response(data, status=status.HTTP_400_BAD_REQUEST)\n\n        api_settings.EXCEPTION_HANDLER = exception_handler\n\n        self.expected_response_data = {\n            'char': ['required'],\n            'integer': ['required'],\n        }\n\n    def tearDown(self):\n        api_settings.EXCEPTION_HANDLER = self.DEFAULT_HANDLER\n\n    def test_class_based_view_exception_handler(self):\n        view = ErrorView.as_view()\n\n        request = factory.get('/', content_type='application/json')\n        response = view(request)\n        assert response.status_code == status.HTTP_400_BAD_REQUEST\n        assert response.data == self.expected_response_data\n\n    def test_function_based_view_exception_handler(self):\n        view = error_view\n\n        request = factory.get('/', content_type='application/json')\n        response = view(request)\n        assert response.status_code == status.HTTP_400_BAD_REQUEST\n        assert response.data == self.expected_response_data\n\n\nclass TestValidationErrorConvertsTuplesToLists(TestCase):\n    def test_validation_error_details(self):\n        error = ValidationError(detail=('message1', 'message2'))\n        assert isinstance(error.detail, list)\n        assert len(error.detail) == 2\n        assert str(error.detail[0]) == 'message1'\n        assert str(error.detail[1]) == 'message2'\n"
  },
  {
    "path": "tests/test_validators.py",
    "content": "import datetime\nimport re\nfrom unittest.mock import MagicMock, patch\n\nimport pytest\nfrom django import VERSION as django_version\nfrom django.db import DataError, models\nfrom django.test import TestCase\n\nfrom rest_framework import serializers\nfrom rest_framework.exceptions import ValidationError\nfrom rest_framework.validators import (\n    BaseUniqueForValidator, UniqueTogetherValidator, UniqueValidator, qs_exists\n)\n\n\ndef dedent(blocktext):\n    return '\\n'.join([line[12:] for line in blocktext.splitlines()[1:-1]])\n\n\n# Tests for `UniqueValidator`\n# ---------------------------\n\nclass UniquenessModel(models.Model):\n    username = models.CharField(unique=True, max_length=100)\n\n\nclass UniquenessSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = UniquenessModel\n        fields = '__all__'\n\n\nclass RelatedModel(models.Model):\n    user = models.OneToOneField(UniquenessModel, on_delete=models.CASCADE)\n    email = models.CharField(unique=True, max_length=80)\n\n\nclass RelatedModelSerializer(serializers.ModelSerializer):\n    username = serializers.CharField(source='user.username',\n        validators=[UniqueValidator(queryset=UniquenessModel.objects.all(), lookup='iexact')])  # NOQA\n\n    class Meta:\n        model = RelatedModel\n        fields = ('username', 'email')\n\n\nclass RelatedModelUserSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = RelatedModel\n        fields = ('user',)\n\n\nclass AnotherUniquenessModel(models.Model):\n    code = models.IntegerField(unique=True)\n\n\nclass AnotherUniquenessSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = AnotherUniquenessModel\n        fields = '__all__'\n\n\nclass IntegerFieldModel(models.Model):\n    integer = models.IntegerField()\n\n\nclass UniquenessIntegerSerializer(serializers.Serializer):\n    # Note that this field *deliberately* does not correspond with the model field.\n    # This allows us to ensure that `ValueError`, `TypeError` or `DataError` etc\n    # raised by a uniqueness check does not trigger a deceptive \"this field is not unique\"\n    # validation failure.\n    integer = serializers.CharField(validators=[UniqueValidator(queryset=IntegerFieldModel.objects.all())])\n\n\nclass TestUniquenessValidation(TestCase):\n    def setUp(self):\n        self.instance = UniquenessModel.objects.create(username='existing')\n\n    def test_repr(self):\n        serializer = UniquenessSerializer()\n        expected = dedent(\"\"\"\n            UniquenessSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                username = CharField(max_length=100, validators=[<UniqueValidator(queryset=UniquenessModel.objects.all())>])\n        \"\"\")\n        assert repr(serializer) == expected\n\n    def test_is_not_unique(self):\n        data = {'username': 'existing'}\n        serializer = UniquenessSerializer(data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {'username': ['uniqueness model with this username already exists.']}\n\n    def test_relation_is_not_unique(self):\n        RelatedModel.objects.create(user=self.instance)\n        data = {'user': self.instance.pk}\n        serializer = RelatedModelUserSerializer(data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {'user': ['related model with this user already exists.']}\n\n    def test_is_unique(self):\n        data = {'username': 'other'}\n        serializer = UniquenessSerializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'username': 'other'}\n\n    def test_updated_instance_excluded(self):\n        data = {'username': 'existing'}\n        serializer = UniquenessSerializer(self.instance, data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {'username': 'existing'}\n\n    def test_doesnt_pollute_model(self):\n        instance = AnotherUniquenessModel.objects.create(code='100')\n        serializer = AnotherUniquenessSerializer(instance)\n        assert all(\n            [\"Unique\" not in repr(v) for v in AnotherUniquenessModel._meta.get_field('code').validators]\n        )\n\n        # Accessing data shouldn't effect validators on the model\n        serializer.data\n        assert all(\n            [\"Unique\" not in repr(v) for v in AnotherUniquenessModel._meta.get_field('code').validators]\n        )\n\n    def test_related_model_is_unique(self):\n        data = {'username': 'Existing', 'email': 'new-email@example.com'}\n        rs = RelatedModelSerializer(data=data)\n        assert not rs.is_valid()\n        assert rs.errors == {'username': ['This field must be unique.']}\n        data = {'username': 'new-username', 'email': 'new-email@example.com'}\n        rs = RelatedModelSerializer(data=data)\n        assert rs.is_valid()\n\n    def test_value_error_treated_as_not_unique(self):\n        serializer = UniquenessIntegerSerializer(data={'integer': 'abc'})\n        assert serializer.is_valid()\n\n\n# Tests for `UniqueTogetherValidator`\n# -----------------------------------\n\nclass UniquenessTogetherModel(models.Model):\n    race_name = models.CharField(max_length=100)\n    position = models.IntegerField()\n\n    class Meta:\n        unique_together = ('race_name', 'position')\n\n\nclass NullUniquenessTogetherModel(models.Model):\n    \"\"\"\n    Used to ensure that null values are not included when checking\n    unique_together constraints.\n\n    Ignoring items which have a null in any of the validated fields is the same\n    behavior that database backends will use when they have the\n    unique_together constraint added.\n\n    Example case: a null position could indicate a non-finisher in the race,\n    there could be many non-finishers in a race, but all non-NULL\n    values *should* be unique against the given `race_name`.\n    \"\"\"\n    date_of_birth = models.DateField(null=True)  # Not part of the uniqueness constraint\n    race_name = models.CharField(max_length=100)\n    position = models.IntegerField(null=True)\n\n    class Meta:\n        unique_together = ('race_name', 'position')\n\n\nclass UniquenessTogetherSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = UniquenessTogetherModel\n        fields = '__all__'\n\n\nclass NullUniquenessTogetherSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = NullUniquenessTogetherModel\n        fields = '__all__'\n\n\nclass TestUniquenessTogetherValidation(TestCase):\n    def setUp(self):\n        self.instance = UniquenessTogetherModel.objects.create(\n            race_name='example',\n            position=1\n        )\n        UniquenessTogetherModel.objects.create(\n            race_name='example',\n            position=2\n        )\n        UniquenessTogetherModel.objects.create(\n            race_name='other',\n            position=1\n        )\n\n    def test_repr(self):\n        serializer = UniquenessTogetherSerializer()\n        expected = dedent(r\"\"\"\n            UniquenessTogetherSerializer\\(\\):\n                id = IntegerField\\(label='ID', read_only=True\\)\n                race_name = CharField\\(max_length=100, required=True\\)\n                position = IntegerField\\(.*required=True\\)\n                class Meta:\n                    validators = \\[<UniqueTogetherValidator\\(queryset=UniquenessTogetherModel.objects.all\\(\\), fields=\\('race_name', 'position'\\)\\)>\\]\n        \"\"\")\n        assert re.search(expected, repr(serializer)) is not None\n\n    def test_is_not_unique_together(self):\n        \"\"\"\n        Failing unique together validation should result in non field errors.\n        \"\"\"\n        data = {'race_name': 'example', 'position': 2}\n        serializer = UniquenessTogetherSerializer(data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {\n            'non_field_errors': [\n                'The fields race_name, position must make a unique set.'\n            ]\n        }\n\n    def test_is_unique_together(self):\n        \"\"\"\n        In a unique together validation, one field may be non-unique\n        so long as the set as a whole is unique.\n        \"\"\"\n        data = {'race_name': 'other', 'position': 2}\n        serializer = UniquenessTogetherSerializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'race_name': 'other',\n            'position': 2\n        }\n\n    def test_updated_instance_excluded_from_unique_together(self):\n        \"\"\"\n        When performing an update, the existing instance does not count\n        as a match against uniqueness.\n        \"\"\"\n        data = {'race_name': 'example', 'position': 1}\n        serializer = UniquenessTogetherSerializer(self.instance, data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'race_name': 'example',\n            'position': 1\n        }\n\n    def test_unique_together_is_required(self):\n        \"\"\"\n        In a unique together validation, all fields are required.\n        \"\"\"\n        data = {'position': 2}\n        serializer = UniquenessTogetherSerializer(data=data, partial=True)\n        assert not serializer.is_valid()\n        assert serializer.errors == {\n            'race_name': ['This field is required.']\n        }\n\n    def test_ignore_excluded_fields(self):\n        \"\"\"\n        When model fields are not included in a serializer, then uniqueness\n        validators should not be added for that field.\n        \"\"\"\n        class ExcludedFieldSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = UniquenessTogetherModel\n                fields = ('id', 'race_name',)\n        serializer = ExcludedFieldSerializer()\n        expected = dedent(\"\"\"\n            ExcludedFieldSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                race_name = CharField(max_length=100)\n        \"\"\")\n        assert repr(serializer) == expected\n\n    def test_ignore_read_only_fields(self):\n        \"\"\"\n        When serializer fields are read only, then uniqueness\n        validators should not be added for that field.\n        \"\"\"\n        class ReadOnlyFieldSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = UniquenessTogetherModel\n                fields = ('id', 'race_name', 'position')\n                read_only_fields = ('race_name',)\n\n        serializer = ReadOnlyFieldSerializer()\n        expected = dedent(r\"\"\"\n            ReadOnlyFieldSerializer\\(\\):\n                id = IntegerField\\(label='ID', read_only=True\\)\n                race_name = CharField\\(read_only=True\\)\n                position = IntegerField\\(.*required=True\\)\n        \"\"\")\n        assert re.search(expected, repr(serializer)) is not None\n\n    def test_read_only_fields_with_default(self):\n        \"\"\"\n        Special case of read_only + default DOES validate unique_together.\n        \"\"\"\n        class ReadOnlyFieldWithDefaultSerializer(serializers.ModelSerializer):\n            race_name = serializers.CharField(max_length=100, read_only=True, default='example')\n\n            class Meta:\n                model = UniquenessTogetherModel\n                fields = ('id', 'race_name', 'position')\n\n        data = {'position': 2}\n        serializer = ReadOnlyFieldWithDefaultSerializer(data=data)\n\n        assert len(serializer.validators) == 1\n        assert isinstance(serializer.validators[0], UniqueTogetherValidator)\n        assert serializer.validators[0].fields == ('race_name', 'position')\n        assert not serializer.is_valid()\n        assert serializer.errors == {\n            'non_field_errors': [\n                'The fields race_name, position must make a unique set.'\n            ]\n        }\n\n    def test_read_only_fields_with_default_and_source(self):\n        class ReadOnlySerializer(serializers.ModelSerializer):\n            name = serializers.CharField(source='race_name', default='test', read_only=True)\n\n            class Meta:\n                model = UniquenessTogetherModel\n                fields = ['name', 'position']\n                validators = [\n                    UniqueTogetherValidator(\n                        queryset=UniquenessTogetherModel.objects.all(),\n                        fields=['name', 'position']\n                    )\n                ]\n\n        serializer = ReadOnlySerializer(data={'position': 1})\n        assert serializer.is_valid(raise_exception=True)\n\n    def test_writeable_fields_with_source(self):\n        class WriteableSerializer(serializers.ModelSerializer):\n            name = serializers.CharField(source='race_name')\n\n            class Meta:\n                model = UniquenessTogetherModel\n                fields = ['name', 'position']\n                validators = [\n                    UniqueTogetherValidator(\n                        queryset=UniquenessTogetherModel.objects.all(),\n                        fields=['name', 'position']\n                    )\n                ]\n\n        serializer = WriteableSerializer(data={'name': 'test', 'position': 1})\n        assert serializer.is_valid(raise_exception=True)\n\n        # Validation error should use seriazlier field name, not source\n        serializer = WriteableSerializer(data={'position': 1})\n        assert not serializer.is_valid()\n        assert serializer.errors == {\n            'name': [\n                'This field is required.'\n            ]\n        }\n\n    def test_default_validator_with_fields_with_source(self):\n        class TestSerializer(serializers.ModelSerializer):\n            name = serializers.CharField(source='race_name')\n\n            class Meta:\n                model = UniquenessTogetherModel\n                fields = ['name', 'position']\n\n        serializer = TestSerializer()\n        expected = dedent(r\"\"\"\n            TestSerializer\\(\\):\n                name = CharField\\(source='race_name'\\)\n                position = IntegerField\\(.*\\)\n                class Meta:\n                    validators = \\[<UniqueTogetherValidator\\(queryset=UniquenessTogetherModel.objects.all\\(\\), fields=\\('name', 'position'\\)\\)>\\]\n        \"\"\")\n        assert re.search(expected, repr(serializer)) is not None\n\n    def test_default_validator_with_multiple_fields_with_same_source(self):\n        class TestSerializer(serializers.ModelSerializer):\n            name = serializers.CharField(source='race_name')\n            other_name = serializers.CharField(source='race_name')\n\n            class Meta:\n                model = UniquenessTogetherModel\n                fields = ['name', 'other_name', 'position']\n\n        serializer = TestSerializer(data={\n            'name': 'foo',\n            'other_name': 'foo',\n            'position': 1,\n        })\n        with pytest.raises(AssertionError) as excinfo:\n            serializer.is_valid()\n\n        expected = (\n            \"Unable to create `UniqueTogetherValidator` for \"\n            \"`UniquenessTogetherModel.race_name` as `TestSerializer` has \"\n            \"multiple fields (name, other_name) that map to this model field. \"\n            \"Either remove the extra fields, or override `Meta.validators` \"\n            \"with a `UniqueTogetherValidator` using the desired field names.\")\n        assert str(excinfo.value) == expected\n\n    def test_allow_explicit_override(self):\n        \"\"\"\n        Ensure validators can be explicitly removed..\n        \"\"\"\n        class NoValidatorsSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = UniquenessTogetherModel\n                fields = ('id', 'race_name', 'position')\n                validators = []\n\n        serializer = NoValidatorsSerializer()\n        expected = dedent(r\"\"\"\n            NoValidatorsSerializer\\(\\):\n                id = IntegerField\\(label='ID', read_only=True.*\\)\n                race_name = CharField\\(max_length=100\\)\n                position = IntegerField\\(.*\\)\n        \"\"\")\n        assert re.search(expected, repr(serializer)) is not None\n\n    def test_ignore_validation_for_null_fields(self):\n        # None values that are on fields which are part of the uniqueness\n        # constraint cause the instance to ignore uniqueness validation.\n        NullUniquenessTogetherModel.objects.create(\n            date_of_birth=datetime.date(2000, 1, 1),\n            race_name='Paris Marathon',\n            position=None\n        )\n        data = {\n            'date': datetime.date(2000, 1, 1),\n            'race_name': 'Paris Marathon',\n            'position': None\n        }\n        serializer = NullUniquenessTogetherSerializer(data=data)\n        assert serializer.is_valid()\n\n    def test_ignore_validation_for_missing_nullable_fields(self):\n        data = {\n            'date': datetime.date(2000, 1, 1),\n            'race_name': 'Paris Marathon',\n        }\n        serializer = NullUniquenessTogetherSerializer(data=data)\n        assert serializer.is_valid(), serializer.errors\n\n    def test_do_not_ignore_validation_for_null_fields(self):\n        # None values that are not on fields part of the uniqueness constraint\n        # do not cause the instance to skip validation.\n        NullUniquenessTogetherModel.objects.create(\n            date_of_birth=datetime.date(2000, 1, 1),\n            race_name='Paris Marathon',\n            position=1\n        )\n        data = {'date': None, 'race_name': 'Paris Marathon', 'position': 1}\n        serializer = NullUniquenessTogetherSerializer(data=data)\n        assert not serializer.is_valid()\n\n    def test_ignore_validation_for_unchanged_fields(self):\n        \"\"\"\n        If all fields in the unique together constraint are unchanged,\n        then the instance should skip uniqueness validation.\n        \"\"\"\n        instance = UniquenessTogetherModel.objects.create(\n            race_name=\"Paris Marathon\", position=1\n        )\n        data = {\"race_name\": \"Paris Marathon\", \"position\": 1}\n        serializer = UniquenessTogetherSerializer(data=data, instance=instance)\n        with patch(\n            \"rest_framework.validators.qs_exists\"\n        ) as mock:\n            assert serializer.is_valid()\n            assert not mock.called\n\n    @patch(\"rest_framework.validators.qs_exists\")\n    def test_unique_together_with_source(self, mock_qs_exists):\n        class UniqueTogetherWithSourceSerializer(serializers.ModelSerializer):\n            name = serializers.CharField(source=\"race_name\")\n            pos = serializers.IntegerField(source=\"position\")\n\n            class Meta:\n                model = UniquenessTogetherModel\n                fields = [\"name\", \"pos\"]\n\n        data = {\"name\": \"Paris Marathon\", \"pos\": 1}\n        instance = UniquenessTogetherModel.objects.create(\n            race_name=\"Paris Marathon\", position=1\n        )\n        serializer = UniqueTogetherWithSourceSerializer(data=data)\n        assert not serializer.is_valid()\n        assert mock_qs_exists.called\n        mock_qs_exists.reset_mock()\n        serializer = UniqueTogetherWithSourceSerializer(data=data, instance=instance)\n        assert serializer.is_valid()\n        assert not mock_qs_exists.called\n\n    def test_filter_queryset_do_not_skip_existing_attribute(self):\n        \"\"\"\n        filter_queryset should add value from existing instance attribute\n        if it is not provided in attributes dict\n        \"\"\"\n        class MockQueryset:\n            def filter(self, **kwargs):\n                self.called_with = kwargs\n\n        data = {'race_name': 'bar'}\n        queryset = MockQueryset()\n        serializer = UniquenessTogetherSerializer(instance=self.instance)\n        validator = UniqueTogetherValidator(queryset, fields=('race_name',\n                                                              'position'))\n        validator.filter_queryset(attrs=data, queryset=queryset, serializer=serializer)\n        assert queryset.called_with == {'race_name': 'bar', 'position': 1}\n\n    def test_uniq_together_validation_uses_model_fields_method_field(self):\n        class TestSerializer(serializers.ModelSerializer):\n            position = serializers.SerializerMethodField()\n\n            def get_position(self, obj):\n                return obj.position or 0\n\n            class Meta:\n                model = NullUniquenessTogetherModel\n                fields = ['race_name', 'position']\n\n        serializer = TestSerializer()\n        expected = dedent(\"\"\"\n            TestSerializer():\n                race_name = CharField(max_length=100)\n                position = SerializerMethodField()\n        \"\"\")\n        assert repr(serializer) == expected\n\n    def test_uniq_together_validation_uses_model_fields_with_source_field(self):\n        class TestSerializer(serializers.ModelSerializer):\n            pos = serializers.IntegerField(source='position')\n\n            class Meta:\n                model = NullUniquenessTogetherModel\n                fields = ['race_name', 'pos']\n\n        serializer = TestSerializer()\n        expected = dedent(\"\"\"\n            TestSerializer():\n                race_name = CharField(max_length=100, required=True)\n                pos = IntegerField(source='position')\n                class Meta:\n                    validators = [<UniqueTogetherValidator(queryset=NullUniquenessTogetherModel.objects.all(), fields=('race_name', 'pos'))>]\n        \"\"\")\n        assert repr(serializer) == expected\n\n\nclass UniqueConstraintModel(models.Model):\n    race_name = models.CharField(max_length=100)\n    position = models.IntegerField()\n    global_id = models.IntegerField()\n    fancy_conditions = models.IntegerField()\n\n    class Meta:\n        constraints = [\n            models.UniqueConstraint(\n                name=\"unique_constraint_model_global_id_uniq\",\n                fields=('global_id',),\n            ),\n            models.UniqueConstraint(\n                name=\"unique_constraint_model_fancy_1_uniq\",\n                fields=('fancy_conditions',),\n                condition=models.Q(global_id__lte=1)\n            ),\n            models.UniqueConstraint(\n                name=\"unique_constraint_model_fancy_3_uniq\",\n                fields=('fancy_conditions',),\n                condition=models.Q(global_id__gte=3)\n            ),\n            models.UniqueConstraint(\n                name=\"unique_constraint_model_together_uniq\",\n                fields=('race_name', 'position'),\n                condition=models.Q(race_name='example'),\n            ),\n            models.UniqueConstraint(\n                name='unique_constraint_model_together_uniq2',\n                fields=('race_name', 'position'),\n                condition=models.Q(fancy_conditions__gte=10),\n            ),\n        ]\n\n\nclass UniqueConstraintReadOnlyFieldModel(models.Model):\n    state = models.CharField(max_length=100, default=\"new\")\n    position = models.IntegerField()\n    something = models.IntegerField()\n\n    class Meta:\n        constraints = [\n            models.UniqueConstraint(\n                name=\"unique_constraint_%(class)s\",\n                fields=(\"position\", \"something\"),\n                condition=models.Q(state=\"new\"),\n            ),\n        ]\n\n\nclass UniqueConstraintNullableModel(models.Model):\n    title = models.CharField(max_length=100)\n    age = models.IntegerField(null=True)\n    tag = models.CharField(max_length=100, null=True)\n\n    class Meta:\n        constraints = [\n            # Unique constraint on 2 nullable fields\n            models.UniqueConstraint(name='unique_constraint', fields=('age', 'tag'))\n        ]\n\n\nclass UniqueConstraintCustomMessageCodeModel(models.Model):\n    username = models.CharField(max_length=32)\n    company_id = models.IntegerField()\n    role = models.CharField(max_length=32)\n\n    class Meta:\n        constraints = [\n            models.UniqueConstraint(\n                fields=(\"username\", \"company_id\"),\n                name=\"unique_username_company_custom_msg\",\n                violation_error_message=\"Username must be unique within a company.\",\n                **(dict(violation_error_code=\"duplicate_username\") if django_version[0] >= 5 else {}),\n            ),\n            models.UniqueConstraint(\n                fields=(\"company_id\", \"role\"),\n                name=\"unique_company_role_default_msg\",\n            ),\n        ]\n\n\nclass UniqueConstraintSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = UniqueConstraintModel\n        fields = '__all__'\n\n\nclass UniqueConstraintNullableSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = UniqueConstraintNullableModel\n        fields = ('title', 'age', 'tag')\n\n\nclass UniqueConstraintCustomMessageCodeSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = UniqueConstraintCustomMessageCodeModel\n        fields = ('username', 'company_id', 'role')\n\n\nclass TestUniqueConstraintValidation(TestCase):\n    def setUp(self):\n        self.instance = UniqueConstraintModel.objects.create(\n            race_name='example',\n            position=1,\n            global_id=1,\n            fancy_conditions=1\n        )\n        UniqueConstraintModel.objects.create(\n            race_name='example',\n            position=2,\n            global_id=2,\n            fancy_conditions=1\n        )\n        UniqueConstraintModel.objects.create(\n            race_name='other',\n            position=1,\n            global_id=3,\n            fancy_conditions=1\n        )\n\n    def test_repr(self):\n        serializer = UniqueConstraintSerializer()\n        # the order of validators isn't deterministic so delete\n        # fancy_conditions field that has two of them\n        del serializer.fields['fancy_conditions']\n        expected = dedent(r\"\"\"\n            UniqueConstraintSerializer\\(\\):\n                id = IntegerField\\(label='ID', read_only=True\\)\n                race_name = CharField\\(max_length=100, required=True\\)\n                position = IntegerField\\(.*required=True\\)\n                global_id = IntegerField\\(.*validators=\\[<UniqueValidator\\(queryset=UniqueConstraintModel.objects.all\\(\\)\\)>\\]\\)\n                class Meta:\n                    validators = \\[<UniqueTogetherValidator\\(queryset=UniqueConstraintModel.objects.all\\(\\), fields=\\('race_name', 'position'\\), condition=<Q: \\(AND: \\('race_name', 'example'\\)\\)>\\)>\\]\n        \"\"\")\n        assert re.search(expected, repr(serializer)) is not None\n\n    def test_unique_together_condition(self):\n        \"\"\"\n        Fields used in UniqueConstraint's condition must be included\n        into queryset existence check\n        \"\"\"\n        UniqueConstraintModel.objects.create(\n            race_name='condition',\n            position=1,\n            global_id=10,\n            fancy_conditions=10,\n        )\n        serializer = UniqueConstraintSerializer(data={\n            'race_name': 'condition',\n            'position': 1,\n            'global_id': 11,\n            'fancy_conditions': 9,\n        })\n        assert serializer.is_valid()\n        serializer = UniqueConstraintSerializer(data={\n            'race_name': 'condition',\n            'position': 1,\n            'global_id': 11,\n            'fancy_conditions': 11,\n        })\n        assert not serializer.is_valid()\n\n    def test_unique_together_condition_fields_required(self):\n        \"\"\"\n        Fields used in UniqueConstraint's condition must be present in serializer\n        \"\"\"\n        serializer = UniqueConstraintSerializer(data={\n            'race_name': 'condition',\n            'position': 1,\n            'global_id': 11,\n        })\n        assert not serializer.is_valid()\n        assert serializer.errors == {'fancy_conditions': ['This field is required.']}\n\n        class NoFieldsSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = UniqueConstraintModel\n                fields = ('race_name', 'position', 'global_id')\n\n        serializer = NoFieldsSerializer()\n        assert len(serializer.validators) == 1\n\n    def test_single_field_uniq_validators(self):\n        \"\"\"\n        UniqueConstraint with single field must be transformed into\n        field's UniqueValidator\n        \"\"\"\n        # Django 5 includes Max and Min values validators for IntegerField\n        extra_validators_qty = 2 if django_version[0] >= 5 else 0\n        serializer = UniqueConstraintSerializer()\n        assert len(serializer.validators) == 2\n        validators = serializer.fields['global_id'].validators\n        assert len(validators) == 1 + extra_validators_qty\n        assert validators[0].queryset == UniqueConstraintModel.objects\n\n        validators = serializer.fields['fancy_conditions'].validators\n        assert len(validators) == 2 + extra_validators_qty\n        ids_in_qs = {frozenset(v.queryset.values_list('id', flat=True)) for v in validators if hasattr(v, \"queryset\")}\n        assert ids_in_qs == {frozenset([1]), frozenset([3])}\n\n    def test_nullable_unique_constraint_fields_are_not_required(self):\n        serializer = UniqueConstraintNullableSerializer(data={'title': 'Bob'})\n        self.assertTrue(serializer.is_valid(), serializer.errors)\n        result = serializer.save()\n        self.assertIsInstance(result, UniqueConstraintNullableModel)\n\n    def test_unique_constraint_source(self):\n        class SourceUniqueConstraintSerializer(serializers.ModelSerializer):\n            raceName = serializers.CharField(source=\"race_name\")\n\n            class Meta:\n                model = UniqueConstraintModel\n                fields = (\"raceName\", \"position\", \"global_id\", \"fancy_conditions\")\n\n        serializer = SourceUniqueConstraintSerializer(\n            data={\n                \"raceName\": \"example\",\n                \"position\": 5,\n                \"global_id\": 11,\n                \"fancy_conditions\": 11,\n            }\n        )\n        assert serializer.is_valid()\n\n    def test_uniq_constraint_condition_read_only_create(self):\n        class UniqueConstraintReadOnlyFieldModelSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = UniqueConstraintReadOnlyFieldModel\n                read_only_fields = (\"state\",)\n                fields = (\"position\", \"something\", *read_only_fields)\n        serializer = UniqueConstraintReadOnlyFieldModelSerializer(\n            data={\"position\": 1, \"something\": 1}\n        )\n        assert serializer.is_valid()\n\n    def test_uniq_constraint_condition_read_only_partial(self):\n        class UniqueConstraintReadOnlyFieldModelSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = UniqueConstraintReadOnlyFieldModel\n                read_only_fields = (\"state\",)\n                fields = (\"position\", \"something\", *read_only_fields)\n        instance = UniqueConstraintReadOnlyFieldModel.objects.create(position=1, something=1)\n        serializer = UniqueConstraintReadOnlyFieldModelSerializer(\n            instance=instance,\n            data={\"position\": 1, \"something\": 1},\n            partial=True\n        )\n        assert serializer.is_valid()\n\n    def test_unique_constraint_custom_message_code(self):\n        UniqueConstraintCustomMessageCodeModel.objects.create(username=\"Alice\", company_id=1, role=\"member\")\n        expected_code = \"duplicate_username\" if django_version[0] >= 5 else UniqueTogetherValidator.code\n\n        serializer = UniqueConstraintCustomMessageCodeSerializer(data={\n            \"username\": \"Alice\",\n            \"company_id\": 1,\n            \"role\": \"admin\",\n        })\n        assert not serializer.is_valid()\n        assert serializer.errors == {\"non_field_errors\": [\"Username must be unique within a company.\"]}\n        assert serializer.errors[\"non_field_errors\"][0].code == expected_code\n\n    def test_unique_constraint_default_message_code(self):\n        UniqueConstraintCustomMessageCodeModel.objects.create(username=\"Alice\", company_id=1, role=\"member\")\n        serializer = UniqueConstraintCustomMessageCodeSerializer(data={\n            \"username\": \"John\",\n            \"company_id\": 1,\n            \"role\": \"member\",\n        })\n        expected_message = UniqueTogetherValidator.message.format(field_names=', '.join((\"company_id\", \"role\")))\n        assert not serializer.is_valid()\n        assert serializer.errors == {\"non_field_errors\": [expected_message]}\n        assert serializer.errors[\"non_field_errors\"][0].code == UniqueTogetherValidator.code\n\n\n# Tests for `UniqueForDateValidator`\n# ----------------------------------\n\nclass UniqueForDateModel(models.Model):\n    slug = models.CharField(max_length=100, unique_for_date='published')\n    published = models.DateField()\n\n\nclass UniqueForDateSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = UniqueForDateModel\n        fields = '__all__'\n\n\nclass TestUniquenessForDateValidation(TestCase):\n    def setUp(self):\n        self.instance = UniqueForDateModel.objects.create(\n            slug='existing',\n            published='2000-01-01'\n        )\n\n    def test_repr(self):\n        serializer = UniqueForDateSerializer()\n        expected = dedent(\"\"\"\n            UniqueForDateSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                slug = CharField(max_length=100)\n                published = DateField(required=True)\n                class Meta:\n                    validators = [<UniqueForDateValidator(queryset=UniqueForDateModel.objects.all(), field='slug', date_field='published')>]\n        \"\"\")\n        assert repr(serializer) == expected\n\n    def test_is_not_unique_for_date(self):\n        \"\"\"\n        Failing unique for date validation should result in field error.\n        \"\"\"\n        data = {'slug': 'existing', 'published': '2000-01-01'}\n        serializer = UniqueForDateSerializer(data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {\n            'slug': ['This field must be unique for the \"published\" date.']\n        }\n\n    def test_is_unique_for_date(self):\n        \"\"\"\n        Passing unique for date validation.\n        \"\"\"\n        data = {'slug': 'existing', 'published': '2000-01-02'}\n        serializer = UniqueForDateSerializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'slug': 'existing',\n            'published': datetime.date(2000, 1, 2)\n        }\n\n    def test_updated_instance_excluded_from_unique_for_date(self):\n        \"\"\"\n        When performing an update, the existing instance does not count\n        as a match against unique_for_date.\n        \"\"\"\n        data = {'slug': 'existing', 'published': '2000-01-01'}\n        serializer = UniqueForDateSerializer(instance=self.instance, data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'slug': 'existing',\n            'published': datetime.date(2000, 1, 1)\n        }\n\n# Tests for `UniqueForMonthValidator`\n# ----------------------------------\n\n\nclass UniqueForMonthModel(models.Model):\n    slug = models.CharField(max_length=100, unique_for_month='published')\n    published = models.DateField()\n\n\nclass UniqueForMonthSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = UniqueForMonthModel\n        fields = '__all__'\n\n\nclass UniqueForMonthTests(TestCase):\n\n    def setUp(self):\n        self.instance = UniqueForMonthModel.objects.create(\n            slug='existing', published='2017-01-01'\n        )\n\n    def test_not_unique_for_month(self):\n        data = {'slug': 'existing', 'published': '2017-01-01'}\n        serializer = UniqueForMonthSerializer(data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {\n            'slug': ['This field must be unique for the \"published\" month.']\n        }\n\n    def test_unique_for_month(self):\n        data = {'slug': 'existing', 'published': '2017-02-01'}\n        serializer = UniqueForMonthSerializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'slug': 'existing',\n            'published': datetime.date(2017, 2, 1)\n        }\n\n# Tests for `UniqueForYearValidator`\n# ----------------------------------\n\n\nclass UniqueForYearModel(models.Model):\n    slug = models.CharField(max_length=100, unique_for_year='published')\n    published = models.DateField()\n\n\nclass UniqueForYearSerializer(serializers.ModelSerializer):\n    class Meta:\n        model = UniqueForYearModel\n        fields = '__all__'\n\n\nclass UniqueForYearTests(TestCase):\n\n    def setUp(self):\n        self.instance = UniqueForYearModel.objects.create(\n            slug='existing', published='2017-01-01'\n        )\n\n    def test_not_unique_for_year(self):\n        data = {'slug': 'existing', 'published': '2017-01-01'}\n        serializer = UniqueForYearSerializer(data=data)\n        assert not serializer.is_valid()\n        assert serializer.errors == {\n            'slug': ['This field must be unique for the \"published\" year.']\n        }\n\n    def test_unique_for_year(self):\n        data = {'slug': 'existing', 'published': '2018-01-01'}\n        serializer = UniqueForYearSerializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == {\n            'slug': 'existing',\n            'published': datetime.date(2018, 1, 1)\n        }\n\n\nclass HiddenFieldUniqueForDateModel(models.Model):\n    slug = models.CharField(max_length=100, unique_for_date='published')\n    published = models.DateTimeField(auto_now_add=True)\n\n\nclass TestHiddenFieldUniquenessForDateValidation(TestCase):\n    def test_repr_date_field_not_included(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = HiddenFieldUniqueForDateModel\n                fields = ('id', 'slug')\n\n        serializer = TestSerializer()\n        expected = dedent(\"\"\"\n            TestSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                slug = CharField(max_length=100)\n                published = HiddenField(default=CreateOnlyDefault(<function now>))\n                class Meta:\n                    validators = [<UniqueForDateValidator(queryset=HiddenFieldUniqueForDateModel.objects.all(), field='slug', date_field='published')>]\n        \"\"\")\n        assert repr(serializer) == expected\n\n    def test_repr_date_field_included(self):\n        class TestSerializer(serializers.ModelSerializer):\n            class Meta:\n                model = HiddenFieldUniqueForDateModel\n                fields = ('id', 'slug', 'published')\n\n        serializer = TestSerializer()\n        expected = dedent(\"\"\"\n            TestSerializer():\n                id = IntegerField(label='ID', read_only=True)\n                slug = CharField(max_length=100)\n                published = DateTimeField(default=CreateOnlyDefault(<function now>), read_only=True)\n                class Meta:\n                    validators = [<UniqueForDateValidator(queryset=HiddenFieldUniqueForDateModel.objects.all(), field='slug', date_field='published')>]\n        \"\"\")\n        assert repr(serializer) == expected\n\n\nclass ValidatorsTests(TestCase):\n\n    def test_qs_exists_handles_type_error(self):\n        class TypeErrorQueryset:\n            def exists(self):\n                raise TypeError\n        assert qs_exists(TypeErrorQueryset()) is False\n\n    def test_qs_exists_handles_value_error(self):\n        class ValueErrorQueryset:\n            def exists(self):\n                raise ValueError\n        assert qs_exists(ValueErrorQueryset()) is False\n\n    def test_qs_exists_handles_data_error(self):\n        class DataErrorQueryset:\n            def exists(self):\n                raise DataError\n        assert qs_exists(DataErrorQueryset()) is False\n\n    def test_validator_raises_error_if_not_all_fields_are_provided(self):\n        validator = BaseUniqueForValidator(queryset=object(), field='foo',\n                                           date_field='bar')\n        attrs = {'foo': 'baz'}\n        with pytest.raises(ValidationError):\n            validator.enforce_required_fields(attrs)\n\n    def test_validator_raises_error_when_abstract_method_called(self):\n        validator = BaseUniqueForValidator(queryset=object(), field='foo',\n                                           date_field='bar')\n        with pytest.raises(NotImplementedError):\n            validator.filter_queryset(\n                attrs=None, queryset=None, field_name='', date_field_name=''\n            )\n\n    def test_equality_operator(self):\n        mock_queryset = MagicMock()\n        validator = BaseUniqueForValidator(queryset=mock_queryset, field='foo',\n                                           date_field='bar')\n        validator2 = BaseUniqueForValidator(queryset=mock_queryset, field='foo',\n                                            date_field='bar')\n        assert validator == validator2\n        validator2.date_field = \"bar2\"\n        assert validator != validator2\n"
  },
  {
    "path": "tests/test_versioning.py",
    "content": "import pytest\nfrom django.test import override_settings\nfrom django.urls import ResolverMatch, include, path, re_path\n\nfrom rest_framework import serializers, status, versioning\nfrom rest_framework.decorators import APIView\nfrom rest_framework.relations import PKOnlyObject\nfrom rest_framework.response import Response\nfrom rest_framework.reverse import reverse\nfrom rest_framework.test import (\n    APIRequestFactory, APITestCase, URLPatternsTestCase\n)\nfrom rest_framework.versioning import NamespaceVersioning\n\n\nclass RequestVersionView(APIView):\n    def get(self, request, *args, **kwargs):\n        return Response({'version': request.version})\n\n\nclass ReverseView(APIView):\n    def get(self, request, *args, **kwargs):\n        return Response({'url': reverse('another', request=request)})\n\n\nclass AllowedVersionsView(RequestVersionView):\n    def determine_version(self, request, *args, **kwargs):\n        scheme = self.versioning_class()\n        scheme.allowed_versions = ('v1', 'v2')\n        return (scheme.determine_version(request, *args, **kwargs), scheme)\n\n\nclass AllowedAndDefaultVersionsView(RequestVersionView):\n    def determine_version(self, request, *args, **kwargs):\n        scheme = self.versioning_class()\n        scheme.allowed_versions = ('v1', 'v2')\n        scheme.default_version = 'v2'\n        return (scheme.determine_version(request, *args, **kwargs), scheme)\n\n\nclass AllowedWithNoneVersionsView(RequestVersionView):\n    def determine_version(self, request, *args, **kwargs):\n        scheme = self.versioning_class()\n        scheme.allowed_versions = ('v1', 'v2', None)\n        return (scheme.determine_version(request, *args, **kwargs), scheme)\n\n\nclass AllowedWithNoneAndDefaultVersionsView(RequestVersionView):\n    def determine_version(self, request, *args, **kwargs):\n        scheme = self.versioning_class()\n        scheme.allowed_versions = ('v1', 'v2', None)\n        scheme.default_version = 'v2'\n        return (scheme.determine_version(request, *args, **kwargs), scheme)\n\n\nfactory = APIRequestFactory()\n\n\ndef dummy_view(request):\n    pass\n\n\ndef dummy_pk_view(request, pk):\n    pass\n\n\nclass TestRequestVersion:\n    def test_unversioned(self):\n        view = RequestVersionView.as_view()\n\n        request = factory.get('/endpoint/')\n        response = view(request)\n        assert response.data == {'version': None}\n\n    def test_query_param_versioning(self):\n        scheme = versioning.QueryParameterVersioning\n        view = RequestVersionView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/?version=1.2.3')\n        response = view(request)\n        assert response.data == {'version': '1.2.3'}\n\n        request = factory.get('/endpoint/')\n        response = view(request)\n        assert response.data == {'version': None}\n\n    @override_settings(ALLOWED_HOSTS=['*'])\n    def test_host_name_versioning(self):\n        scheme = versioning.HostNameVersioning\n        view = RequestVersionView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/', HTTP_HOST='v1.example.org')\n        response = view(request)\n        assert response.data == {'version': 'v1'}\n\n        request = factory.get('/endpoint/')\n        response = view(request)\n        assert response.data == {'version': None}\n\n    def test_accept_header_versioning(self):\n        scheme = versioning.AcceptHeaderVersioning\n        view = RequestVersionView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/', HTTP_ACCEPT='application/json; version=1.2.3')\n        response = view(request)\n        assert response.data == {'version': '1.2.3'}\n\n        request = factory.get('/endpoint/', HTTP_ACCEPT='*/*; version=1.2.3')\n        response = view(request)\n        assert response.data == {'version': '1.2.3'}\n\n        request = factory.get('/endpoint/', HTTP_ACCEPT='application/json')\n        response = view(request)\n        assert response.data == {'version': None}\n\n    def test_url_path_versioning(self):\n        scheme = versioning.URLPathVersioning\n        view = RequestVersionView.as_view(versioning_class=scheme)\n\n        request = factory.get('/1.2.3/endpoint/')\n        response = view(request, version='1.2.3')\n        assert response.data == {'version': '1.2.3'}\n\n        request = factory.get('/endpoint/')\n        response = view(request)\n        assert response.data == {'version': None}\n\n    def test_namespace_versioning(self):\n        class FakeResolverMatch(ResolverMatch):\n            namespace = 'v1'\n\n        scheme = versioning.NamespaceVersioning\n        view = RequestVersionView.as_view(versioning_class=scheme)\n\n        request = factory.get('/v1/endpoint/')\n        request.resolver_match = FakeResolverMatch\n        response = view(request, version='v1')\n        assert response.data == {'version': 'v1'}\n\n        request = factory.get('/endpoint/')\n        response = view(request)\n        assert response.data == {'version': None}\n\n\nclass TestURLReversing(URLPatternsTestCase, APITestCase):\n    included = [\n        path('namespaced/', dummy_view, name='another'),\n        path('example/<int:pk>/', dummy_pk_view, name='example-detail')\n    ]\n\n    urlpatterns = [\n        path('v1/', include((included, 'v1'), namespace='v1')),\n        path('another/', dummy_view, name='another'),\n        re_path(r'^(?P<version>[v1|v2]+)/another/$', dummy_view, name='another'),\n        re_path(r'^(?P<foo>.+)/unversioned/$', dummy_view, name='unversioned'),\n\n    ]\n\n    def test_reverse_unversioned(self):\n        view = ReverseView.as_view()\n\n        request = factory.get('/endpoint/')\n        response = view(request)\n        assert response.data == {'url': 'http://testserver/another/'}\n\n    def test_reverse_query_param_versioning(self):\n        scheme = versioning.QueryParameterVersioning\n        view = ReverseView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/?version=v1')\n        response = view(request)\n        assert response.data == {'url': 'http://testserver/another/?version=v1'}\n\n        request = factory.get('/endpoint/')\n        response = view(request)\n        assert response.data == {'url': 'http://testserver/another/'}\n\n    @override_settings(ALLOWED_HOSTS=['*'])\n    def test_reverse_host_name_versioning(self):\n        scheme = versioning.HostNameVersioning\n        view = ReverseView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/', HTTP_HOST='v1.example.org')\n        response = view(request)\n        assert response.data == {'url': 'http://v1.example.org/another/'}\n\n        request = factory.get('/endpoint/')\n        response = view(request)\n        assert response.data == {'url': 'http://testserver/another/'}\n\n    def test_reverse_url_path_versioning(self):\n        scheme = versioning.URLPathVersioning\n        view = ReverseView.as_view(versioning_class=scheme)\n\n        request = factory.get('/v1/endpoint/')\n        response = view(request, version='v1')\n        assert response.data == {'url': 'http://testserver/v1/another/'}\n\n        request = factory.get('/endpoint/')\n        response = view(request)\n        assert response.data == {'url': 'http://testserver/another/'}\n\n        # Test fallback when kwargs is not None\n        request = factory.get('/v1/endpoint/')\n        request.versioning_scheme = scheme()\n        request.version = 'v1'\n\n        reversed_url = reverse('unversioned', request=request, kwargs={'foo': 'bar'})\n        assert reversed_url == 'http://testserver/bar/unversioned/'\n\n    def test_reverse_namespace_versioning(self):\n        class FakeResolverMatch(ResolverMatch):\n            namespace = 'v1'\n\n        scheme = versioning.NamespaceVersioning\n        view = ReverseView.as_view(versioning_class=scheme)\n\n        request = factory.get('/v1/endpoint/')\n        request.resolver_match = FakeResolverMatch\n        response = view(request, version='v1')\n        assert response.data == {'url': 'http://testserver/v1/namespaced/'}\n\n        request = factory.get('/endpoint/')\n        response = view(request)\n        assert response.data == {'url': 'http://testserver/another/'}\n\n\nclass TestInvalidVersion:\n    def test_invalid_query_param_versioning(self):\n        scheme = versioning.QueryParameterVersioning\n        view = AllowedVersionsView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/?version=v3')\n        response = view(request)\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n\n    @override_settings(ALLOWED_HOSTS=['*'])\n    def test_invalid_host_name_versioning(self):\n        scheme = versioning.HostNameVersioning\n        view = AllowedVersionsView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/', HTTP_HOST='v3.example.org')\n        response = view(request)\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n\n    def test_invalid_accept_header_versioning(self):\n        scheme = versioning.AcceptHeaderVersioning\n        view = AllowedVersionsView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/', HTTP_ACCEPT='application/json; version=v3')\n        response = view(request)\n        assert response.status_code == status.HTTP_406_NOT_ACCEPTABLE\n\n    def test_invalid_url_path_versioning(self):\n        scheme = versioning.URLPathVersioning\n        view = AllowedVersionsView.as_view(versioning_class=scheme)\n\n        request = factory.get('/v3/endpoint/')\n        response = view(request, version='v3')\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n\n    def test_invalid_namespace_versioning(self):\n        class FakeResolverMatch(ResolverMatch):\n            namespace = 'v3'\n\n        scheme = versioning.NamespaceVersioning\n        view = AllowedVersionsView.as_view(versioning_class=scheme)\n\n        request = factory.get('/v3/endpoint/')\n        request.resolver_match = FakeResolverMatch\n        response = view(request, version='v3')\n        assert response.status_code == status.HTTP_404_NOT_FOUND\n\n\nclass TestAllowedAndDefaultVersion:\n    def test_missing_without_default(self):\n        scheme = versioning.AcceptHeaderVersioning\n        view = AllowedVersionsView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/', HTTP_ACCEPT='application/json')\n        response = view(request)\n        assert response.status_code == status.HTTP_406_NOT_ACCEPTABLE\n\n    def test_missing_with_default(self):\n        scheme = versioning.AcceptHeaderVersioning\n        view = AllowedAndDefaultVersionsView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/', HTTP_ACCEPT='application/json')\n        response = view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {'version': 'v2'}\n\n    def test_with_default(self):\n        scheme = versioning.AcceptHeaderVersioning\n        view = AllowedAndDefaultVersionsView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/',\n                              HTTP_ACCEPT='application/json; version=v2')\n        response = view(request)\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_missing_without_default_but_none_allowed(self):\n        scheme = versioning.AcceptHeaderVersioning\n        view = AllowedWithNoneVersionsView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/', HTTP_ACCEPT='application/json')\n        response = view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {'version': None}\n\n    def test_missing_with_default_and_none_allowed(self):\n        scheme = versioning.AcceptHeaderVersioning\n        view = AllowedWithNoneAndDefaultVersionsView.as_view(versioning_class=scheme)\n\n        request = factory.get('/endpoint/', HTTP_ACCEPT='application/json')\n        response = view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {'version': 'v2'}\n\n\nclass TestHyperlinkedRelatedField(URLPatternsTestCase, APITestCase):\n    included = [\n        path('namespaced/<int:pk>/', dummy_pk_view, name='namespaced'),\n    ]\n\n    urlpatterns = [\n        path('v1/', include((included, 'v1'), namespace='v1')),\n        path('v2/', include((included, 'v2'), namespace='v2'))\n    ]\n\n    def setUp(self):\n        super().setUp()\n\n        class MockQueryset:\n            def get(self, pk):\n                return 'object %s' % pk\n\n        self.field = serializers.HyperlinkedRelatedField(\n            view_name='namespaced',\n            queryset=MockQueryset()\n        )\n        request = factory.get('/')\n        request.versioning_scheme = NamespaceVersioning()\n        request.version = 'v1'\n        self.field._context = {'request': request}\n\n    def test_bug_2489(self):\n        assert self.field.to_internal_value('/v1/namespaced/3/') == 'object 3'\n        with pytest.raises(serializers.ValidationError):\n            self.field.to_internal_value('/v2/namespaced/3/')\n\n\nclass TestNamespaceVersioningHyperlinkedRelatedFieldScheme(URLPatternsTestCase, APITestCase):\n    nested = [\n        path('namespaced/<int:pk>/', dummy_pk_view, name='nested'),\n    ]\n    included = [\n        path('namespaced/<int:pk>/', dummy_pk_view, name='namespaced'),\n        path('nested/', include((nested, 'nested-namespace'), namespace='nested-namespace'))\n    ]\n\n    urlpatterns = [\n        path('v1/', include((included, 'restframeworkv1'), namespace='v1')),\n        path('v2/', include((included, 'restframeworkv2'), namespace='v2')),\n        path('non-api/<int:pk>/', dummy_pk_view, name='non-api-view')\n    ]\n\n    def _create_field(self, view_name, version):\n        request = factory.get(\"/\")\n        request.versioning_scheme = NamespaceVersioning()\n        request.version = version\n\n        field = serializers.HyperlinkedRelatedField(\n            view_name=view_name,\n            read_only=True)\n        field._context = {'request': request}\n        return field\n\n    def test_api_url_is_properly_reversed_with_v1(self):\n        field = self._create_field('namespaced', 'v1')\n        assert field.to_representation(PKOnlyObject(3)) == 'http://testserver/v1/namespaced/3/'\n\n    def test_api_url_is_properly_reversed_with_v2(self):\n        field = self._create_field('namespaced', 'v2')\n        assert field.to_representation(PKOnlyObject(5)) == 'http://testserver/v2/namespaced/5/'\n\n    def test_api_url_is_properly_reversed_with_nested(self):\n        field = self._create_field('nested', 'v1:nested-namespace')\n        assert field.to_representation(PKOnlyObject(3)) == 'http://testserver/v1/nested/namespaced/3/'\n\n    def test_non_api_url_is_properly_reversed_regardless_of_the_version(self):\n        \"\"\"\n        Regression test for #2711\n        \"\"\"\n        field = self._create_field('non-api-view', 'v1')\n        assert field.to_representation(PKOnlyObject(10)) == 'http://testserver/non-api/10/'\n\n        field = self._create_field('non-api-view', 'v2')\n        assert field.to_representation(PKOnlyObject(10)) == 'http://testserver/non-api/10/'\n"
  },
  {
    "path": "tests/test_views.py",
    "content": "import copy\nimport unittest\n\nfrom django import VERSION as DJANGO_VERSION\nfrom django.test import TestCase\n\nfrom rest_framework import status\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\nfrom rest_framework.settings import APISettings, api_settings\nfrom rest_framework.test import APIRequestFactory\nfrom rest_framework.views import APIView\n\nfactory = APIRequestFactory()\n\nJSON_ERROR = 'JSON parse error - Expecting value:'\n\n\nclass BasicView(APIView):\n    def get(self, request, *args, **kwargs):\n        return Response({'method': 'GET'})\n\n    def post(self, request, *args, **kwargs):\n        return Response({'method': 'POST', 'data': request.data})\n\n\n@api_view(['GET', 'POST', 'PUT', 'PATCH'])\ndef basic_view(request):\n    if request.method == 'GET':\n        return {'method': 'GET'}\n    elif request.method == 'POST':\n        return {'method': 'POST', 'data': request.data}\n    elif request.method == 'PUT':\n        return {'method': 'PUT', 'data': request.data}\n    elif request.method == 'PATCH':\n        return {'method': 'PATCH', 'data': request.data}\n\n\nclass ErrorView(APIView):\n    def get(self, request, *args, **kwargs):\n        raise Exception\n\n\ndef custom_handler(exc, context):\n    if isinstance(exc, SyntaxError):\n        return Response({'error': 'SyntaxError'}, status=400)\n    return Response({'error': 'UnknownError'}, status=500)\n\n\nclass OverriddenSettingsView(APIView):\n    settings = APISettings({'EXCEPTION_HANDLER': custom_handler})\n\n    def get(self, request, *args, **kwargs):\n        raise SyntaxError('request is invalid syntax')\n\n\n@api_view(['GET'])\ndef error_view(request):\n    raise Exception\n\n\ndef sanitise_json_error(error_dict):\n    \"\"\"\n    Exact contents of JSON error messages depend on the installed version\n    of json.\n    \"\"\"\n    ret = copy.copy(error_dict)\n    chop = len(JSON_ERROR)\n    ret['detail'] = ret['detail'][:chop]\n    return ret\n\n\nclass ClassBasedViewIntegrationTests(TestCase):\n    def setUp(self):\n        self.view = BasicView.as_view()\n\n    def test_400_parse_error(self):\n        request = factory.post('/', 'f00bar', content_type='application/json')\n        response = self.view(request)\n        expected = {\n            'detail': JSON_ERROR\n        }\n        assert response.status_code == status.HTTP_400_BAD_REQUEST\n        assert sanitise_json_error(response.data) == expected\n\n\nclass FunctionBasedViewIntegrationTests(TestCase):\n    def setUp(self):\n        self.view = basic_view\n\n    def test_400_parse_error(self):\n        request = factory.post('/', 'f00bar', content_type='application/json')\n        response = self.view(request)\n        expected = {\n            'detail': JSON_ERROR\n        }\n        assert response.status_code == status.HTTP_400_BAD_REQUEST\n        assert sanitise_json_error(response.data) == expected\n\n\nclass TestCustomExceptionHandler(TestCase):\n    def setUp(self):\n        self.DEFAULT_HANDLER = api_settings.EXCEPTION_HANDLER\n\n        def exception_handler(exc, request):\n            return Response('Error!', status=status.HTTP_400_BAD_REQUEST)\n\n        api_settings.EXCEPTION_HANDLER = exception_handler\n\n    def tearDown(self):\n        api_settings.EXCEPTION_HANDLER = self.DEFAULT_HANDLER\n\n    def test_class_based_view_exception_handler(self):\n        view = ErrorView.as_view()\n\n        request = factory.get('/', content_type='application/json')\n        response = view(request)\n        expected = 'Error!'\n        assert response.status_code == status.HTTP_400_BAD_REQUEST\n        assert response.data == expected\n\n    def test_function_based_view_exception_handler(self):\n        view = error_view\n\n        request = factory.get('/', content_type='application/json')\n        response = view(request)\n        expected = 'Error!'\n        assert response.status_code == status.HTTP_400_BAD_REQUEST\n        assert response.data == expected\n\n\nclass TestCustomSettings(TestCase):\n    def setUp(self):\n        self.view = OverriddenSettingsView.as_view()\n\n    def test_get_exception_handler(self):\n        request = factory.get('/', content_type='application/json')\n        response = self.view(request)\n        assert response.status_code == 400\n        assert response.data == {'error': 'SyntaxError'}\n\n\n@unittest.skipUnless(DJANGO_VERSION >= (5, 1), 'Only for Django 5.1+')\nclass TestLoginRequiredMiddlewareCompat(TestCase):\n    def test_class_based_view_opted_out(self):\n        class_based_view = BasicView.as_view()\n        assert class_based_view.login_required is False\n\n    def test_function_based_view_opted_out(self):\n        assert basic_view.login_required is False\n"
  },
  {
    "path": "tests/test_viewsets.py",
    "content": "import unittest\nfrom functools import wraps\n\nimport pytest\nfrom django import VERSION as DJANGO_VERSION\nfrom django.db import models\nfrom django.test import TestCase, override_settings\nfrom django.urls import include, path\n\nfrom rest_framework import status\nfrom rest_framework.decorators import action\nfrom rest_framework.response import Response\nfrom rest_framework.routers import SimpleRouter\nfrom rest_framework.test import APIRequestFactory\nfrom rest_framework.viewsets import GenericViewSet\n\nfactory = APIRequestFactory()\n\n\nclass BasicViewSet(GenericViewSet):\n    def list(self, request, *args, **kwargs):\n        return Response({'ACTION': 'LIST'})\n\n\nclass InstanceViewSet(GenericViewSet):\n\n    def dispatch(self, request, *args, **kwargs):\n        return self.dummy(request, *args, **kwargs)\n\n    def dummy(self, request, *args, **kwargs):\n        return Response({'view': self})\n\n\nclass Action(models.Model):\n    pass\n\n\ndef decorate(fn):\n    @wraps(fn)\n    def wrapper(self, request, *args, **kwargs):\n        return fn(self, request, *args, **kwargs)\n    return wrapper\n\n\nclass ActionViewSet(GenericViewSet):\n    queryset = Action.objects.all()\n\n    def list(self, request, *args, **kwargs):\n        response = Response()\n        response.view = self\n        return response\n\n    def retrieve(self, request, *args, **kwargs):\n        response = Response()\n        response.view = self\n        return response\n\n    @action(detail=False)\n    def list_action(self, request, *args, **kwargs):\n        response = Response()\n        response.view = self\n        return response\n\n    @action(detail=False, url_name='list-custom')\n    def custom_list_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n    @action(detail=True)\n    def detail_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n    @action(detail=True, url_name='detail-custom')\n    def custom_detail_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n    @action(detail=True, url_path=r'unresolvable/(?P<arg>\\w+)', url_name='unresolvable')\n    def unresolvable_detail_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n    @action(detail=False)\n    @decorate\n    def wrapped_list_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n    @action(detail=True)\n    @decorate\n    def wrapped_detail_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n\nclass ActionNamesViewSet(GenericViewSet):\n\n    def retrieve(self, request, *args, **kwargs):\n        response = Response()\n        response.view = self\n        return response\n\n    @action(detail=True)\n    def unnamed_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n    @action(detail=True, name='Custom Name')\n    def named_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n    @action(detail=True, suffix='Custom Suffix')\n    def suffixed_action(self, request, *args, **kwargs):\n        raise NotImplementedError\n\n\nclass ThingWithMapping:\n    def __init__(self):\n        self.mapping = {}\n\n\nclass ActionViewSetWithMapping(ActionViewSet):\n    mapper = ThingWithMapping()\n\n\nrouter = SimpleRouter()\nrouter.register(r'actions', ActionViewSet)\nrouter.register(r'actions-alt', ActionViewSet, basename='actions-alt')\nrouter.register(r'names', ActionNamesViewSet, basename='names')\nrouter.register(r'mapping', ActionViewSetWithMapping, basename='mapping')\n\n\nurlpatterns = [\n    path('api/', include(router.urls)),\n]\n\n\nclass InitializeViewSetsTestCase(TestCase):\n    def test_initialize_view_set_with_actions(self):\n        request = factory.get('/', '', content_type='application/json')\n        my_view = BasicViewSet.as_view(actions={\n            'get': 'list',\n        })\n\n        response = my_view(request)\n        assert response.status_code == status.HTTP_200_OK\n        assert response.data == {'ACTION': 'LIST'}\n\n    def test_head_request_against_viewset(self):\n        request = factory.head('/', '', content_type='application/json')\n        my_view = BasicViewSet.as_view(actions={\n            'get': 'list',\n        })\n\n        response = my_view(request)\n        assert response.status_code == status.HTTP_200_OK\n\n    def test_initialize_view_set_with_empty_actions(self):\n        with pytest.raises(TypeError) as excinfo:\n            BasicViewSet.as_view()\n\n        assert str(excinfo.value) == (\n            \"The `actions` argument must be provided \"\n            \"when calling `.as_view()` on a ViewSet. \"\n            \"For example `.as_view({'get': 'list'})`\")\n\n    def test_initialize_view_set_with_both_name_and_suffix(self):\n        with pytest.raises(TypeError) as excinfo:\n            BasicViewSet.as_view(name='', suffix='', actions={\n                'get': 'list',\n            })\n\n        assert str(excinfo.value) == (\n            \"BasicViewSet() received both `name` and `suffix`, \"\n            \"which are mutually exclusive arguments.\")\n\n    def test_args_kwargs_request_action_map_on_self(self):\n        \"\"\"\n        Test a view only has args, kwargs, request, action_map\n        once `as_view` has been called.\n        \"\"\"\n        bare_view = InstanceViewSet()\n        view = InstanceViewSet.as_view(actions={\n            'get': 'dummy',\n        })(factory.get('/')).data['view']\n\n        for attribute in ('args', 'kwargs', 'request', 'action_map'):\n            self.assertNotIn(attribute, dir(bare_view))\n            self.assertIn(attribute, dir(view))\n\n    def test_viewset_action_attr(self):\n        view = ActionViewSet.as_view(actions={'get': 'list'})\n\n        get = view(factory.get('/'))\n        head = view(factory.head('/'))\n        assert get.view.action == 'list'\n        assert head.view.action == 'list'\n\n    def test_viewset_action_attr_for_extra_action(self):\n        view = ActionViewSet.as_view(actions=dict(ActionViewSet.list_action.mapping))\n\n        get = view(factory.get('/'))\n        head = view(factory.head('/'))\n        assert get.view.action == 'list_action'\n        assert head.view.action == 'list_action'\n\n    @unittest.skipUnless(DJANGO_VERSION >= (5, 1), 'Only for Django 5.1+')\n    def test_login_required_middleware_compat(self):\n        view = ActionViewSet.as_view(actions={'get': 'list'})\n        assert view.login_required is False\n\n\nclass GetExtraActionsTests(TestCase):\n\n    def test_extra_actions(self):\n        view = ActionViewSet()\n        actual = [action.__name__ for action in view.get_extra_actions()]\n        expected = [\n            'custom_detail_action',\n            'custom_list_action',\n            'detail_action',\n            'list_action',\n            'unresolvable_detail_action',\n            'wrapped_detail_action',\n            'wrapped_list_action',\n        ]\n\n        self.assertEqual(actual, expected)\n\n    def test_should_only_return_decorated_methods(self):\n        view = ActionViewSetWithMapping()\n        actual = [action.__name__ for action in view.get_extra_actions()]\n        expected = [\n            'custom_detail_action',\n            'custom_list_action',\n            'detail_action',\n            'list_action',\n            'unresolvable_detail_action',\n            'wrapped_detail_action',\n            'wrapped_list_action',\n        ]\n        self.assertEqual(actual, expected)\n\n    def test_attr_name_check(self):\n        def decorate(fn):\n            def wrapper(self, request, *args, **kwargs):\n                return fn(self, request, *args, **kwargs)\n            return wrapper\n\n        class ActionViewSet(GenericViewSet):\n            queryset = Action.objects.all()\n\n            @action(detail=False)\n            @decorate\n            def wrapped_list_action(self, request, *args, **kwargs):\n                raise NotImplementedError\n\n        view = ActionViewSet()\n        with pytest.raises(AssertionError) as excinfo:\n            view.get_extra_actions()\n\n        assert str(excinfo.value) == (\n            'Expected function (`wrapper`) to match its attribute name '\n            '(`wrapped_list_action`). If using a decorator, ensure the inner '\n            'function is decorated with `functools.wraps`, or that '\n            '`wrapper.__name__` is otherwise set to `wrapped_list_action`.')\n\n\n@override_settings(ROOT_URLCONF='tests.test_viewsets')\nclass GetExtraActionUrlMapTests(TestCase):\n\n    def test_list_view(self):\n        response = self.client.get('/api/actions/')\n        view = response.view\n\n        expected = {\n            'Custom list action': 'http://testserver/api/actions/custom_list_action/',\n            'List action': 'http://testserver/api/actions/list_action/',\n            'Wrapped list action': 'http://testserver/api/actions/wrapped_list_action/',\n        }\n\n        self.assertEqual(view.get_extra_action_url_map(), expected)\n\n    def test_detail_view(self):\n        response = self.client.get('/api/actions/1/')\n        view = response.view\n\n        expected = {\n            'Custom detail action': 'http://testserver/api/actions/1/custom_detail_action/',\n            'Detail action': 'http://testserver/api/actions/1/detail_action/',\n            'Wrapped detail action': 'http://testserver/api/actions/1/wrapped_detail_action/',\n            # \"Unresolvable detail action\" excluded, since it's not resolvable\n        }\n\n        self.assertEqual(view.get_extra_action_url_map(), expected)\n\n    def test_uninitialized_view(self):\n        self.assertEqual(ActionViewSet().get_extra_action_url_map(), {})\n\n    def test_action_names(self):\n        # Action 'name' and 'suffix' kwargs should be respected\n        response = self.client.get('/api/names/1/')\n        view = response.view\n\n        expected = {\n            'Custom Name': 'http://testserver/api/names/1/named_action/',\n            'Action Names Custom Suffix': 'http://testserver/api/names/1/suffixed_action/',\n            'Unnamed action': 'http://testserver/api/names/1/unnamed_action/',\n        }\n\n        self.assertEqual(view.get_extra_action_url_map(), expected)\n\n\n@override_settings(ROOT_URLCONF='tests.test_viewsets')\nclass ReverseActionTests(TestCase):\n    def test_default_basename(self):\n        view = ActionViewSet()\n        view.basename = router.get_default_basename(ActionViewSet)\n        view.request = None\n\n        assert view.reverse_action('list') == '/api/actions/'\n        assert view.reverse_action('list-action') == '/api/actions/list_action/'\n        assert view.reverse_action('list-custom') == '/api/actions/custom_list_action/'\n\n        assert view.reverse_action('detail', args=['1']) == '/api/actions/1/'\n        assert view.reverse_action('detail-action', args=['1']) == '/api/actions/1/detail_action/'\n        assert view.reverse_action('detail-custom', args=['1']) == '/api/actions/1/custom_detail_action/'\n\n    def test_custom_basename(self):\n        view = ActionViewSet()\n        view.basename = 'actions-alt'\n        view.request = None\n\n        assert view.reverse_action('list') == '/api/actions-alt/'\n        assert view.reverse_action('list-action') == '/api/actions-alt/list_action/'\n        assert view.reverse_action('list-custom') == '/api/actions-alt/custom_list_action/'\n\n        assert view.reverse_action('detail', args=['1']) == '/api/actions-alt/1/'\n        assert view.reverse_action('detail-action', args=['1']) == '/api/actions-alt/1/detail_action/'\n        assert view.reverse_action('detail-custom', args=['1']) == '/api/actions-alt/1/custom_detail_action/'\n\n    def test_request_passing(self):\n        view = ActionViewSet()\n        view.basename = router.get_default_basename(ActionViewSet)\n        view.request = factory.get('/')\n\n        # Passing the view's request object should result in an absolute URL.\n        assert view.reverse_action('list') == 'http://testserver/api/actions/'\n\n        # Users should be able to explicitly not pass the view's request.\n        assert view.reverse_action('list', request=None) == '/api/actions/'\n"
  },
  {
    "path": "tests/test_write_only_fields.py",
    "content": "from django.test import TestCase\n\nfrom rest_framework import serializers\n\n\nclass WriteOnlyFieldTests(TestCase):\n    def setUp(self):\n        class ExampleSerializer(serializers.Serializer):\n            email = serializers.EmailField()\n            password = serializers.CharField(write_only=True)\n\n        self.Serializer = ExampleSerializer\n\n    def test_write_only_fields_are_present_on_input(self):\n        data = {\n            'email': 'foo@example.com',\n            'password': '123'\n        }\n        serializer = self.Serializer(data=data)\n        assert serializer.is_valid()\n        assert serializer.validated_data == data\n\n    def test_write_only_fields_are_not_present_on_output(self):\n        instance = {\n            'email': 'foo@example.com',\n            'password': '123'\n        }\n        serializer = self.Serializer(instance)\n        assert serializer.data == {'email': 'foo@example.com'}\n"
  },
  {
    "path": "tests/urls.py",
    "content": "urlpatterns = []\n"
  },
  {
    "path": "tests/utils.py",
    "content": "from operator import attrgetter\n\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.urls import NoReverseMatch\n\n\nclass MockObject:\n    def __init__(self, **kwargs):\n        self._kwargs = kwargs\n        for key, val in kwargs.items():\n            setattr(self, key, val)\n\n    def __str__(self):\n        kwargs_str = ', '.join([\n            '%s=%s' % (key, value)\n            for key, value in sorted(self._kwargs.items())\n        ])\n        return '<MockObject %s>' % kwargs_str\n\n\nclass MockQueryset:\n    def __init__(self, iterable):\n        self.items = iterable\n\n    def __getitem__(self, val):\n        return self.items[val]\n\n    def get(self, **lookup):\n        for item in self.items:\n            if all([\n                attrgetter(key.replace('__', '.'))(item) == value\n                for key, value in lookup.items()\n            ]):\n                return item\n        raise ObjectDoesNotExist()\n\n\nclass BadType:\n    \"\"\"\n    When used as a lookup with a `MockQueryset`, these objects\n    will raise a `TypeError`, as occurs in Django when making\n    queryset lookups with an incorrect type for the lookup value.\n    \"\"\"\n\n    def __eq__(self):\n        raise TypeError()\n\n\ndef mock_reverse(view_name, args=None, kwargs=None, request=None, format=None):\n    args = args or []\n    kwargs = kwargs or {}\n    value = (args + list(kwargs.values()) + ['-'])[0]\n    prefix = 'http://example.org' if request else ''\n    suffix = ('.' + format) if (format is not None) else ''\n    return '%s/%s/%s%s/' % (prefix, view_name, value, suffix)\n\n\ndef fail_reverse(view_name, args=None, kwargs=None, request=None, format=None):\n    raise NoReverseMatch()\n"
  },
  {
    "path": "tox.ini",
    "content": "[tox]\nenvlist =\n       {py310}-{django42,django51,django52}\n       {py311}-{django42,django51,django52}\n       {py312}-{django42,django51,django52,django60,djangomain}\n       {py313}-{django51,django52,django60,djangomain}\n       {py314}-{django52,django60,djangomain}\n       base\n       dist\n       docs\n\n[testenv]\ncommands = pytest --cov --cov-report xml {posargs}\nenvdir = {toxworkdir}/venvs/{envname}\nsetenv =\n       PYTHONDONTWRITEBYTECODE=1\n       PYTHONWARNINGS=once\ndependency_groups =\n       test\n       optional\n       django42: django42\n       django50: django50\n       django51: django51\n       django52: django52\n       django60: django60\n       djangomain: djangomain\n\n[testenv:base]\n; Ensure optional dependencies are not required\ndependency_groups =\n       test\ndeps =\n\n[testenv:dist]\ncommands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --no-pkgroot --staticfiles {posargs}\ndependency_groups =\n       test\n       optional\n\n[testenv:docs]\nskip_install = true\ncommands =\n       mkdocs build\ndependency_groups =\n       test\n       docs\n\n[testenv:py312-djangomain]\nignore_outcome = true\n\n[testenv:py313-djangomain]\nignore_outcome = true\n\n[testenv:py314-djangomain]\nignore_outcome = true\n"
  }
]