From 1f67b9ba9c4ede9b3fa93ba798c5ec777ff3ad69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Gro=C3=9F?= Date: Tue, 6 Nov 2012 20:53:09 +0100 Subject: [PATCH 1/7] added changelog entry and fixed old one --- docs/topics/release-notes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 7eaf4f795..e7007aab3 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -7,6 +7,7 @@ ## Master * Support use of HTML exception templates. Eg. `403.html` +* Hyperlinked related fields optionally take `slug_field`, `slug_url_kwarg` and `pk_url_kwarg` arguments. ## 2.1.0 @@ -16,7 +17,7 @@ * **Serializer `instance` and `data` keyword args have their position swapped.** * `queryset` argument is now optional on writable model fields. -* Hyperlinked related fields optionally take `slug_field` and `slug_field_kwarg` arguments. +* Hyperlinked related fields optionally take `slug_field` and `slug_url_kwarg` arguments. * Support Django's cache framework. * Minor field improvements. (Don't stringify dicts, more robust many-pk fields.) * Bugfix: Support choice field in Browseable API. From 62fc5b80ef7a9a9f60961929be471fb60f295daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Gro=C3=9F?= Date: Tue, 6 Nov 2012 20:54:48 +0100 Subject: [PATCH 2/7] fixed field name --- docs/topics/release-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index e7007aab3..c878144aa 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -7,7 +7,7 @@ ## Master * Support use of HTML exception templates. Eg. `403.html` -* Hyperlinked related fields optionally take `slug_field`, `slug_url_kwarg` and `pk_url_kwarg` arguments. +* HyperlinkedIdentityField optionally take `slug_field`, `slug_url_kwarg` and `pk_url_kwarg` arguments. ## 2.1.0 From 4136b7e44b85c7c887ab0c4379288512aa67fc64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Gro=C3=9F?= Date: Tue, 6 Nov 2012 21:11:05 +0100 Subject: [PATCH 3/7] fixed typo in html status code --- docs/api-guide/status-codes.md | 2 +- rest_framework/status.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api-guide/status-codes.md b/docs/api-guide/status-codes.md index 401f45ce0..b50c96ae3 100644 --- a/docs/api-guide/status-codes.md +++ b/docs/api-guide/status-codes.md @@ -87,7 +87,7 @@ Response status codes beginning with the digit "5" indicate cases in which the s HTTP_503_SERVICE_UNAVAILABLE HTTP_504_GATEWAY_TIMEOUT HTTP_505_HTTP_VERSION_NOT_SUPPORTED - HTTP_511_NETWORD_AUTHENTICATION_REQUIRED + HTTP_511_NETWORK_AUTHENTICATION_REQUIRED [rfc2324]: http://www.ietf.org/rfc/rfc2324.txt diff --git a/rest_framework/status.py b/rest_framework/status.py index f3a5e4814..a1eb48dae 100644 --- a/rest_framework/status.py +++ b/rest_framework/status.py @@ -49,4 +49,4 @@ HTTP_502_BAD_GATEWAY = 502 HTTP_503_SERVICE_UNAVAILABLE = 503 HTTP_504_GATEWAY_TIMEOUT = 504 HTTP_505_HTTP_VERSION_NOT_SUPPORTED = 505 -HTTP_511_NETWORD_AUTHENTICATION_REQUIRED = 511 +HTTP_511_NETWORK_AUTHENTICATION_REQUIRED = 511 From e02a8470e8d32348a9bd7714e1f27cf6e55b5cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Gro=C3=9F?= Date: Tue, 6 Nov 2012 21:18:49 +0100 Subject: [PATCH 4/7] fixed typo --- docs/api-guide/serializers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index ee7f72dd7..0cdae1ce3 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -190,7 +190,7 @@ As an example, let's create a field that can be used represent the class name of # ModelSerializers Often you'll want serializer classes that map closely to model definitions. -The `ModelSerializer` class lets you automatically create a Serializer class with fields that corrospond to the Model fields. +The `ModelSerializer` class lets you automatically create a Serializer class with fields that correspond to the Model fields. class AccountSerializer(serializers.ModelSerializer): class Meta: From 5e5c8899e29eb076d0d39c4918bc9cf497ac96ee Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 7 Nov 2012 10:03:51 +0000 Subject: [PATCH 5/7] Fix repeated breadcrumbs when optional trailing slash is used --- rest_framework/utils/breadcrumbs.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rest_framework/utils/breadcrumbs.py b/rest_framework/utils/breadcrumbs.py index 672d32a37..80e39d46d 100644 --- a/rest_framework/utils/breadcrumbs.py +++ b/rest_framework/utils/breadcrumbs.py @@ -6,7 +6,7 @@ def get_breadcrumbs(url): from rest_framework.views import APIView - def breadcrumbs_recursive(url, breadcrumbs_list, prefix): + def breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen): """Add tuples of (name, url) to the breadcrumbs list, progressively chomping off parts of the url.""" try: @@ -16,7 +16,11 @@ def get_breadcrumbs(url): else: # Check if this is a REST framework view, and if so add it to the breadcrumbs if isinstance(getattr(view, 'cls_instance', None), APIView): - breadcrumbs_list.insert(0, (view.cls_instance.get_name(), prefix + url)) + # Don't list the same view twice in a row. + # Probably an optional trailing slash. + if not seen or seen[-1] != view: + breadcrumbs_list.insert(0, (view.cls_instance.get_name(), prefix + url)) + seen.append(view) if url == '': # All done @@ -24,11 +28,11 @@ def get_breadcrumbs(url): elif url.endswith('/'): # Drop trailing slash off the end and continue to try to resolve more breadcrumbs - return breadcrumbs_recursive(url.rstrip('/'), breadcrumbs_list, prefix) + return breadcrumbs_recursive(url.rstrip('/'), breadcrumbs_list, prefix, seen) # Drop trailing non-slash off the end and continue to try to resolve more breadcrumbs - return breadcrumbs_recursive(url[:url.rfind('/') + 1], breadcrumbs_list, prefix) + return breadcrumbs_recursive(url[:url.rfind('/') + 1], breadcrumbs_list, prefix, seen) prefix = get_script_prefix().rstrip('/') url = url[len(prefix):] - return breadcrumbs_recursive(url, [], prefix) + return breadcrumbs_recursive(url, [], prefix, []) From b3bf887c6784b59fe3b1e4a9393d84476aa4990c Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 7 Nov 2012 10:13:14 +0000 Subject: [PATCH 6/7] Make textareas in browseable API same width as everything else --- rest_framework/static/rest_framework/css/default.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/static/rest_framework/css/default.css b/rest_framework/static/rest_framework/css/default.css index fdf456596..b2e41b994 100644 --- a/rest_framework/static/rest_framework/css/default.css +++ b/rest_framework/static/rest_framework/css/default.css @@ -36,7 +36,7 @@ ul.breadcrumb { margin: 58px 0 0 0; } -form select, form input { +form select, form input, form textarea { width: 90%; } From 0356c5dca49a13d2c6487ea9e300accf9f0bac59 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 7 Nov 2012 11:34:31 +0000 Subject: [PATCH 7/7] Update release notes --- README.md | 10 ++++++++++ docs/topics/release-notes.md | 9 +++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7275761c5..5d3e884d6 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,16 @@ To run the tests. # Changelog +## 2.1.1 + +**Date**: 7th Nov 2012 + +* Support use of HTML exception templates. Eg. `403.html` +* Hyperlinked fields take optional `slug_field`, `slug_url_kwarg` and `pk_url_kwarg` arguments. +* Bugfix: Deal with optional trailing slashs properly when generating breadcrumbs. +* Bugfix: Make textareas same width as other fields in browsable API. +* Private API change: `.get_serializer` now uses same `instance` and `data` ordering as serializer initialization. + ## 2.1.0 **Date**: 5th Nov 2012 diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index c878144aa..ecb6c91a2 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -4,10 +4,15 @@ > > — Eric S. Raymond, [The Cathedral and the Bazaar][cite]. -## Master +## 2.1.1 + +**Date**: 7th Nov 2012 * Support use of HTML exception templates. Eg. `403.html` -* HyperlinkedIdentityField optionally take `slug_field`, `slug_url_kwarg` and `pk_url_kwarg` arguments. +* Hyperlinked fields take optional `slug_field`, `slug_url_kwarg` and `pk_url_kwarg` arguments. +* Bugfix: Deal with optional trailing slashs properly when generating breadcrumbs. +* Bugfix: Make textareas same width as other fields in browsable API. +* Private API change: `.get_serializer` now uses same `instance` and `data` ordering as serializer initialization. ## 2.1.0