Commit Graph

1914 Commits

Author SHA1 Message Date
Tom Christie
dd10d538ff Merge pull request #416 from tomchristie/unauthenticated_response
Unauthenticated requests - 401 vs 403 responses
2013-01-22 09:12:48 -08:00
Tom Christie
b7ab2aee46 Merge branch 'master' into unauthenticated_response
Conflicts:
	docs/api-guide/authentication.md
2013-01-22 09:11:38 +00:00
Tom Christie
65b62d64ec WWW-Authenticate responses 2013-01-21 21:29:49 +00:00
Tom Christie
e29ba356f0 Added @kevinastone, for work on extra test cases in #602. Thanks! 2013-01-21 17:53:27 +00:00
Tom Christie
778b0dddef Merge pull request #602 from kevinastone/master
TestCase for `format_suffix_patterns`
2013-01-21 09:51:33 -08:00
Tom Christie
98bffa68e6 Don't do an inverted if test. 2013-01-21 17:42:39 +00:00
Kevin Stone
e7916ae0b1 Tweaked some method names to be more clear and added a docstring to the test case class.
Signed-off-by: Kevin Stone <kevinastone@gmail.com>
2013-01-21 09:37:50 -08:00
Kevin Stone
71bd2faa79 Added test case for format_suffix_patterns to validate changes introduced with issue #593.
Signed-off-by: Kevin Stone <kevinastone@gmail.com>
2013-01-20 13:03:38 -08:00
Tom Christie
2c76212e54 Add missing import to tutorial. Fixes #599 2013-01-20 16:38:32 +00:00
Tom Christie
42fcc3599c Added @brutasse for docs fix #600. Thanks! 2013-01-20 15:50:16 +00:00
Tom Christie
3b561f7f30 Merge pull request #600 from brutasse/fix/authtoken-docs
Fixed reference to authtoken in the docs
2013-01-20 07:45:54 -08:00
Bruno Renié
9b9b6529bc Fixed reference to authtoken in the docs 2013-01-20 14:49:07 +01:00
Tom Christie
771821af7d Include kwargs in included URLs 2013-01-19 18:39:39 +00:00
Tom Christie
69083c3668 Drop print statement 2013-01-19 18:36:25 +00:00
Tom Christie
199fa766ff Update release notes 2013-01-19 17:00:20 +00:00
Tom Christie
2c05faa52a format_suffix_patterns now support include-style nested URL patterns. Fixes #593 2013-01-19 16:56:48 +00:00
Tom Christie
37d49429ca Raise assertion errors if @api_view decorator is applied incorrectly. Fixes #596. 2013-01-19 15:51:14 +00:00
Tom Christie
af3fd09845 Tweak imports in tutorial. Fixes #597. 2013-01-19 15:31:21 +00:00
Tom Christie
a98049c5de Drop unneeded test 2013-01-19 15:25:32 +00:00
Tom Christie
4b61ead53f Added @nemesisdesign, for documentation on Apache mod_wsgi setup. Thanks!
Refs #588.
2013-01-18 22:30:03 +00:00
Tom Christie
73b69b9bb6 Rephrasing. 2013-01-18 22:26:36 +00:00
Tom Christie
fb5943bb64 Merge pull request #588 from nemesisdesign/patch-1
mod_wsgi specific documentation for WSGIPassAuthorization
2013-01-18 14:08:59 -08:00
Tom Christie
15ad94c611 Drop the curl notes. Unnecessary. 2013-01-18 22:06:41 +00:00
Tom Christie
bd089836a1 Note on setting ContentType. Fixes #589. Refs #586. 2013-01-18 22:01:33 +00:00
Tom Christie
0672401781 Update release notes. 2013-01-18 22:00:59 +00:00
Tom Christie
211bb89eec Raise Validation Errors when relationships receive incorrect types. Fixes #590. 2013-01-18 21:29:21 +00:00
Tom Christie
6385ac519d Revert accidental merge. 2013-01-18 19:47:57 +00:00
Tom Christie
ecb4494994 Merge pull request #556 from maspwr/one-to-one-nested
One-to-one writable, nested serializer support
2013-01-18 11:01:40 -08:00
Tom Christie
0edf3042b8 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2013-01-18 14:04:59 +00:00
Tom Christie
80a8d0f279 Update docs to reference DabApps commercial support 2013-01-18 14:04:26 +00:00
Tom Christie
c07cdbdaca Kick travis into action 2013-01-17 13:08:06 +00:00
Mark Aaron Shirley
221f7326c7 Use None to delete nested object as opposed to _delete flag 2013-01-16 16:04:20 -08:00
Mark Aaron Shirley
34e14b01e4 Move nested serializer logic into .field_from_native() 2013-01-16 16:04:20 -08:00
Mark Aaron Shirley
2d62bcd5aa Add one-to-one nested update and delete functionality 2013-01-16 16:04:20 -08:00
Mark Aaron Shirley
8e5003a1f6 Update errant test comment 2013-01-16 16:04:20 -08:00
Mark Aaron Shirley
46eea97380 Update one-to-one test names 2013-01-16 16:04:19 -08:00
Mark Aaron Shirley
e66eeb4af8 Remove commented out debug code 2013-01-16 16:04:19 -08:00
Mark Aaron Shirley
72c04d570d Add nested create for 1to1 reverse relationships 2013-01-16 16:04:19 -08:00
Federico Capoano
f19d4ea8b1 Update docs/api-guide/authentication.md
refined mod_wsgi
2013-01-16 17:17:07 +01:00
Federico Capoano
55cc745254 Update docs/api-guide/authentication.md
Added mod_wsgi specific instructions
2013-01-16 17:10:46 +01:00
Tom Christie
0f0a07b732 Note changes to Decimal rendering to json behavior. Fixes #582. 2013-01-16 14:41:57 +00:00
Tom Christie
fecfe57aef Updated release notes. 2013-01-16 14:36:37 +00:00
Tom Christie
0756ca1f42 Added @steve-gregory for nullable slug relation tests.
See: #585
2013-01-16 14:35:30 +00:00
Tom Christie
eb3d4d0e93 Drop bits of relations_slug tests which don't mirror existing tests. 2013-01-16 14:32:51 +00:00
Tom Christie
875841c76a Merge branch 'master' of https://github.com/steve-gregory/django-rest-framework into slug-field-fixes 2013-01-16 13:24:09 +00:00
Steven Gregory
87029122c2 Added a new file 'relations_slug.py' that tests Nullable Foreign Keys and the SlugRelatedField 2013-01-15 13:49:48 -07:00
Tom Christie
e1076cfb49 Added @radiosilence, for the timedelta encoding support. Thanks!
See: #584
2013-01-15 13:31:05 +00:00
Tom Christie
b4c43d5fe4 Update release notes 2013-01-15 13:29:21 +00:00
Tom Christie
685706ff2b Merge pull request #584 from radiosilence/master
Adding timedelta support to JSONEncoder, and an example of how to add decode support to a serializer.
2013-01-15 05:25:24 -08:00
James Cleveland
4fc3b1ba56 Add timedelta encoder to the JSONEncoder class.
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()
2013-01-15 13:08:52 +00:00