Comments (4)
I don't know off the top of my head, but I believe I added added in special date time handing here as, at the time, DRF was incapable of correctly parsing ISO 8601 formatted times.
On May 29, 2015, at 4:29 PM, Alex Rothberg [email protected] wrote:
This datetime does not seem to parse correctly: 2010-1-2T23:18:23.861723Z even though DRF handles the format.
—
Reply to this email directly or view it on GitHub.
from django-rest-framework-filters.
@cancan101 You may want to investigate here: https://github.com/philipn/django-rest-framework-filters/blob/master/rest_framework_filters/filters.py#L12
We may simply want to remove these definitions, as it appears DRF fixes this issue in its 3.0 release?
from django-rest-framework-filters.
I think it's actually Django which handles the datetime parsing: https://github.com/django/django/blob/0ed7d155635da9f79d4dd67e4889087d3673c6da/django/utils/dateparse.py#L84-L109
from django-rest-framework-filters.
Something like this (perhaps with a check to see if 'iso-8601'
is in api_settings.DATETIME_INPUT_FORMATS
):
class DateTimeFormFieldFixed(forms.DateTimeField):
def to_python(self, value):
try:
return super(DateTimeFormFieldFixed, self).to_python(value)
except ValidationError as ex:
if ex.code != 'invalid':
raise
try:
result = parse_datetime(value)
except ValueError:
raise ValidationError(self.error_messages['invalid'], code='invalid')
if result is None:
raise
return from_current_timezone(result)
class DateTimeFilterFixed(DateTimeFilter):
field_class = DateTimeFormFieldFixed
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.