aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/utils
AgeCommit message (Collapse)Author
2014-09-23NullBooleanFieldTom Christie
2014-09-23Tests for field choicesTom Christie
2014-09-18First pass on ManyRelationTom Christie
2014-09-18get_base_field() refactorTom Christie
2014-09-15Drop label from serializer fields when not neededTom Christie
2014-09-12Tidy up JSONEncoderTom Christie
2014-09-12MethodField -> SerializerMethodFieldTom Christie
2014-09-11NotImplemented stubs for Field, and DecimalField improvementsTom Christie
2014-09-11Nice manager representations on serializer classesTom Christie
2014-09-11Improve memory address removal for serializer representationsTom Christie
2014-09-11Improve memory address removal for serializer representationsTom Christie
2014-09-11Merge masterTom Christie
2014-09-10Compat fixesTom Christie
2014-09-09Fleshing out serializer fieldsTom Christie
2014-09-05Use force_text from compatJosé Padilla
2014-09-05Merge remote-tracking branch 'poswald/view-description-as-promise' into ↵José Padilla
view-description-as-promise
2014-09-02Add relations and get tests runningTom Christie
2014-08-29First passTom Christie
2014-08-19Resolve python3 linting issueTom Christie
2014-08-19Code linting and added runtests.pyTom Christie
2014-08-19replace unicode call with force_textPaul Oswald
2014-07-29evaluate content at function startPaul Oswald
2014-07-28Evaluate content before passing to regex.subPaul Oswald
Issue #1708
2014-04-13Merge remote-tracking branch 'origin/master' into 2.4.0Xavier Ordoquy
Conflicts: .travis.yml docs/api-guide/fields.md docs/api-guide/routers.md docs/topics/release-notes.md rest_framework/authentication.py rest_framework/serializers.py rest_framework/templatetags/rest_framework.py rest_framework/tests/test_authentication.py rest_framework/tests/test_filters.py rest_framework/tests/test_hyperlinkedserializers.py rest_framework/tests/test_serializer.py rest_framework/tests/test_testing.py rest_framework/utils/encoders.py tox.ini
2014-04-11Fix dict_keys equality test for python 3.Ian Leith
2014-01-17Encode django QuerySets to lists and not dicts in JSONEncoderMathieu Pillard
2013-12-13Merge branch 'master' into 2.4.0Tom Christie
Conflicts: .travis.yml docs/api-guide/routers.md docs/topics/release-notes.md rest_framework/compat.py
2013-12-09Fix compat issues for #1231Tom Christie
2013-11-21Fix issue #1231: JSONEncoder doesn't handle dict-like objectsMalcolm Box
Check for __getitem__ and then attempt to convert to a dict. The check for __getitem__ is there as there's no universal way to check if an object is a mapping type, but this is a likely proxy
2013-10-17Fix decimal support with YAMLRendererbadaud_t
2013-09-25Drop 1.3 supportTom Christie
2013-09-13Let JSONEncoder handle Numpy data types.David Pretty
json.JSONEncoder cannot serialize Numpy data types. Numpy arrays and array scalars have a tolist() method which casts the object to a standard python data type.
2013-08-29Fix breadcrumb view namesTom Christie
2013-08-19Move view name/description functions into public spaceTom Christie
2013-08-17Updated default view name/description functionsChristopher Paolini
Forgot to update the default view name/description functions to the new setup.
2013-08-17Improved view/description function settingChristopher Paolini
Now supports each View having its own name and description function and overriding the global default.
2013-08-16Settings now have default functionsChristopher Paolini
Updated the setting to have a default function.
2013-08-15Ability to override name/description of viewChristopher Paolini
Added settings and additions to formatting.py
2013-06-26Refactored get_view_description, moved appropriate tests to test_description.pyIgor Kalat
2013-06-22Make browsable API views play nice with utf-8Igor Kalat
2013-05-24Clean up OPTIONS implementationTom Christie
2013-05-07Fix breadcrumb rendering issue2.3.1Tom Christie
2013-04-26Bits of cleanupTom Christie
2013-04-26Deal with List/Instance suffixes for viewsetsTom Christie
2013-04-04Factor view names/descriptions out of View classTom Christie
2013-02-22XML cleanupTom Christie
2013-02-04Cleanup importsTom Christie
Mostly adding `from __future__ import unicode_literals` everywhere.
2013-02-01Py3k cleanupTom Christie
2013-02-01Merge branch 'p3k' of https://github.com/linovia/django-rest-framework into ↵Tom Christie
working Conflicts: rest_framework/authentication.py rest_framework/relations.py rest_framework/serializers.py rest_framework/settings.py rest_framework/tests/authentication.py rest_framework/tests/genericrelations.py rest_framework/tests/generics.py rest_framework/tests/relations_hyperlink.py rest_framework/tests/relations_nested.py rest_framework/tests/relations_pk.py rest_framework/tests/serializer.py
2013-01-15Add timedelta encoder to the JSONEncoder class.James Cleveland
Whilst this commit adds *encoding* of timedeltas to a string of a floating point value of the seconds, you must add your own serializer field for whatever timedelta model field you are using. This is because Django doesn't support any kind of timedelta field out-of-the-box, so you have to either implement your own or use django-timedelta. If this is the case and you want to serialise timedelta input, you will have to implement your own special field to use for the timedelta, which is not included in core as it is based on a 3rd party library. Here is an example: import datetime import timedelta from django import forms from django.core import validators from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from rest_framework.fields import WritableField class TimedeltaField(WritableField): type_name = 'TimedeltaField' form_field_class = forms.FloatField default_error_messages = { 'invalid': _("'%s' value must be in seconds."), } def from_native(self, value): if value in validators.EMPTY_VALUES: return None try: return datetime.timedelta(seconds=float(value)) except (TypeError, ValueError): msg = self.error_messages['invalid'] % value raise ValidationError(msg) Which is based on the FloatField. This field can then be used in your serializer like this: from yourapp.fields import TimedeltaField class YourSerializer(serializers.ModelSerializer): duration = TimedeltaField()