From 6c1d0d7ed05941c7a673d1bb3f0e1b56a4b6ab44 Mon Sep 17 00:00:00 2001 From: Dirk Moors Date: Thu, 12 Mar 2015 16:36:26 +0100 Subject: Fixed problem with imporing rest_framework.views in apps.py --- rest_framework/pagination.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rest_framework') diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index f41a9ae1..5e60448d 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -10,7 +10,7 @@ from django.core.paginator import InvalidPage, Paginator as DjangoPaginator from django.template import Context, loader from django.utils import six from django.utils.six.moves.urllib import parse as urlparse -from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext_lazy as _ from rest_framework.compat import OrderedDict from rest_framework.exceptions import NotFound from rest_framework.response import Response -- cgit v1.2.3 From 8d0dbc8092a754e1f0f7d80d93506072556f35a2 Mon Sep 17 00:00:00 2001 From: Raphaƫl Barrois Date: Fri, 13 Mar 2015 01:07:20 +0100 Subject: Fix lookup_url_kwarg handling in viewsets. The ``lookup_url_kwarg`` is intended to set the name of a field in the URL regexps when using custom ``lookup_field``, but the routers ignore it altogether. --- rest_framework/routers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'rest_framework') diff --git a/rest_framework/routers.py b/rest_framework/routers.py index b1e39ff7..4df852bf 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -218,14 +218,15 @@ class SimpleRouter(BaseRouter): https://github.com/alanjds/drf-nested-routers """ - base_regex = '(?P<{lookup_prefix}{lookup_field}>{lookup_value})' + base_regex = '(?P<{lookup_prefix}{lookup_url_kwarg}>{lookup_value})' # Use `pk` as default field, unset set. Default regex should not # consume `.json` style suffixes and should break at '/' boundaries. lookup_field = getattr(viewset, 'lookup_field', 'pk') + lookup_url_kwarg = getattr(viewset, 'lookup_url_kwarg', None) or lookup_field lookup_value = getattr(viewset, 'lookup_value_regex', '[^/.]+') return base_regex.format( lookup_prefix=lookup_prefix, - lookup_field=lookup_field, + lookup_url_kwarg=lookup_url_kwarg, lookup_value=lookup_value ) -- cgit v1.2.3 From 2266fec99dd10984e31ac4b50b9d6fed1355565b Mon Sep 17 00:00:00 2001 From: mochawich Date: Fri, 13 Mar 2015 17:03:51 +0100 Subject: fixed missing anchor closing tag when next_url is none, big part of page html will be rendered under the as it does not have a closing tag.--- .../templates/rest_framework/pagination/previous_and_next.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rest_framework') diff --git a/rest_framework/templates/rest_framework/pagination/previous_and_next.html b/rest_framework/templates/rest_framework/pagination/previous_and_next.html index eacbfff4..08c17709 100644 --- a/rest_framework/templates/rest_framework/pagination/previous_and_next.html +++ b/rest_framework/templates/rest_framework/pagination/previous_and_next.html @@ -7,6 +7,6 @@ {% if next_url %} {% else %} - + {% endif %} -- cgit v1.2.3