Skip to content

Choice values are always represented as strings. #4111

@unreality

Description

@unreality

If you call OPTIONS on a model that has fields with choices, the displayed choices are always strings eg:

"account": {
    "type": "field",
    "required": true,
    "read_only": false,
    "label": "Account",
     "choices": [
        {
            "display_name": "Choice 1 Display Name",
            "value": "71518788"
        },
        {
            "display_name": "Choice 2 Display Name",
            "value": "71519217"
        }
        ....etc

Currently for RelatedField, when you request the choices property, all values are converted to strings, but this probably doesn't make sense on things such as PrimaryKeyRelatedField, or other field values which are integers or booleans.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy