Comments (4)
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.
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.
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.
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)
- Django 3 support HOT 1
- RecursionError for circular self relationship HOT 1
- filter on two model HOT 1
- Trying out ComplexJSONFilterBackend HOT 1
- ImportError: cannot import name 'six' from 'django.utils' HOT 1
- Specify Model Dynamiclly HOT 2
- TypeError: 'Meta.fields' must not contain non-model field names HOT 2
- Is this project still alive? HOT 3
- CI status failures HOT 1
- Invalid filter for properties of model of RelatedMultipleFilter HOT 1
- Ordering (sorting) from URL in ComplexFilterBackend HOT 1
- Combining filters for multi-valued relationships with `AND` HOT 2
- RelatedMultipleFilter doesn't work as expected HOT 1
- django-rest-framework-filters does not seem to support RelatedFilters with non-default relationships
- PROPOSAL: Custom help text for FilterSet
- ImportError: cannot import name 'QUERY_TERMS' from 'django.db.models.sql.constants'
- Django 4.x compatibility HOT 5
- Consider transferring ownership to Jazzband HOT 2
- How to use the field 'in' in django-rest-framework-filters, like 'user_id__in=[12,13]'? HOT 2
- Tests fail with Django 4.2: ImportError: cannot import name 'url' from 'django.conf.urls'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-rest-framework-filters.