Giter Site home page Giter Site logo

Comments (4)

rpkilby avatar rpkilby commented on May 20, 2024

Hi @dbinetti. Looking over the code, the choices field is just a regular CharField that pulls its choices from the parent model, so it would exhibit the same characteristics as the underlying field.

What are you're trying to accomplish by using the human-readable value instead of the code value? Could you provide a concrete example?

Using the human-readable value is generally problematic, as this is a display value subject to transformation (language translation, capitalization, etc...). The code values are more durable since they aren't transformed.

from django-rest-framework-filters.

dbinetti avatar dbinetti commented on May 20, 2024

I'm trying to make the URL human readable (and fungible directly). However, your point about transformation makes good sense. I'll let this go.

from django-rest-framework-filters.

rpkilby avatar rpkilby commented on May 20, 2024

I'd say your best bet is to use code values that are human friendly.

eg,

# Use:
STATUSES = (
    ('started', 'Started'),
    ('in_progress', 'In Progress'),
    ('finished', 'Finished'),
    ('errored', 'Errored'),
)

# instead of
STATUSES = (
    ('s', 'Started'),
    ('p', 'In Progress'),
    ('f', 'Finished'),
    ('e', 'Errored'),
)

from django-rest-framework-filters.

dbinetti avatar dbinetti commented on May 20, 2024

actually, i'm using integers (order is important) motel_utils allow for a
three-tuple (1,'foo', 'Foo Bar'), so that would potentially work, but i
think i'll just work things on the front end appropriately.

tks

On Wed, Mar 16, 2016 at 1:43 PM, Ryan P Kilby [email protected]
wrote:

I'd say your best bet is to use code values that are human friendly.

eg,

Use:STATUSES = (

('started', 'Started'),
('in_progress', 'In Progress'),
('finished', 'Finished'),
('errored', 'Errored'),

)

instead ofSTATUSES = (

('s', 'Started'),
('p', 'In Progress'),
('f', 'Finished'),
('e', 'Errored'),

)


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#78 (comment)

from django-rest-framework-filters.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.